;;; The CsoundSynthesizer tag initializes the file format.
;;; Performance-time options, suppressing graphics and messaging,
;;; and selecting your machine's default device for audio output.
-d -m0 -g -f -odac
;;; Select these non-realtime options for a nice floating-point WAV file.
;;; -d -m0 -g -f -oSimple.wav
;;; Now we define an instrument. First we declare some global
;;; globals in a header. Csound provides default values for this
;;; section, the numbers here suit my hardware.
sr = 48000
ksmps = 64
nchnls = 2
instr 1 ; Each instrument has a number.
kamp = p4 ; Assign the value found in the score's fourth parameter field to a variable called kamp.
kfreq = p5 ; Assign the value found in the score's fifth p-field to a variable called kfreq.
ifn = p6 ; Assign the value found in the score's sixth p-field to a variable called ifn.
kenv linseg 0,p3*.50,1,p3*.50,0 ; Create a simple "rise and fall" envelope function with the linseg opcode.
asig oscil kamp*kenv,kfreq,ifn ; Assign the values for kamp (scaled by kenv), kfreq, and ifn to the opcode's
; slots for amplitude, frequency, and function table. Name the output asig.
outs asig, asig-1 ; Send the asig and asig-1 values to the stereo output channels.
endin ; This instrument definition is ended.
;;; The score section provides values to the instrument on a per-event basis.
;;; In this simple score we have one function table and one note-event.
f1 0 8192 10 1 ; A Csound stored function table, GEN10, for a sine wave with 8192 points and a single harmonic.
i1 0 5 10000 440 1 ; Instructions for instrument 1. Starting at delta time 0, for five seconds play a moderately
; loud note with a frequency of 440 Hz and the waveform stored in function table f1.
e ; End score.