/*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 1013 279 563 397 true 132 162 8 pitch 22 81 80 25 {2ed22600-54f1-40bd-84c6-8a0812cbfa4f} true 0 -3 left Lucida Grande 10 0 0 0 255 255 255 0.00000000 1.00000000 -999999999999.00000000 99999999999999.00000000 border 1 1 false 23 45 135 23 {6fda8591-4b9d-4494-8336-304c3e3f492b} true 0 -3 left Lucida Grande 10 3 0 0 0 255 255 255 noborder 1 1 button1 24 257 100 30 {4d130bbd-90c2-4a9c-9c3c-038cbfd4a569} true 0 -3 event 1.00000000 Play Synth / i2 0 20 false false amp 190 81 80 25 {fbe6c4b8-1663-496e-bc07-a60795aa5223} true 0 -3 left Lucida Grande 10 0 0 0 255 255 255 0.00551000 0.00001000 -999999999999.00000000 99999999999999.00000000 border 1 1 false 188 45 135 23 {f49d0afd-2282-4d02-aff1-fbc7140454f5} true 0 -3 left Lucida Grande 10 3 0 0 0 255 255 255 noborder 1 1 23 162 151 31 {db5447c5-b354-4549-962f-ce336996a6a3} true 0 -3 left Lucida Grande 18 3 0 0 0 255 255 255 noborder 1 1 23 7 151 31 {86023008-0f06-43e0-b9e9-54af7eb61e2c} true 0 -3 left Lucida Grande 18 3 0 0 0 255 255 255 noborder 1 1 21 196 156 61 {8fc51e65-a83f-47b5-9b87-02f6a84812b8} true 0 -3 left Lucida Grande 10 3 0 0 0 255 255 255 noborder 1 1