/*Getting started.. Realtime Interaction: Live Audio Input
Two very common live-electronic uscases are modifying an incoming signal in realtime, or analysing it.
To avoid acoustic feedbacks, this example, does not output the input-signal!
Here, the input's frequency and amplitude are analysed in realtime and displayed on the Widget-Panel.
The second instrument can be started, which uses these information to control an oscillator.
(If this is using to much CPU power and does crackle, increase the buffersize in the Preferences Menu(->Run->Buffer Size).
A good startingpoint is Buffersize (-b)=128; HW Buffersize(-B)=512.)
More information concerning realtime-audio can be found in the Csound-Manual: Using Csound-> Optimizing Audio I/O Latency
*/
sr = 44100
ksmps = 32
nchnls = 1
0dbfs = 1
instr 1
aInput inch 1 ; read audiohardware channel 1
ifftsize = 1024 ; set the buffersize for later fft-analysis
iwtype = 1 ; hanning window
fsig pvsanal aInput, ifftsize, ifftsize/4, ifftsize, iwtype ; generate an fsig from the mono audio source
gkFreq, gkAmp pvspitch fsig, 0.01 ; pitch and amplitude analysis tool
outvalue "pitch", gkFreq ; send pitch-values to Widget
outvalue "amp", gkAmp ; send amplitude-values to Widget
endin
instr 2
aSrc oscili gkAmp, gkFreq, 1 ; instrument 1 used global k-variables, so they can be read-out here..
kFeedback=0.6 ; feedback-amount for the delay
aDelay delayr 1
aWet deltapi 0.2
delayw aSrc+(aWet*kFeedback)
aOut = aSrc+(aWet*0.3) ; mixing the oscillator with the delay
out aOut
endin
f 1 0 256 7 0 128 1 0 -1 128 0
i 1 0 3600 ; instrument 1 runs for one hour
e
; written by Alex Hofmann (Dec. 2009) - Incontri HMT-Hannover
1013279563397true1321628pitch22818025{2ed22600-54f1-40bd-84c6-8a0812cbfa4f}true0-3left
Lucida Grande
100002552552550.000000001.00000000-999999999999.0000000099999999999999.00000000border11false234513523{6fda8591-4b9d-4494-8336-304c3e3f492b}true0-3left
Lucida Grande
103000255255255noborder11button12425710030{4d130bbd-90c2-4a9c-9c3c-038cbfd4a569}true0-3event1.00000000Play Synth/i2 0 20falsefalseamp190818025{fbe6c4b8-1663-496e-bc07-a60795aa5223}true0-3left
Lucida Grande
100002552552550.005510000.00001000-999999999999.0000000099999999999999.00000000border11false1884513523{f49d0afd-2282-4d02-aff1-fbc7140454f5}true0-3left
Lucida Grande
103000255255255noborder112316215131{db5447c5-b354-4549-962f-ce336996a6a3}true0-3left
Lucida Grande
183000255255255noborder1123715131{86023008-0f06-43e0-b9e9-54af7eb61e2c}true0-3left
Lucida Grande
183000255255255noborder112119615661{8fc51e65-a83f-47b5-9b87-02f6a84812b8}true0-3left
Lucida Grande
103000255255255noborder11