/*Getting started.. 1.3 Basic Elements: Opcodes
The fundamental building blocks of a Csound instrument is the opcode.
Each opcode can be seen as little program itself, that does a specific task. Opcodes get a bold-blue highlighting in the CsoundQt editor. In this example 'line', 'expon', 'oscil', 'outvalue' and 'outs', are the opcodes used.
The names of opcodes are usually a short form of their functionality.
'line' - generates a linear changing value between specified points
'expon' - generates a exponential curve between two points
'oscil' - is a tone generator (an oscillator)
'outvalue' - sends a value to a user defined channel, in this case to the widget display
'outs' - writes stereo audio data to an external audio device
It is important to remember that opcodes receive their input arguments on the right and output their results on the left, like this:
output Opcode input1, input2
*/
sr = 44100
ksmps = 128
nchnls = 2
0dbfs = 1
instr 1
kFreq line 100, 5, 1000 ; 'line' generates a linear ramp, from 100-1000 Hz, taking 5 seconds
aOut oscili 0.2, kFreq, 1 ; an oscillator whose frequency is taken from the value produced by 'line'
outvalue "freqsweep", kFreq ; show the value from 'line' in a widget
outs aOut, aOut ; send the oscillator's audio to the audio output
endin
instr 2
kFreq expon 100, 5, 1000 ; the 'expon' exponential curve is more useful when working with frequencies
aOut oscili 0.2, kFreq, 1
outvalue "freqsweep", kFreq
outs aOut, aOut
endin
f 1 0 1024 10 1 ; the basic sine waveform for the oscillator is generated here
i 1 0 5
i 2 5 5 ; the exponential curve goes more even thought the octaves
e
; written by Alex Hofmann (Nov. 2009) - Incontri HMT-Hannover
1013279563397true16015816221724871{8a703a13-1bbf-4338-8e0a-993e086a405e}true0-3lefttop
Noto Sans
143000255255255false10freqsweep1083714429{30e5e14c-4c4b-46a1-8584-d8d488ec61e9}true0-3centercenter
Sans Serif
1630001821090true1122365255150{3e0a7775-89a7-4f52-85ea-52e3ff2348b1}true0-3-255.00000000scope2.000000001.000000001.000000001.000000000.00000000NoTrigger2231325453{f47b80f1-e5e6-4020-9065-17df4bb3ed44}true0-3lefttop
Noto Sans
143000255255255false1020180251109{17cbc48e-c1f3-4cae-aabc-d738a68aa532}true0-301.000000001.000000001.000000001.00000000autoautotruetruetruetruetruetruetrue2110525169{9e3bc813-428f-4648-b9cd-5084a7fbe634}true0-3lefttop
Noto Sans
143000255255255false10