# this is a four-beat metronome # for use in Exp.1 # Hugo Quené, hquene@indiana.edu, Nov 2001, May 2002 form Four-Beat Metronome comment This metronome generates a 4-beat pattern, with comment a low tone on the first beat and a high tone on the comment second beat. The third and fourth beat are unmarked. comment The rate (speed) refers to the whole `measure` cycle. positive Rate_(bpm) 43 positive Duration_(s) 180 endform # for debugging # rate = 28 cycletime = 60/'Rate' quartcycletime = 15/'Rate' tonetime = 0.040 pausetime = 'quartcycletime'-'tonetime' # for debugging # printline Cycle time is 'cycletime' # printline Half-cycle time is 'halfcycletime' # printline Pausetime per half-cycle is 'pausetime' Create Sound... Ltone 0 'tonetime' 44100 3/4 * sin(2*pi*400*x) Create Sound... Htone 0 'tonetime' 44100 1/4 * sin(2*pi*800*x) Create Sound... Notone 0 'tonetime' 44100 0 Create Sound... stil 0 'pausetime' 44100 0 select Sound Ltone plus Sound stil Concatenate Rename... part1 select Sound Htone plus Sound stil Concatenate Rename... part2 select Sound Notone plus Sound stil Concatenate Rename... part3 Copy... part4 select Sound part1 plus Sound part2 plus Sound part3 plus Sound part4 Concatenate chainid = selected("Sound") # prepare something special for last cycle Read from file... E:\Hugo\rhythm\mywhoosh.wav mywhooshid = selected("Sound") select 'chainid' cycles = floor( 'Duration'/'cycletime' ) # printline 'cycles' while cycles>1 Play cycles = cycles-1 endwhile # something special for last beep select 'mywhooshid' Play select 'chainid' plus Sound Ltone plus Sound Htone plus Sound Notone plus Sound stil plus Sound part1 plus Sound part2 plus Sound part3 plus Sound part4 plus Sound mywhoosh Remove