1 title:: 02_Evaluating_code
2 summary:: Mark Polishook tutorial
3 categories:: Tutorials>Mark_Polishook_tutorial
4 related:: Tutorials/Mark_Polishook_tutorial/00_Introductory_tutorial
6 This document is OSX (SCapp) specific in key commands, though the principles extend to all platforms. See the helpfile link::Reference/KeyboardShortcuts:: for key commands in other editors.
8 section::Synthesizing sound
10 To run (evaluate) one line of code, such as
13 { SinOsc.ar([400, 401], 0, 0.1) * Saw.ar([11, 33], 1) * EnvGen.kr(Env.sine(10)) }.play
16 first make sure that the localhost server is booted. Then put the cursor anywhere on the line (shown above) and press <enter>. If you don't have an enter key, then you can use ctrl-Return, Ctrl-c, fn-Return( on Some Macs), or Shift-Return. The server will synthesize audio and text that looks something like
19 Synth("-613784702" : 1000)
22 will appear in the post window.
24 Press command-period (cmd-.) to stop synthesis.
26 ////////////////////////////////////////////////////////////////////////////////////////////////////
28 To run more than one line of code, select all the lines and press <enter>.
30 To help with the selection process, examples with more than one line often are placed in enclosing parentheses. In such cases, select the text by clicking immediately to the right of the top parenthesis or to the left of the bottom parenthesis. Or, with the cursor to the right of the top parenthesis or the left of the bottom one, press cmd-shift-b.
32 Then press enter (to run the example).
38 in: Saw.ar([100, 102], 0.15),
39 freq: Lag.kr(LFNoise0.kr(4, 700, 1100), 0.1),
46 The server will synthesize audio and text that looks something like
49 Synth("-393573063" : 1000)
52 will appear in the post window.
54 Press command-period (cmd-.) to stop synthesis.
56 section::Scoping sound
58 To scope whatever it is you're synthesizing (create a graphical display of the waveform):
61 ## make sure the internal server is running (press its boot button)
62 ## press the default button on the internal server window.
63 ## evaluate your code as described above.
68 { SinOsc.ar([400, 401], 0, 0.5) * Saw.ar([11, 33], 0.5) }.play
77 which will produce a window with the title of "stethoscope."
80 As a shortcut to steps 2 through 4, send the scope message directly to the example.
83 { SinOsc.ar([400, 401], 0, 0.5) * Saw.ar([11, 33], 0.5) }.scope(2)
86 Press cmd-. to stop sound synthesis.
88 section::Recording sound
90 The localhost and the internal server windows have buttons, on the far right, to activate recording. To record, choose the a default server. The button on the default server of your choice initially will say "record" Press it to start recording.
92 Run the following line of code to see where your sound file was saved...
95 thisProcess.platform.recordingsDir;
98 ////////////////////////////////////////////////////////////////////////////////////////////////////
100 go to link::Tutorials/Mark_Polishook_tutorial/03_Comments::