// Set up // Use internal server s = Server.internal; ( // Make sure the server is running if(s.serverRunning, { "The server is already running.".postln; }, // post informative message { s.boot; } // otherwise go ahead and start it up ) ) // Example 3.1 SynthDef("ex3", { Out.ar(0, SinOsc.ar(440, 0, 0.4, 0) ) }).send(s); Synth("ex3", target: s); // Play it s.scope; // Look at it // Press command-. to stop it // Linux: C-c C-s or Stop Main from SCLang menu. // Example 3.2 // LFSaw is a low frequency sawtooth oscillator, in SC3 LFSaw also accepts an // argument for initial phase. Using the function notation is a quick way to test // things. { LFSaw.ar(60, 0, 0.3) }.scope; // Linux: The .scope is not yet supported, replace here with .play // Examples 3.3-3.8 can be done just like the last one. // Example 3.9 /** The SinOsc is where the actual audio frequency is generated. The frequency for SinOsc is determined by the LFNoise and LFSaw. They are linked in a rather complicated way. It would be easy to enter values that would result in negative output (not appropriate for frequency), so they both are wrapped in an abs() function to protect against this. You can experiment at will but the range of sweep should be greater than the range of overall wandering. That entire section is plugged into a Comb filter. The max delay should always be greater than the actual delay. The decay time is how long the echo resonates. Have fun. */ ( // Now create a SynthDef and send it to the server SynthDef("ch3.9", { Out.ar(0, // Send to output bus 0 CombN.ar( // An echo UGen SinOsc.ar( // Sine wave oscillator abs( // Protect against negative values for frequency argument LFNoise1.kr( 0.4, // frequency overall wandering 800, // range of overall wandering LFSaw.kr( [3.5, 3.51], // expands to a left channel and right channel // of the individual sweeps 300, // width of sweep 1200 // range of sweep ) ) ), 0, // phase 0.2 // amplitude, stay below 0.2 ), 0.6, // max delay 0.27, // actual delay, should always be < max delay 4 // decay time ) ) }).send(s); ) // Create a Synth to play it on the internal server a = Synth("ch3.9", target: s); // Look at it s.scope; // Free the synth a.free; // Create a similiar SynthDef to the one above, but this one accepts // arguments ( SynthDef("ch3.9-args", { arg wander=800, sweep=1200, decay=4; Out.ar(0, // Send to output bus 0 CombN.ar( // An echo UGen SinOsc.ar( // Sine wave oscillator abs( // Protect against negative values for frequency argument LFNoise1.kr( 0.4, // frequency overall wandering wander, // range of overall wandering LFSaw.kr( [3.5, 3.51], // expands to a left channel and right channel // of the individual sweeps 300, // width of sweep sweep // range of sweep ) ) ), 0, // phase 0.2 // amplitude, stay below 0.2 ), 0.6, // max delay 0.27, // actual delay, should always be < max delay decay // decay time ) ) }).send(s); ) // Play the synth, this is exactly the same as the first Synth we played // It uses the default values of 800, 1200 and 4 provided in the SynthDef a = Synth("ch3.9-args", target: s); s.scope; a.free; // Lets specify different values to the Synth now a = Synth("ch3.9-args", [\wander, 281, \sweep, 401, \decay, 7], target: s); s.scope; a.free; */* authors so far: */ |