introduction to csound 2

14

Upload: frances-gonzalez

Post on 01-Jan-2016

32 views

Category:

Documents


1 download

DESCRIPTION

Introduction to Csound 2. The Csound Score. a group of function tables and list of note statements combining score with orchestra creates a soundfile Csound sorts notes by start time so they can appear in the list in any order naming convention: .sco file contains Csound score. - PowerPoint PPT Presentation

TRANSCRIPT

Page 1: Introduction to Csound 2
Page 2: Introduction to Csound 2

The Csound ScoreThe Csound ScoreThe Csound ScoreThe Csound Score• a group of function tables and list of a group of function tables and list of

note statements note statements • combining score with orchestra creates a combining score with orchestra creates a

soundfilesoundfile

• Csound sorts notes by start time so they Csound sorts notes by start time so they can appear in the list in any order can appear in the list in any order

• naming convention: naming convention: .sco.sco file contains file contains Csound score Csound score

Page 3: Introduction to Csound 2

A Simple ScoreA Simple ScoreA Simple ScoreA Simple Score

; sinewave.sco - use with sinewave.orc; sinewave.sco - use with sinewave.orc

; waveform for oscillator - a sine wave; waveform for oscillator - a sine wave

f1 0 16385 10 1f1 0 16385 10 1

;p1;p1 p2p2 p3p3 p4p4 p5p5 p6p6 p7 p7

;; stst durdur ampamp freqfreq attckattck decaydecay

i1i1 11 22 40004000 440440 .1.1 1.41.4

endend

Page 4: Introduction to Csound 2

The Note StatementThe Note StatementThe Note StatementThe Note Statement

• scores specify parameter values for each scores specify parameter values for each note such asnote such as• amplitudesamplitudes• frequenciesfrequencies• attackattack• decay times decay times

;p1;p1 p2p2 p3p3 p4p4 p5p5 p6p6 p7 p7

;; stst durdur ampamp freqfreq attckattck decaydecay

i1i1 11 22 40004000 440440 .1.1 1.41.4

endend

Page 5: Introduction to Csound 2

The Note StatementThe Note StatementThe Note StatementThe Note Statement

• ““i” indicates note statementi” indicates note statement• p1 always contains the instrument numberp1 always contains the instrument number

• instrument number 1 should play the note instrument number 1 should play the note • p2 always contains the note start timep2 always contains the note start time

• in beats per minute in beats per minute • p3 always contains the note durationp3 always contains the note duration

• in beats per minute in beats per minute

;p1;p1 p2p2 p3p3 p4p4 p5p5 p6p6 p7 p7

;; stst durdur ampamp freqfreq attckattck decaydecay

i1i1 11 22 40004000 440440 .1.1 1.41.4

Page 6: Introduction to Csound 2

The Note StatementThe Note StatementThe Note StatementThe Note Statement

• in this example in this example • p4 contains the maximum amplitude p4 contains the maximum amplitude • p5 contains the frequency of the note in Hertz p5 contains the frequency of the note in Hertz • p6 contains the attack duration in seconds p6 contains the attack duration in seconds • p7 contains the decay duration in seconds p7 contains the decay duration in seconds

;p1;p1 p2p2 p3p3 p4p4 p5p5 p6p6 p7 p7

;; stst durdur ampamp freqfreq attckattck decaydecay

i1i1 11 22 40004000 440440 .1.1 1.41.4

Page 7: Introduction to Csound 2

The Note StatementThe Note StatementThe Note StatementThe Note Statement

• endend indicates the end of the note list indicates the end of the note list • Csound ignores any events following itCsound ignores any events following it• ““e” is shortcut for “end”e” is shortcut for “end”

;p1;p1 p2p2 p3p3 p4p4 p5p5 p6p6 p7 p7

;; stst durdur ampamp freqfreq attckattck decaydecay

i1i1 11 22 40004000 440440 .1.1 1.41.4

endend

Page 8: Introduction to Csound 2

Amplitude (p4)Amplitude (p4)Amplitude (p4)Amplitude (p4)• spectrum of additive synthesis group (10 spectrum of additive synthesis group (10

harmonics)harmonics)

Page 9: Introduction to Csound 2

[i:46][i:46] Additive Synthesis Score Additive Synthesis Score[i:46][i:46] Additive Synthesis Score Additive Synthesis Score

;; p2p2 p3p3 p4p4 p5p5 p6p6 p7p7

;; stst durdur ampamp harmharm attkattk decdec

i1i1 11 55 24002400 11 .25.25 .05 .05

i1i1 .. 4.54.5 900900 22 .28.28 .048 .048

i1i1 .. 44 600600 33 .03.03 .047 .047

i1i1 .. 3.53.5 10001000 44 .031.031 .044 .044

i1i1 .. 3.253.25 180180 55 .032.032 .043 .043

i1i1 .. 3.13.1 400400 66 .033.033 .039 .039

i1i1 .. 2.852.85 250250 77 .034.034 .035 .035

i1i1 .. 2.552.55 9090 88 .035.035 .031 .031

i1i1 .. 2.172.17 9090 99 .036.036 .028 .028

i1i1 .. 2.12.1 5555 1010 .037.037 .025 .025

Page 10: Introduction to Csound 2

The Csound ScoreThe Csound ScoreThe Csound ScoreThe Csound Score• the dots in p2 are a shortcut that allows the dots in p2 are a shortcut that allows

Csound to re-use the previous value in Csound to re-use the previous value in those p-fields those p-fields

• in this score, all the notes in this score, all the notes • begin at the same time (st=1)begin at the same time (st=1)• blend together to create a single sound blend together to create a single sound • have varying durations so the sound have varying durations so the sound

changeschanges

Page 11: Introduction to Csound 2

Amplitude (p4)Amplitude (p4)Amplitude (p4)Amplitude (p4)

• this score sets the amplitude of the this score sets the amplitude of the first partial to 2400 first partial to 2400

• total amplitude of all partials is 5965total amplitude of all partials is 5965

Page 12: Introduction to Csound 2

Amplitude (p4)Amplitude (p4)Amplitude (p4)Amplitude (p4)• Since Csound uses 16-bit integer samples, Since Csound uses 16-bit integer samples,

the largest amplitude possible without the largest amplitude possible without distortion is 32,767 distortion is 32,767

• two simultaneous notes, each with an two simultaneous notes, each with an amplitude of 4,000 can produce a combined amplitude of 4,000 can produce a combined amplitude of 8,000 if their peak amplitudes amplitude of 8,000 if their peak amplitudes are together are together

• scores — such as this one — with several scores — such as this one — with several simultaneous notes may require scaling simultaneous notes may require scaling down their amplitudes down their amplitudes

Page 13: Introduction to Csound 2

Avoiding OverflowAvoiding OverflowAvoiding OverflowAvoiding Overflow

end of score.end of score. overall amps:overall amps: 35003.635003.6

overall samples out of range:overall samples out of range: 00

• Run Csound. The maximum amplitude of the output is:Run Csound. The maximum amplitude of the output is:

out asig * .9out asig * .9

• To avoid overflow, in the orchestra scale the To avoid overflow, in the orchestra scale the output:output:

• Run Csound againRun Csound again• check that the maximum amplitude is less than 32767:check that the maximum amplitude is less than 32767:

end of score.end of score. overall amps:overall amps: 31503.231503.2

32767/35003.6 = .93632767/35003.6 = .936

Page 14: Introduction to Csound 2

Amplitude (p4)Amplitude (p4)Amplitude (p4)Amplitude (p4)

• A significant noticeable increase in loudness level A significant noticeable increase in loudness level (e.g., from (e.g., from mfmf to to ff) roughly corresponds to increase ) roughly corresponds to increase by an amplitude factor of 1.5 by an amplitude factor of 1.5 • example, a note with amplitude of 6,000 will be about example, a note with amplitude of 6,000 will be about

one dynamic level louder than a note with amplitude of one dynamic level louder than a note with amplitude of 4,0004,000