Debian Codegraph @

examples/lpreson.csd

raw
1 <CsoundSynthesizer>
2 <CsOptions>
3 ; Select audio/midi flags here according to platform
4 -odac --limiter=0.95 ;;;realtime audio out, limit loud pops
5 ;-iadc ;;;uncomment -iadc if realtime audio input is needed too
6 ; For Non-realtime ouput leave only the line below:
7 ; -o lpreson.wav -W ;;; for file output any platform
8 </CsOptions>
9 <CsInstruments>
10
11 sr = 44100
12 ksmps = 32
13 nchnls = 2
14 0dbfs = 1
15
16 ; by Menno Knevel - 2021
17
18 ires1 system_i 1,{{ lpanal -a -p40 -h200 -P50 -Q15000 -v1 fox.wav fox_poles.lpc }} ; pole filter file
19 ires2 system_i 1,{{ lpanal -p40 -h200 -P50 -Q15000 -v1 fox.wav fox_coeff.lpc }} ; filter coefficient file
20
21 instr 1
22
23 ilen filelen "fox.wav" ; length of soundfile
24 prints "fox.wav = %f seconds\\n",ilen
25
26 ktime line 0, p3, p4
27 krmsr,krmso,kerr,kcps lpread ktime,"fox_poles.lpc"
28 krmso *= .000007 ; scale amplitude
29 asig buzz krmso, kcps, int(sr/2/kcps), 1 ; max harmonics without aliasing
30 aout lpreson asig ; Pole file not supported!!
31 outs aout, aout
32 endin
33
34 instr 2
35
36 aref diskin "fox.wav", 1 ; don't play this, but use this as an amplitude reference
37 ktime line 0, p3, p4
38 krmsr,krmso,kerr,kcps lpread ktime,"fox_coeff.lpc"
39 krmso *= .000007 ; scale amplitude
40 asig buzz krmso, kcps, int(sr/2/kcps), 1 ; max harmonics without aliasing
41 aout lpreson asig ; Pole file not supported!!
42 abal balance2 aout, aref ; use amplitude of diskin as reference
43 outs abal, abal
44 endin
45
46 </CsInstruments>
47 <CsScore>
48 ; sine
49 f1 0 4096 10 1
50 s
51 ; dur
52 i 1 0 2.8 1 ; first words of fox_poles.lpc
53 i 1 4 2.8 2.756 ; whole sentence
54 s
55 i 2 0 2.8 1 ; first words of fox_coeff.lpc
56 i 2 4 2.8 2.756 ; whole sentence
57
58 e
59 </CsScore>
60 </CsoundSynthesizer>