Back to main page
Back to sound contents
All three available sound objects (wave, note and sample) accept an arbitrary number of arguments; these extra arguments represent points in time where the sound will be repeated, which can be used to force echoes. By default, echoes are repeated always at the same volume, but sound option attenuation_coef (which defaults to list [1]) can be used to control their loudness.
Since we want to play the sound and draw the waveform everytime we call the play function, we set some sound options defaults to avoid rewriting them.
set_sound_defaults( player = "mplayer", draw_wave = true, draw_wave_options = [terminal = png, pic_height = 200, pic_width = 800] )$
Tone A is repeated twice at one half the original loudness.
play( envelope = adsr(0.01, 0.1, 0.8, 0.4), attenuation_coef = [1,1/2], note(440,1000,0.5,0,0.6,1.2)) $
Tone A is repeated twice, the first time at one half the original loudness, and the second time at one third. Note the list assigned to sound option attenuation_coef.
play( envelope = adsr(0.01, 0.1, 0.8, 0.4), attenuation_coef = [1,1/2,1/3], note(440,1000,0.5,0,0.6,1.2)) $
Back to main page
Back to sound contents