Debian Codegraph @

src/Examples/FLOSS Manual Examples/01 Basics/01A01_Aliasing.csd

raw
1 <CsoundSynthesizer>
2 <CsOptions>
3 -odac
4 </CsOptions>
5 <CsInstruments>
6 sr = 44100
7 ksmps = 32
8 nchnls = 2
9 0dbfs = 1
10
11 //wave form with harmonics 1, 11 and 22
12 giHarmonics ftgen 0, 0, 8192, 9, 1,.1,0, 11,.1,0, 22,1,0
13
14 instr 1
15 asig poscil .1, p4
16 out asig, asig
17 endin
18
19 instr 2
20 asig poscil .2, p4, giHarmonics
21 out asig, asig
22 endin
23
24 </CsInstruments>
25 <CsScore>
26 i 1 0 2 1000 ;1000 Hz sine
27 i 1 3 2 43100 ;43100 Hz sine sounds like 1000 Hz because of aliasing
28 i 2 6 4 1990 ;1990 Hz with harmonics 1, 11 and 22
29 ;results in 1990*22=43780 Hz so aliased 320 Hz
30 ;for the highest harmonic
31 </CsScore>
32 </CsoundSynthesizer>
33 ;example by joachim heintz