Sound Effects with Sequencing
This page contains multiple examples of various sound effects that utilize sequencing. Each code will contain a description of how it utilizes a sequence, but be sure to take the time to explore how each example functions. Also feel free to duplicate the code and develop your own versions of these effects for additional experience.
Bubbles with sound
Click on the bubbles!
This example, inspired by HackPact, starts be generating 10 circles of random sizes and positions around the canvas. The code then uses the circle’s horizontal position to determine a pitch, and size to determine a volume. THese values are then applied to a synthesizer that is triggered to play whenever the circle is clicked on.
Click the button (watch your volume level before interacting with this code)
This example crates an instrument that plays back a long, loud synthetic impact sound when triggered with the on-screen button. This instrument has multiple effects applied to the synthesizer, and each of them has one or more parameters scheduled to ramp to a new value once the start button has been clicked. By combining filters, delays, and reverb to what would normally be a simple ‘C4’ note, we are able to generate this automated effect.
Rain on a tin roof
click the start button to start raining.
This code, like the previous one, generates sound via a synthesizer instrument and effects. However, instead of automating the parameters of those effects, the sequencing and scheduling is applied to the loop that begins when the start button is clicked. The loop is set to trigger and repeat a certain number of times on the trigger, but is given a probability value to increase the randomness of the event occurring. This causes the metallic hit to happen continually, but in a random fashion, simulating rain on a tin roof.
Click the button to start the alarm.
This effect Applies an LFO to the cutoff frequency a filters connected to 8 different noise synthesizers. The LFO is used to oscillate that cutoff frequency back and forth as various rates, and delay the entrance of each synthesizer to create the building effect. By changing the LFO parameters independently of each other using a for loop, we are able to generate a much more complex effect than with just one LFO.
Before we move on to the chapter assignment, which will have you combine your knowledge of synthesizers and sequences to create a new code, lets review what we have learned so far because there has been a lot of information given in the past few pages.