Effects Case Studies
Effects are a big topic, and there are a lot of uses that we haven't covered in great detail in the lessons themselves. Here are some examples of how effects can be used for particular goals in the EarSketch environment.
Case Study #1: Crescendo and Decrescendo with a Keyboard
Crescendo is the musical term for increasing volume (amplitude) over time. Decrescendo means to decrease volume (amplitude) over time. Keyboard players often use a volume pedal to control the intensity of the sound while playing. This example shows a keyboard increasing and decreasing volume over 8 measures:
The following code generates this example:
# Keyboard Volume from earsketch import * init() keyboard = RAW_POWER_SYNTH3_2M fitMedia(keyboard, 1, 1, 9) # Crescendo - Volume Pedal pressed setEffect(1, VOL_PAN, VOL_PAN_VOL, -30, 1, 5, 5) #Decrescendo - Volume Pedal released setEffect(1, VOL_PAN, VOL_PAN_VOL, 5, 5, -30, 9) finish()See this example on the social network
Note about the Volume Effect:
The parameters for the Volume Effect range from -60 to 12 with 0 being “unity” or standard volume. Why do we use this scale? Examine this image of a slider from a mixer:
The numbers indicate a logarithmic scale that increases the order of magnitude as the sound grows stronger. This measures decibels which is the same as the richter scale for earthquakes. That is why “0 dB” represents the “center” for volume. The “0 dB” value indicates that there is no change in volume from the original track. Positive numbers increase the volume, while negative numbers decrease the volume. Note that for every increase by “10 dB”, the loudness of the sound is doubled. Values between -30 and about 5 work best for the volume effect. Note that a value of -60 means silence.
Case Study #2: Guitar Distortion
Guitarists use a foot pedal to control the distortion level in real time during performance. We can simulate this with EarSketch by using a for loop to increase and decrease distortion over a given segment of the measure. Consider the following sample:
Here, a guitar player emphasizes beats 1 and 1.375 with an increase in distortion. The slope up and down of the “peaks” indicate where the pedal is pressed and released.
Using EarSketch, the following code generates the above example:
# Guitar Distortion from earsketch import * init() fitMedia(RAW_POWER_GUITAR8_2M, 1, 1, 9) distortionValues = [0, 40] distortionString = "1+-0+-1-0+++++-" for measure in range(1, 9): rhythmEffects(1, DISTORTION, DISTO_GAIN, distortionValues, measure, distortionString ) finish()See this example on the social network
The for loop from lines 9 to 18 generates the distortion envelope:
- Line 9 directs the loop to count 8 times assigning the index variable to “measure.”
- Lines 10 and 11 Set the first Distortion effect. Line 11 is the releasing of the pedal back to 0
- Lines 12-15 create variables modeling the action of the pedal and assigning values based on 1/16th of the beat to measure locations
- Lines 16 and 17 deploy these “pedal” variables using the setEffect method
- Line 18 is the “pickup” to the next measure. This represents the “pressed pedal” for the effect on beat 1 of the next measure.
Note about measure subdivisions
The EarSketch init() function divides measures into 16 segments on the timeline. The following values will be helpful in setting Effect points:
|Note value||Decimal value|
Case Study #3: “Left and Right Stereo”
The “Pan” effect directs the sound to the “Left” or “Right” speakers in a stereo system. Sweeping music from Left to Right or Right to Left gives the listener a sense of “space” as they perceive the sound coming from different directions. The following example shows an instrument and drum track “changing sides” from Left to Right:
The following code generates this sample:
# Pan Demonstration from earsketch import * init() setTempo(144) keyboard = LATIN_FLUTE3_2M drums = LATIN_HEAVYBOSSADRUMS_2M fitMedia(keyboard, 1, 1, 9) fitMedia(drums, 2, 1, 9) start = 1 end = 5 Left = -100 Right = 100 setEffect(1, VOL_PAN, VOL_PAN_PAN, Left, start, Left, end) setEffect(2, VOL_PAN, VOL_PAN_PAN, Left, start, Left, end) start = 5 end = 9 setEffect(1, VOL_PAN, VOL_PAN_PAN, Right, start, Right, end) setEffect(2, VOL_PAN, VOL_PAN_PAN, Right, start, Right, end) finish()See this example on the social network
Note the use of variables in lines 14 to 17 to define the start, end, left, and right sides.
Case Study #4: Using the pan effect on one track
You can also rapidly change sides on one track to give the sense of more than one instrument playing. Using the same flute and drum mix, note that the pan effect is used to “switch sides” for the flute track:
# Pan Demonsration #2 from earsketch import * init() setTempo(144) keyboard = LATIN_FLUTE3_2M drums = LATIN_HEAVYBOSSADRUMS_2M fitMedia(keyboard, 1, 1, 9) fitMedia(drums, 2, 1, 9) panValues = [100, -100] panString = "1+++++0+++++++1+++0+++++1++0++++" for measure in range(1, 9, 2): rhythmEffects(1, VOL_PAN, VOL_PAN_PAN, panValues, measure, panString) finish()See this example on the social network
Case Study #5: Using Pitch Change and Modulation to Increase Tension
Modulation means to change the pitch center of a musical selection up or down. Composers use modulation in upward motion to increase tension within music. The following example uses a string passage that changes pitch upwards by 1 semitone every 2 measures.
#Pitch Change for Modulation from earsketch import * init() setTempo(132) strings = HIP_HOP_PROGSTRINGS1_2M stringBeat = "0+++++++++++++++++------0+++0+++" for measure in range(1, 9, 2): makeBeat(strings, 1, measure, stringBeat) for pitch in range(4): start = (pitch * 2) + 1 end = start + 2 setEffect(1, PITCHSHIFT, PITCHSHIFT_SHIFT, pitch, start, pitch, end) finish()See this example on the social network
Notes for Pitch:
A “semitone” is a half step in music. An interval is the “distance” between pitches measured in semitones. Below you can see how semitones relate to the keys on a keyboard:
|Half Step||1 semitone|
|Whole Step||2 semitones*|
|Major 3rd||4 semitones|
|Perfect 4th||5 semitones|
|Perfect 5th||7 semitones|
|minor 6th||8 semitones|
|Major 6th||9 semitones|
|minor 7th||10 semitones|
|Major 7th||11 semitones|
|Octave||= 12 semitones|
*a common modulation technique in popular music to to move up by 2 semitones or 1 whole step, usually on return to the chorus section after a bridge