TunePad Programming Reference

playNote(note, beats = 1.0, velocity = 100)

Play a note with a pitch value greater than 0. You can also call playNote with a list of notes that will be played at the same time. The optional parameter beats sets how long the will note last, and the optional parameter velocity sets how hard/loud the will note sounds. Velocity can be any number between 0 and 127.
playNote(32)
playNote(55, beats = 0.5, velocity = 20)
playNote(0, beats = 2, velocity = 80)
playNote([36, 40, 43])
playNote([36, 40, 43], beats = 2)

rest(beats = 1)

Add a pause between notes. The length of the pause can be set using the optional beats parameter.
rest()
rest(2)
rest(beats = 1.5)

for loop

You can repeat something over and over using a for loop. In the first example, the variable called i counts from 0 to 7. In the second example, i counts from 36 to 45.
for i in range(0, 8):
   playNote(50)
   rest()

for i in range(36, 46):
   playNote(i)
   rest()

with bend(cents = 0, beats = -1, start = 0):

Adds a pitch bend effect that changes the value of notes over time. The cents parameter represents the total change in pitch. One cent is equal to 1/100 of a semitone (the distance between two adjacent notes). Using a value of 500 for the cents parameter would bend the note by five semitones (the same as the distance from a C to an F on the piano keyboard). The beats parameter specifies how long it takes for the note to bend. If you don't provide the beats parameter, the effect will be constant. An optional start parameter specifies how long to wait (in beats) before starting the effect. You can also provide an list of values instead of a single number for the cents parameter. These values represent the change in cents over time. Each number will be evenly distributed over the duration of the effect.
# apply a constant pitch bend
with bend(cents = 100):
    playNote(36)

# bend a note from 48 to 53 over one beat
with bend(cents = 500, beats = 1):
    playNote(48)

# bouncy spring effect
with bend(cents = [0, 500, -500, 500, -500, 500, 0], beats = 1):
    playNote(42, beats = 2)

with gain(value = 0, beats = 1, start = 0):

Changes the volume of notes. The value parameter represents the change in volume (for example a value of 0.5 would reduce the volume by 50%). If a single number is provided, a constant change in volume will be applied—there will be no change over time. You can also pass a list of numbers to create a change over time. Each number will be evenly distributed over the duration of the effect given by the beats parameter. An optional start parameter specifies how long to wait (in beats) before starting the effect.
# cut the volume by half
with gain(value = 0.5):
    playNote(48)

# fade in
with gain(value = [ 0, 1 ], beats = 2):
    playNote(48, beats = 2)

# fade out after one beat
with gain(value = [ 1, 0 ], beats = 2, start = 1)
    playNote(42, beats = 3)

with pan(value = 0, beats = 1, start = 0):

Applies a stereo pan effect, shifting the sound more towards the left or right speaker. The value parameter ranges from -1.0 (full left speaker) to 1.0 (full right speaker). A value of 0.0 evenly splits the sound. If a single number is provided, the effect will be constant—there will be no change over time. You can also pass a list of numbers to create a change over time. Each number will be evenly distributed over the duration of the effect given by the beats parameter. An optional start parameter specifies how long to wait (in beats) before starting the effect.
# slowly pan from the left speaker to the right over three beats
with pan(value = [-1.0, 1.0], beats = 3):
    playNote(35, beats = 3)

with lowpass(frequency = 1000, beats = 1, start = 0):

Applies a lowpass filter effect that reduces the energy of high frequency sounds while leaving low frequency sounds below a cutoff point unaffected. The frequency parameter specifies the cutoff frequency for the effect (between 10 Hz and 22 kHz). You can also pass a list of numbers to create a change over time. Each number will be evenly distributed over the duration of the effect given by the beats parameter. An optional start parameter specifies how long to wait (in beats) before starting the effect.
# creates a wha-wha effect after one beat by quickly changing
# the frequency cutoff of a lowpass filter between 200 and 800hz
with lowpass(frequency = [200, 800, 200, 800, 200, 800], beats=1):
    playNote(47, beats=3)


# adds a rhythmic pulse to piano notes
for i in range(0, 4):
    with lowpass(frequency = [ 50, 800, 50 ], beats = 0.25, start = 1):
        playNote(33, 2) 

with highpass(frequency = 1000, beats = 1, start = 0):

The highpass filter reduces the energy of low frequency sounds while allowing freqencies above the cutoff point to pass through unaltered. The frequency parameter specifies the cutoff frequency for the effect (between 10 Hz and 22 kHz). You can also pass a list of numbers to create a change over time. Each number will be evenly distributed over the duration of the effect specified by the beats parameter. An optional start parameter specifies how long to wait (in beats) before starting the effect.

with bandpass(frequency = 1000, beats = 1, start = 0):

The bandpass filter allows frequencies near the cutoff point to pass through unaltered while reducing the energy of frequencies above and below. The frequency parameter specifies the cutoff frequency for the effect (between 10 Hz and 22 kHz). You can also pass a list of numbers to create a change over time. Each number will be evenly distributed over the duration of the effect specified by the beats parameter. An optional start parameter specifies how long to wait (in beats) before starting the effect.
# carving out frequencies for a clap sound in the drums
clap = 10
with bandpass(frequency = [100, 11000], beats=4):
    for i in range(0, 16):
        playNote(10, beats = 0.25)

with notch(frequency = 1000, beats = 1, start = 0):

The notch filter reduces the energy of sounds near the cutoff frequency, while allowing higher and lower frequencies to pass through unaltered. The frequency parameter specifies the cutoff frequency for the effect (between 10 Hz and 22 kHz). You can also pass a list of numbers to create a change over time. Each number will be evenly distributed over the duration of the effect specified by the beats parameter. An optional start parameter specifies how long to wait (in beats) before starting the effect.