Debian Codegraph @

src/Examples/CsoundQt/Useful/Pitch_Tracker.csd

raw
1 <CsoundSynthesizer>
2 <CsOptions>
3 </CsOptions>
4 <CsInstruments>
5
6 sr = 44100
7 ksmps = 128
8 nchnls = 2
9 0dbfs = 1
10
11
12 gSnotes = "CcDdEFfGgAaB"
13
14 instr 1
15 kth invalue "th"
16 ka3 invalue "a3"
17
18 asig inch 1
19
20 kcps, kamp ptrack asig, 4096
21 kcps portk kcps, 0.02
22
23 if kamp > kth then
24 knote = 69 + (12 *( log(kcps/440) / log(2) ) )
25 kpchclass = int( knote% 12 )
26 kfrac = frac(knote)
27 if kfrac > 0.5 then
28 kfrac = kfrac - 1
29 kpchclass = kpchclass + 1
30 endif
31 kcents = kfrac * 100
32 kcents portk kcents, 0.02
33 Sname strsubk gSnotes, kpchclass, kpchclass + 1
34 kchr strchark Sname
35 if kchr > 95 then
36 Sname strupperk Sname
37 Sname strcatk Sname, "#"
38 endif
39 outvalue "cents", kcents
40 outvalue "note", Sname
41 outvalue "midinote", knote
42 outvalue "freq", kcps
43 endif
44 endin
45
46
47 </CsInstruments>
48 <CsScore>
49 i 1 0 3000
50 e
51 </CsScore>
52 </CsoundSynthesizer>
53 <MacOptions>
54 Version: 3
55 Render: Real
56 Ask: Yes
57 Functions: ioObject
58 Listing: Window
59 WindowBounds: 731 205 372 403
60 CurrentView: io
61 IOViewEdit: On
62 Options: -b128 -A -s -m167 -R
63 </MacOptions>
64 <MacGUI>
65 ioView background {35209, 28784, 9252}
66 ioText {43, 85} {115, 35} display 62.607059 0.00100 "freq" left "Heiti SC Light" 20 {0, 0, 0} {65280, 65280, 65280} background border 62.6071
67 ioSlider {246, 58} {29, 165} -40.000000 0.000000 -26.909091 th
68 ioText {224, 225} {80, 25} label 0.000000 0.00100 "" left "Lucida Grande" 8 {0, 0, 0} {65280, 65280, 65280} nobackground noborder Threshold (dB)
69 ioText {224, 250} {80, 25} display -26.909091 0.00100 "th" left "Lucida Grande" 8 {0, 0, 0} {65280, 65280, 65280} nobackground border -26.9091
70 ioText {218, 307} {94, 27} editnum 440.000000 0.001000 "a3" left "Lucida Grande" 8 {0, 0, 0} {65280, 65280, 65280} nobackground noborder 440.000000
71 ioText {218, 282} {94, 27} label 0.000000 0.00100 "" left "Lucida Grande" 8 {0, 0, 0} {65280, 65280, 65280} nobackground noborder A3 (Hz)
72 ioText {44, 151} {122, 34} display 35.242725 0.00100 "midinote" left "Heiti SC Light" 20 {0, 0, 0} {65280, 65280, 65280} background border 35.2427
73 ioText {43, 60} {94, 25} label 0.000000 0.00100 "" left "Lucida Grande" 8 {0, 0, 0} {65280, 65280, 65280} nobackground noborder Frequency (Hz)
74 ioText {44, 126} {94, 25} label 0.000000 0.00100 "" left "Lucida Grande" 8 {0, 0, 0} {65280, 65280, 65280} nobackground noborder MIDI note
75 ioText {45, 216} {122, 34} display 0.000000 0.00100 "note" left "Heiti SC Light" 20 {0, 0, 0} {65280, 65280, 65280} background border B
76 ioText {45, 191} {94, 25} label 0.000000 0.00100 "" left "Lucida Grande" 8 {0, 0, 0} {65280, 65280, 65280} nobackground noborder Note
77 ioText {8, 260} {193, 79} label 0.000000 0.00100 "" left "Lucida Grande" 8 {0, 0, 0} {65280, 65280, 65280} nobackground border Cents
78 ioSlider {13, 281} {183, 22} -50.000000 50.000000 23.770492 cents
79 ioText {66, 306} {80, 25} display 23.770492 0.00100 "cents" left "Lucida Grande" 8 {0, 0, 0} {65280, 65280, 65280} nobackground border 23.7705
80 ioText {13, 8} {334, 36} label 0.000000 0.00100 "" left "Lucida Grande" 16 {0, 0, 0} {65280, 65024, 54784} background noborder Pitch Tracker
81 </MacGUI>
82