Skip to content

Commit

Permalink
feat: first? iteration of the piano tutorial (#240)
Browse files Browse the repository at this point in the history
* feat: first? iteration of the piano tutorial

* fix: change emoji

* feat: docs - more live examples
  • Loading branch information
michalsek authored Dec 18, 2024
1 parent e23123b commit e17399b
Show file tree
Hide file tree
Showing 18 changed files with 2,264 additions and 7 deletions.
14 changes: 14 additions & 0 deletions packages/audiodocs/docs/fundamentals/lets-make-some-noise.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -108,3 +108,17 @@ import LetsMakeSomeNoiseSrc from '!!raw-loader!@site/src/examples/LetsMakeSomeNo
In web environment you can use `decodeAudioDataSource` directly on the asset url, without the need to download it first.

:::

## Summary

In this guide, we have learned how to create a simple audio player using `AudioContext` and `AudioBufferSourceNode` as well as how we can load audio data from a remote source. To sum up:

- `AudioContext` is the main object that controls the audio graph.
- `decodeAudioDataSource` method can be used to load audio data from a local audio source in form of `AudioBuffer`.
- `AudioBufferSourceNode` can be used to any `AudioBuffer`.
- In order to hear the sounds, we need to connect the source node to the destination node exposed by `AudioContext`.
- We can control the playback of the sound using `start` and `stop` methods of the `AudioBufferSourceNode` (And other source nodes which we show later).

## What's next?

In [the next section](/fundamentals/making-a-piano-keyboard) we will learn more about how the audio graph works, what are audio params and how we can use them to create a simple piano keyboard.
Loading

0 comments on commit e17399b

Please sign in to comment.