Audio Graph
Audio Graph Basics
Last updated
Was this helpful?
Audio Graph Basics
Last updated
Was this helpful?
As mentioned in the section, Sattern operates around the Audio Graph concept. Audio Graphs are a way to house multiple "audio units" or nodes and interconnect them to each other.
Let's begin by adding some code to our "main.js" file that creates a new Sampler
object and adds it to Sattern's main audio graph
object.
The code on line #7
creates a new sampler
object and the code on line #8
adds the newly created sampler
object to Sattern's main graph
object. You can copy the above code snippet and replace the contents of your "main.js" file. Press Command + R
or Command + S
to save and re-load the current file.
Samplers need some sort of audio file(s) to make sound, so let's add some sounds to our sampler
object.
The newly added lines #10-12
create a sound object for the specified .wav
file and sets the lowKey
, highKey
and rootKey
properties that will be used to "map" the specified sound one it is added to the sampler
object. Line #13
adds the newly created sound
object to our sampler
object. Again, copy the above code snippet and replace the contents of your "main.js" file. Press Command + R
or Command + S
to save and re-load the current file.
Now it's time to actually make some sound.
The sample being used in this example is taken from 's library and can be downloaded below. Place this file inside the project's root folder.