Effects in EarSketch: setEffect
EarSketch lets the composer alter clips to produce new and unique sounds. This is achieved through the setEffect()
function, the focus of this chapter. For a complete description of all the EarSketch API functions, see the EarSketch API tab.
Using Effects in EarSketch
fitMedia()
let us compose music by arranging different audio clips in the DAW. As a composer and producer, you must also pay attention to the characteristics of those sounds. Effects allow us to change qualities of the sounds in a project. Similar to how adding a filter alters a photo, adding an audio effect to a track changes the sound in new and interesting ways. Listen to the reference clip, below, with no effects, and then compare it with the next clip that has a delay effect applied.
No effect:
Delay effect:
To add an effect to a track in the DAW, we use the function setEffect()
. Similar to fitMedia()
, setEffect()
takes 4 arguments to specify its outcome. The setEffect()
arguments are:
-
Track Number: The track the effect is added to.
-
Effect Name: The specific effect being used.
-
Effect Parameter: The parameter, or setting, for the effect.
-
Effect Value: The value of the parameter: a number in a specific range.
If we wanted to add a delay effect on track 1 with the delay time we calculated in the previous video, our function call would look like this: setEffect(1, DELAY, DELAY_TIME, 500)
.
In the code below, we assign several audio clips (constants) to variables. These variables are used in multiple fitMedia()
calls, organized by track number. Run the code and have a listen.
# Delay Effect: Adding delay to a track
# Setup
from earsketch import *
setTempo(120)
# Music
lead1 = EIGHT_BIT_ATARI_SYNTH_001
lead2 = EIGHT_BIT_ATARI_SYNTH_002
pad1 = EIGHT_BIT_ATARI_PAD_002
pad2 = EIGHT_BIT_ATARI_PAD_003
drums1 = EIGHT_BIT_ANALOG_DRUM_LOOP_004
drums2 = EIGHT_BIT_ANALOG_DRUM_LOOP_003
fitMedia(lead1, 1, 1, 7)
fitMedia(lead2, 1, 7, 9)
fitMedia(pad1, 2, 1, 3)
fitMedia(pad2, 2, 3, 5)
fitMedia(pad1, 2, 5, 7)
fitMedia(pad2, 2, 7, 9)
fitMedia(drums1, 3, 3, 5)
fitMedia(drums2, 3, 5, 9)
# Effects
# setEffect(1, DELAY, DELAY_TIME, 500) # Adds a delay (echo) effect, at intervals of 500ms
# setEffect(1, DELAY, DELAY_FEEDBACK, -20.0) # Lowers the relative amount of repeats (default is -3.0)
// Delay Effect: Adding delay to a track
// Setup
setTempo(120);
// Music
var lead1 = EIGHT_BIT_ATARI_SYNTH_001;
var lead2 = EIGHT_BIT_ATARI_SYNTH_002;
var pad1 = EIGHT_BIT_ATARI_PAD_002;
var pad2 = EIGHT_BIT_ATARI_PAD_003;
var drums1 = EIGHT_BIT_ANALOG_DRUM_LOOP_004;
var drums2 = EIGHT_BIT_ANALOG_DRUM_LOOP_003;
fitMedia(lead1, 1, 1, 7);
fitMedia(lead2, 1, 7, 9);
fitMedia(pad1, 2, 1, 3);
fitMedia(pad2, 2, 3, 5);
fitMedia(pad1, 2, 5, 7);
fitMedia(pad2, 2, 7, 9);
fitMedia(drums1, 3, 3, 5);
fitMedia(drums2, 3, 5, 9);
// Effects
// setEffect(1, DELAY, DELAY_TIME, 500); // Adds a delay (echo) effect, at intervals of 500ms
// setEffect(1, DELAY, DELAY_FEEDBACK, -20.0); // Lowers the relative amount of repeats (default is -3.0)
It sounds fine, but let’s spice it up a bit by adding a delay effect to the lead synth. Uncomment the first setEffect()
call in the effects section by deleting the #
character in front of it. This setEffect()
call adds a delay to track 1 and lets us modify the delay time. In this example, we have set the delay time to match the length of a beat, at 500ms. Run the script and press play to hear the difference. Arguably, adding this effect made the song worse. However, we also have control of the delay feedback, which determines the relative number of repeats, or echoes. Uncomment the second setEffect()
call. With this function call, the delay feedback is lowered from the default of -3dB to -20dB, resulting in fewer repeats and a more desirable sound. Run the script again and press play to hear the final version.
It sounds fine, but let’s spice it up a bit by adding a delay effect to the lead synth. Uncomment the first setEffect()
call in the effects section by deleting the //
characters in front of it. This setEffect()
call adds a delay to track 1 and lets us modify the delay time. In this example, we have set the delay time to match the length of a beat, at 500ms. Run the script and press play to hear the difference. Arguably, adding this effect made the song worse. However, we also have control of the delay feedback, which determines the relative number of repeats, or echoes. Uncomment the second setEffect()
call. With this function call, the delay feedback is lowered from the default of -3dB to -20dB, resulting in fewer repeats and a more desirable sound. Run the script again and press play to hear the final version.
EarSketch supports a variety of effects that are common in music production. For a complete list of the effects and how to use them see effects.
Chapter 4 Summary
-
Effects change the qualities of a sound to make them more unique.
-
Delay creates a recurring, decaying echo by playing repeated copies of a sound.
-
Effects are implemented in EarSketch with the
setEffect()
function. Its syntax issetEffect(trackNumber, effectName, effectParameter, effectValue)
.-
trackNumber: The track the effect is added to.
-
effectName: The specific effect being used.
-
effectParameter: The setting used for the effect.
-
effectValue: The value of the parameter: a number in a specific range.
-
Questions
What does an effect allow you to do in EarSketch?
-
Change the qualities of sound within a project
-
Add a sound to a track
-
Create a drum beat
-
Change the tempo of a song
Which of these is NOT a setEffect()
argument?
-
Clip Name
-
Effect Name
-
Effect Value
-
Track Number
How would you set the delay time of a delay effect on track 3 to 50 milliseconds?
-
setEffect(3, DELAY, DELAY_TIME, 50.0)
-
setEffect(DELAY, 3, DELAY_TIME, 50.0)
-
fitMedia(DELAY, 3, DELAY_TIME, 50.0)
-
setEffect(50, DELAY_FEEDBACK, 1)