Sample Linker Jacob Joaquin June 17, 2010 jacobjoaquin@gmail.com csoundblog.com Instructions To run, you need to download the BT sample packet (see below.) These are licensed under Creative Commons, and are part of the OLPC Sample Library. Run this csd in the same folder as the samples. BT (aka Brian Transeau) http://www.btmusic.com/ BT sample pack http://www.archive.org/download/BT/BT44.zip One Laptop Per Child music library http://wiki.laptop.org/go/Sound_samples Creative Commons Attribution 3.0 Unported http://creativecommons.org/licenses/by/3.0/ sr = 44100 kr = 44100 ksmps = 1 nchnls = 2 0dbfs = 1 # define Sample # 1 # # define Play # 2 # # define PlayMono # 3 # # define KeepRunning # 4 # chn_k "acc", 3 ; Time accumulator chnset 0, "acc" instr $Sample S_sample = p4 ; Name of file prints S_sample iacc chnget "acc" ; Get current value of time accumulator ilength filelen S_sample ; Length of file ; Mono or stereo ichannels filenchnls S_sample iplay = $PlayMono if ichannels == 2 then iplay = $Play endif ; Generate new event iplayed init 0 if iplayed == 0 then iplayed = 1 S_event sprintfk {{i %i %f %f "%s"}}, iplay, iacc, ilength, S_sample scoreline S_event, 1 ; Add file length to accumulator chnset iacc + ilength, "acc" printks "Accumulator: %f\n", 1, iacc + ilength endif turnoff endin instr $Play S_sample = p4 ; Name of file a1, a2 diskin2 S_sample, 1 outs a1, a2 endin instr $PlayMono S_sample = p4 ; Name of file a1 diskin2 S_sample, 1 outs a1, a1 endin instr $KeepRunning ; This keeps the score running. If at any point an event is ; not playing, Csound will quit, even if there are still ; events in the event queue. p3 chnget "acc" endin # define Sample # 1 # # define Play # 2 # # define PlayMono # 3 # # define KeepRunning # 4 # i $Sample 0 1 "120 Scratchim.wav" i $Sample 0 1 "120 KarmaTonic.wav" i $Sample 0 1 "120 Fast Satellite.wav" i $Sample 0 1 "120 KarmaTonic.wav" i $Sample 0 1 "120 Fast Satellite.wav" i $Sample 0 1 "120 Scratchim.wav" i $Sample 0 1 "120 Drive the Bouncer.wav" i $Sample 0 1 "120 Drive the Bouncer.wav" i $KeepRunning [1 / 44100] 1 ; Start at sample 1