// SinOsc.ar(freq, phase, mul, add) //*record(ugenGraphFunc, duration, pathName, headerFormat, sampleFormat) ( var fileName = ":Sounds:test"; var duration = 20, freq, amp; Synth.record({ freq = MouseX.kr(50.0, 20000.0, 'exponential', 0.5); amp = 0.025; SinOsc.ar(freq, amp)}, duration, fileName, 'AIFF', '16 big endian signed'); ) /**********************************************************************/ Hi Larry, Here's some little filters that work on sampled files and at the end is a mixer for sampled files: ---------------------- /***********filter input from CD with mouse, doesn't write to disk though ************/ /********This works *********/ ( // filter the input Synth.scope({ var rQ; rQ = MouseY.kr(0.01, 1, 'exponential'); // bandwidth ratio = 1/Q RLPF.ar( AudioIn.ar([1,2], 0.4 * rQ.sqrt), // attenuate to offset resonance MouseX.kr(100, 12000, 'exponential'), // mouse x controls cutoff freq rQ ) })) /**********************************************************************/ /************** to read a snd file from disk and write back to disk with new name **************/ /*************** while filtering with the mouse ************************************/ /************* This works with that ending bug ***********************************/ ( var fileName = ":Sounds:test2"; var file; file = SoundFile.new; if ( file.readHeader(":Sounds:test1") // read the file's header and: { file.preloadData; }, // preload the data { Synth.record({ var rQ; rQ = MouseY.kr(0.01, 1, 'exponential'); // bandwidth ratio = 1/Q RLPF.ar( DiskIn.ar(file, false), MouseX.kr(100, 12000, 'exponential'), // mouse x controls cutoff freq rQ, 0.25) }, 40.0, fileName, 'AIFF', '16 big endian signed'); }) ) /**********************************************************************/ /**************To filter white noise with mouse ********************/ ( // filter the input Synth.scope({ var rQ; rQ = MouseY.kr(0.01, 1, 'exponential'); // bandwidth ratio = 1/Q RLPF.ar( WhiteNoise.ar(0.25), // attenuate to offset resonance MouseX.kr(100, 12000, 'exponential'), // mouse x controls cutoff freq rQ ) })) /****************************************************************************/ /**** BPF 2nd order Butterworth bandpass filter *****/ /****** BPF.ar(in, kfreq, krq, mul, add) ********/ /****** A second order low pass filter. *************/ /*********** in - input signal to be processed **********/ /********** kfreq - cutoff frequency in Hertz. *********/ /*********** krq - the reciprocal of Q. bandwidth / cutoffFreq. ***********/ ( var fileName = ":Sounds:test3"; // write out to file test3, read from file test var file; file = SoundFile.new; if ( file.readHeader(":Sounds:test") // read the file's header and: { file.preloadData; }, // preload the data { Synth.record({ BPF.ar( DiskIn.ar(file, false), 50, 1.0, 2.5) //boosting 30Hz to 100 Hz }, 40.0, fileName, 'AIFF', '16 big endian signed'); }) ) /**************************************************************************/ /**************** Band Reject filter with white noise, this works ************************************/ /********* BRF.ar(in, freq, rq, mul, add) 2nd order Butterworth band reject filter ********/ /********* A second order low pass filter. ************/ /******** in - input signal to be processed ************/ /******** freq - cutoff frequency in Hertz. ************/ /******** rq - the reciprocal of Q. bandwidth / cutoffFreq. ********/ {BRF.ar(WhiteNoise.ar(0.5),4000, 0.5) }.play; /**********************************************************************/ /************** to read a snd file from disk and write back to disk with new name **************/ /*************** while band-reject filtering 2kHz to 4 kHz ************************************/ /************* This works with that ending bug ***********************************/ ( var fileName = ":Sounds:test2"; // write out to file test2, read from file test var file; file = SoundFile.new; if ( file.readHeader(":Sounds:test") // read the file's header and: { file.preloadData; }, // preload the data { Synth.record({ BRF.ar( DiskIn.ar(file, false),5000, 1.11) //filtering from 1kHz -- 4.5kHz, for a big EFX try 3.3 in Q }, 40.0, fileName, 'AIFF', '16 big endian signed'); }); ) /**************************************************************/ /**********************************************************************/ /********Play files from disk, this works ****************/ ( var file; file = SoundFile.new; // create a SoundFile object if ( file.readHeader(":Sounds:test"), // read the file's header { // read was successful Synth.scope({ DiskIn.ar( file, // the sound file to play false // whether to obey the file's loop points. ) }, 0.5); }); ) /**********************************************************************/ /******************mixing files, this works ***************************/ ( var file2, file3; file2 = SoundFile.new; file3 = SoundFile.new; file2.readHeader(":Sounds:test2"); file3.readHeader(":Sounds:test3"); play({ s= (DiskIn.ar(file2,false))*0.05; t= (DiskIn.ar(file3,false))*1.5; Mix.ar ( [s,t]) }) ) /*********************************************************************/