Here is the trick (but only ksmps=1) sr = 44100 ksmps = 1 nchnls = 1 0dbfs = 1 instr 1 aout rand 0.5 out aout endin t0 [44100*60] i1 0 12345 ; duration is 12345 samples e csound -d test.csd ... sndfile-info $SFDIR/test.wav |grep ^Frames Frames : 12345 The grid for the score time is ksmps. The result of the previous example with ksmps=64 is 12352 because 64 * 192 = 12288 < 12345 64 * 193 = 12352 = 12345 + 7 therefore the maximum error is (ksmps - 1) samples. tito On Sat, Jun 23, 2012 at 10:44:14AM -0400, Ralph Bluecoat wrote: > Hello again, > > I'm currently playing around with some low-level algorithms whose notes and > durations are based on sample rate and control rate. Is there a way in > Csound that I could write to an audio file and specify amount of samples I > want to write to disk? > > Thanks, > > Paul