summaryrefslogtreecommitdiff
path: root/examples-xml/pitchamdf.csd.xml
blob: dc7e26bc7f94c928ca39c52ce1d98bfb820a1d74 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
<programlisting>
<emphasis role="csdtag">&lt;CsoundSynthesizer&gt;</emphasis>
<emphasis role="csdtag">&lt;CsOptions&gt;</emphasis>
<emphasis role="comment">; Select audio/midi flags here according to platform</emphasis>
<emphasis role="comment">; Audio out   Audio in    No messages</emphasis>
-odac           -iadc     -d     <emphasis role="comment">;;;RT audio I/O</emphasis>
<emphasis role="comment">; For Non-realtime ouput leave only the line below:</emphasis>
<emphasis role="comment">; -o pitchamdf.wav -W ;;; for file output any platform</emphasis>
<emphasis role="csdtag">&lt;/CsOptions&gt;</emphasis>
<emphasis role="csdtag">&lt;CsInstruments&gt;</emphasis>

<emphasis role="comment">; Initialize the global variables.</emphasis>
<emphasis role="ohdr">sr</emphasis> <emphasis role="op">=</emphasis> 44100
<emphasis role="ohdr">kr</emphasis> <emphasis role="op">=</emphasis> 4410
<emphasis role="ohdr">ksmps</emphasis> <emphasis role="op">=</emphasis> 10
<emphasis role="ohdr">nchnls</emphasis> <emphasis role="op">=</emphasis> 1

<emphasis role="comment">; synth waveform</emphasis>
giwave <emphasis role="ohdr">ftgen</emphasis> 2, 0, 1024, 10, 1, 1, 1, 1

<emphasis role="comment">; Instrument #1 - play an audio file with no effects.</emphasis>
<emphasis role="oblock">instr</emphasis> 1
  <emphasis role="comment">; get input signal with original freq.</emphasis>
  asig <emphasis role="opc">soundin</emphasis> "mary.wav"

  <emphasis role="opc">out</emphasis> asig
<emphasis role="oblock">endin</emphasis>

<emphasis role="comment">; Instrument #2 - play the synth waveform using the</emphasis>
<emphasis role="comment">; same pitch and amplitude as the audio file.</emphasis>
<emphasis role="oblock">instr</emphasis> 2
  <emphasis role="comment">; get input signal with original freq.</emphasis>
  asig <emphasis role="opc">soundin</emphasis> "mary.wav"

  <emphasis role="comment">; lowpass-filter</emphasis>
  asig <emphasis role="opc">tone</emphasis> asig, 1000
  <emphasis role="comment">; extract pitch and envelope</emphasis>
  kcps, krms <emphasis role="opc">pitchamdf</emphasis> asig, 150, 500, 200
  <emphasis role="comment">; "re-synthesize" with the synth waveform, giwave.</emphasis>
  asig1 <emphasis role="opc">oscil</emphasis> krms, kcps, giwave

  <emphasis role="opc">out</emphasis> asig1
<emphasis role="oblock">endin</emphasis>


<emphasis role="csdtag">&lt;/CsInstruments&gt;</emphasis>
<emphasis role="csdtag">&lt;CsScore&gt;</emphasis>

<emphasis role="comment">; Play Instrument #1, the audio file, for three seconds.</emphasis>
<emphasis role="stamnt">i</emphasis> 1 0 3
<emphasis role="comment">; Play Instrument #2, the "re-synthesized" waveform, for three seconds.</emphasis>
<emphasis role="stamnt">i</emphasis> 2 3 3
<emphasis role="stamnt">e</emphasis>


<emphasis role="csdtag">&lt;/CsScore&gt;</emphasis>
<emphasis role="csdtag">&lt;/CsoundSynthesizer&gt;</emphasis>
</programlisting>