/************************************************************************************/
/* this is an example used for streaming soundfiles from disk
*/
/* Here you can control the loop through a boolean flag
*/
/*
*/
/************************************************************************************/
DiskIn.ar(soundFile, loopFlag, startFrame, numFrames)
soundFile - the SoundFile to read.
loopFlag - a Boolean value. If true, then the file is looped.
startFrame - the sample frame at which to start playback if the sound
file has not
been preloaded.The default value is zero.
numFrames - the number of frames in the double buffer if the sound
file has not
been preloaded.The default value is 32768.
(
var myFile, loopFlag;
var filename; // must include directory
loopFlag = true;
filename = ":Sounds:floating_1";
// this is boilerplate stuff
myFile = SoundFile.new;
myFile.readHeader(filename);
myFile.preloadData; // for instant play back (loads into ram)
Synth.scope({ DiskIn.ar(myFile, loopFlag) }, 0.5);
)
/************************************************************************************/
/*
this is an example used for recording to a file
*/
/* This is easier to use than the DiskOut streaming function,
so use it!
*/
/*
*/
/************************************************************************************/
(
var fileName = ":Sounds:testOne";
var duration = 10, freq, amp;
Synth.record({
freq = 800;
amp = 0.25;
SinOsc.ar(freq, amp)},
duration, fileName, 'AIFF', '16 big endian signed');
)