parameter (p) variables contain the score parameter values for each notecontain the score parameter...

16

Post on 20-Dec-2015

224 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Parameter (p) Variables contain the score parameter values for each notecontain the score parameter values for each note allow score to control orchestraallow
Page 2: Parameter (p) Variables contain the score parameter values for each notecontain the score parameter values for each note allow score to control orchestraallow

Parameter (p) VariablesParameter (p) VariablesParameter (p) VariablesParameter (p) Variables• contain the score parameter values for contain the score parameter values for

each note each note • allow score to control orchestra allow score to control orchestra

• p1p1 — always the instrument number — always the instrument number • p2p2 — always the start time — always the start time • p3p3 — always the duration — always the duration

• in some effects, such as in some effects, such as reverbreverb, lengthening , lengthening p3p3 allows the sound to die away before cutting it off allows the sound to die away before cutting it off

p3p3 == p3 + iring p3 + iring

• user defines the other parameter fields user defines the other parameter fields

Page 3: Parameter (p) Variables contain the score parameter values for each notecontain the score parameter values for each note allow score to control orchestraallow

LabelsLabelsLabelsLabels• signposts directing Csound to the right place signposts directing Csound to the right place

in the orchestra in the orchestra • NOT variables NOT variables • can start with any character - BUT can start with any character - BUT

• don't start labels with "p," "g," "i," "k" and "a" — don't start labels with "p," "g," "i," "k" and "a" — these reserved letters begin variable namesthese reserved letters begin variable names

• end with colon end with colon • may have their own line or may precede an may have their own line or may precede an

operation lineoperation line

label: result opcode argument1, argument2, ... label: result opcode argument1, argument2, ...

Page 4: Parameter (p) Variables contain the score parameter values for each notecontain the score parameter values for each note allow score to control orchestraallow

gotogoto Statements Statementsgotogoto Statements Statements

• tell the program to go to one of tell the program to go to one of the labelsthe labels

• usually in usually in ifif statements. statements.

if ifreq > 300 goto labelif ifreq > 300 goto label

Page 5: Parameter (p) Variables contain the score parameter values for each notecontain the score parameter values for each note allow score to control orchestraallow

The Function StatementThe Function StatementThe Function StatementThe Function Statement

• f1f1 — wavetable number 1 — wavetable number 1• the "1" used by oscili in sinewave.orc the "1" used by oscili in sinewave.orc

• 0 — load at time zero 0 — load at time zero • 16385 — load with 16385 points 16385 — load with 16385 points

• number of points in wavetable must be number of points in wavetable must be • a power of 2 a power of 2

• 512, 1024, 2048, 4096, 8192, 16384 512, 1024, 2048, 4096, 8192, 16384

OROR• (a power of 2) + 1 (a power of 2) + 1

• 513, 1025, 2049, 4097, 8193, 16385513, 1025, 2049, 4097, 8193, 16385

f1 0 16385 10 1 f1 0 16385 10 1

Page 6: Parameter (p) Variables contain the score parameter values for each notecontain the score parameter values for each note allow score to control orchestraallow

The Function StatementThe Function StatementThe Function StatementThe Function Statement

• a lower number of points = faster a lower number of points = faster wavetable loading (draft) wavetable loading (draft)

• a higher number of points = better a higher number of points = better sound quality (finished) sound quality (finished)

• 10 — fill the table with a (group of) 10 — fill the table with a (group of) harmonic harmonic [ii:18][ii:18] sine waves sine waves

f1 0 16385 10 1 f1 0 16385 10 1

Page 7: Parameter (p) Variables contain the score parameter values for each notecontain the score parameter values for each note allow score to control orchestraallow

The Function StatementThe Function StatementThe Function StatementThe Function Statement

• After the "10," each number indicates the After the "10," each number indicates the strength of that harmonic numberstrength of that harmonic number

• for example, the single number "1" indicates for example, the single number "1" indicates that this is a sine wave — only the first that this is a sine wave — only the first harmonic partial (fundamental)harmonic partial (fundamental)

Spectral Snapshotof Wavetable

No. 1

f1 0 16385 10 1 f1 0 16385 10 1

Page 8: Parameter (p) Variables contain the score parameter values for each notecontain the score parameter values for each note allow score to control orchestraallow

The Function StatementThe Function StatementThe Function StatementThe Function Statement

• oscilioscili statement takes values from statement takes values from this waveform this waveform

• for each tone, for each tone, oscilioscili repeats this repeats this waveform at frequency of the tone waveform at frequency of the tone • example: 440 times per second for A4example: 440 times per second for A4

Page 9: Parameter (p) Variables contain the score parameter values for each notecontain the score parameter values for each note allow score to control orchestraallow

Amplitude EnvelopeAmplitude EnvelopeAmplitude EnvelopeAmplitude Envelope• fades in and out as shown in figure fades in and out as shown in figure

• note statement setsnote statement sets• the attack time of each note to .1 seconds the attack time of each note to .1 seconds • the decay time to 1.4 seconds the decay time to 1.4 seconds

Page 10: Parameter (p) Variables contain the score parameter values for each notecontain the score parameter values for each note allow score to control orchestraallow

Review QuestionReview QuestionReview QuestionReview Question

• The line of code in the box is:The line of code in the box is:

A.A. a tempo statementa tempo statement

B.B. a note statementa note statement

C.C. the end of the score filethe end of the score file

D.D. a function statementa function statement

E.E. none of the abovenone of the above

f1 0 16385 10 10 9 8 7 6 5 4 3 2 1 f1 0 16385 10 10 9 8 7 6 5 4 3 2 1

Page 11: Parameter (p) Variables contain the score parameter values for each notecontain the score parameter values for each note allow score to control orchestraallow

A Global Frequency FactorA Global Frequency FactorA Global Frequency FactorA Global Frequency Factor; ; freqfactor.orcfreqfactor.orc ; name of orchestra; name of orchestrasr=22050sr=22050 ; sampling rate; sampling ratekr=2205kr=2205 ; control rate; control rateksmps=10ksmps=10 ; samples/control ; samples/control

per.per.nchnls=1nchnls=1 ; 1 channel playback; 1 channel playback;-----------------------------------------------------;-----------------------------------------------------gifreqgifreq == 22 ; make all notes octave higher; make all notes octave higher;-----------------------------------------------------;-----------------------------------------------------instr 1instr 1 ; sine wave or whatever; sine wave or whatever......ifreqifreq == p5 * p5 * gifreqgifreq......

outout asigasig ; output signal; output signalendinendin ; end of instrument; end of instrument

Page 12: Parameter (p) Variables contain the score parameter values for each notecontain the score parameter values for each note allow score to control orchestraallow

[ii:80][ii:80] A Global Frequency Factor A Global Frequency Factor[ii:80][ii:80] A Global Frequency Factor A Global Frequency Factor

; freqfactor.sco - use with freqfactor.orc; freqfactor.sco - use with freqfactor.orc

; waveform for oscillator - 10 sine waves; waveform for oscillator - 10 sine waves

f1 0 16385 10 10 9 8 7 6 5 4 3 2 1f1 0 16385 10 10 9 8 7 6 5 4 3 2 1

;p1;p1 p2p2 p3p3 p4p4 p5p5 p6p6 p7p7

;; stst durdur ampamp freqfreq attckattck decdec

i1i1 11 11 50005000 440440 .1.1 .7.7

endend

Page 13: Parameter (p) Variables contain the score parameter values for each notecontain the score parameter values for each note allow score to control orchestraallow

Function StatementFunction StatementFunction StatementFunction Statement• defines the wavetabledefines the wavetable

f1 0 16385 10 10 9 8 7 6 5 4 3 2 1 f1 0 16385 10 10 9 8 7 6 5 4 3 2 1

• f1f1 - wavetable number 1 (the "1" used - wavetable number 1 (the "1" used by by oscilioscili in in sinewave.orcsinewave.orc) )

• 0 - load the wavetable at time 0 0 - load the wavetable at time 0 • 16385 - load the wavetable with 16385 16385 - load the wavetable with 16385

points points

Page 14: Parameter (p) Variables contain the score parameter values for each notecontain the score parameter values for each note allow score to control orchestraallow

Function StatementFunction StatementFunction StatementFunction Statement

• gen 10 - each number indicates the gen 10 - each number indicates the strength of that harmonic number strength of that harmonic number • wavetable wavetable f1f1 uses the first 10 harmonics uses the first 10 harmonics • the harmonics are in consecutive order the harmonics are in consecutive order

• the first harmonic has a strength of 10 the first harmonic has a strength of 10 • the second harmonic has a strength of 9 the second harmonic has a strength of 9

• normalization normalization • all the harmonics are normalized so that the all the harmonics are normalized so that the

peak amplitude of the waveform is 1 peak amplitude of the waveform is 1 • Use -10 instead of 10 to skip normalizationUse -10 instead of 10 to skip normalization

f1 0 16385 10 10 9 8 7 6 5 4 3 2 1 f1 0 16385 10 10 9 8 7 6 5 4 3 2 1

Page 15: Parameter (p) Variables contain the score parameter values for each notecontain the score parameter values for each note allow score to control orchestraallow

Amplitude (p4)Amplitude (p4)Amplitude (p4)Amplitude (p4)• relative amplitudes of 10 harmonics in relative amplitudes of 10 harmonics in

function tablefunction table

f1 0 16385 10 10 9 8 7 6 5 4 3 2 1 f1 0 16385 10 10 9 8 7 6 5 4 3 2 1

Page 16: Parameter (p) Variables contain the score parameter values for each notecontain the score parameter values for each note allow score to control orchestraallow

Review QuestionReview QuestionReview QuestionReview Question• Which function statement can represent the Which function statement can represent the

spectrum shown in the figure:spectrum shown in the figure:

A.A. f1 0 16385 10 1 2 3 4 5 6 7 8 9 10f1 0 16385 10 1 2 3 4 5 6 7 8 9 10

B.B. f1 0 16385 10 10 9 8 7 6 5 4 3 2 1f1 0 16385 10 10 9 8 7 6 5 4 3 2 1

C.C. f1 0 16385 10 1 1 1 1 1 1 1 1 1 1f1 0 16385 10 1 1 1 1 1 1 1 1 1 1

D.D. f1 0 16385 10 1 0 1 0 1 0 1 0 1 0f1 0 16385 10 1 0 1 0 1 0 1 0 1 0

E.E. none of the abovenone of the above