Hi Prent, Thank you for the help and for the example. I am using csound-4.23f13gbs.0 from sourceforge. I was able to get looping to work, but not fully as documented. http://terrorpin.net/~ben/docs/alt/music/csound/work/csound-aifc.c.diff First, I had to patch csound4 to get it to correctly read my AIFC file. http://terrorpin.net/~ben/docs/alt/music/csound/work/aif.aifc Here is an example AIFC file. About the first 300 samples make an A440 pitch, and the rest make a higher pitch. The sustain loop is from sample 100 to 200. The release loop is from sample 400 to 450. It's not clean, but it is just an example. http://terrorpin.net/~ben/docs/alt/music/csound/work/foo.csd This is an example score that plays a note held, and then turned off 1 second later, and ends the song after 10 seconds. The note does sustain at A440 for 1 second, but it abruptly cuts off at turnoff instead of following through the release. "If sampling reaches the sustain loop endpoint and looping is in effect, the point of sampling will be modified and loscil will continue reading from within that loop segment. Once the instrument has received a turnoff signal (from the score or from a MIDI noteoff event), the next sustain endpoint encountered will be ignored and sampling will continue towards the release loop end-point, or towards the last sample (henceforth to zeros)." -- The Manual Do you know if I am correctly signalling turnoff? Thank you, Ben On Fri, Apr 21, 2006 at 08:06:20AM -0700, Prent Rodgers wrote: > Ben, > > oscilloscope looping doesn't always do what you think it should. I use > it extensively in my Csound work and have learned to avoid the quirks. > If you want to use looping, the format has to be .aif, not .wav. I use a > program called Awave Studio to correct the loop points, which are > notoriously tough to get right. http://www.fmjsoft.com/awavestudio.html > has it for sale. > > For each sample I use, I need to keep track of if it has a loop or not, > and if it is stereo or mono. I store that info in variables iwavchan and > iloop in this fragment. kcps2 is the frequency adjusted to the nearest > cent, ifno is the sample function table, ibascps is the base frequency > of the sample as recorded. > > > ; calculate the frequency, the right sample to use, and other factors > first > ; Four choices: Mono looping, stereo looping, mono no-loop, stereo > no-loop > if iwavchan = 4 goto akaimono > if iloop = 0 goto noloops > ; Stereo with loop > a3,a4 loscil 1, kcps2, ifno, ibascps; stereo sample with looping > goto skipstereo > noloops: > ; Stereo without looping > a3,a4 loscil 1, kcps2, ifno, ibascps,0,1,2 ; stereo sample without > looping - note that 1,2 is bogus workaround > goto skipstereo > akaimono: > if iloop = 0 goto noloopm > ; Mono with looping > a3 loscil 1, kcps2, ifno, ibascps ; mono sampling with loop > a4 = a3 > goto skipstereo > noloopm: > ; Mono without looping > a3 loscil 1, kcps2, ifno, ibascps,0,1,2 ; mono AIFF sample without loop > a4 = a3 > > skipstereo: > ; apply the envelope