Realtime pitch detection on Csound?
Date | 1996-06-26 12:00 |
From | Josep M* Comajuncosas |
Subject | Realtime pitch detection on Csound? |
Would it be possible to extract pitch information directly from the audio input devices, by using the spectral operators? Would I need a very powerful machine to do that (I´m using a P-133 w. 64 Mb RAM)? Then you could send it to a MIDI instrument via midi output opcodes, or whathever... Imagine yourself whistling while your Soundcard follows your pitch! I´d like to use Csound in that realtime interactive stuff, but I´m afraid 99% of its tools are non-realtime oriented. Any help would be welcome. Thancks! Josep M. Comajuncosas |
Date | 1997-06-26 22:06 |
From | Mike Berry |
Subject | Re: Realtime pitch detection on Csound? |
The spectral operators, as far as I know, don't do anything, other than supply each other with data. They do not interact in any way with other csound opcodes. So you can't use them to in the way you are describing. Mike Berry mikeb@mills.edu http://www.mills.edu/PEOPLE/gr.pages/mikeb.public.html/mikeb.homepage.html |
Date | 1997-06-26 22:42 |
From | Bill Kleinsasser |
Subject | Re: Realtime pitch detection on Csound? |
Here is one way that I have gotten it to work: ;While this is not a complete .orc file, it represents the heart of a ;pitch-tracking instrument that reads input and spectrally extracts ;the fundamental using octdown, noctdft, specsum, and specptrk. William Kleinsasser Towson University Baltimore, MD ;-------------------------------------------------------------------------- ;INITIALIZE VARIABLES ;-------------------------------------------------------------------------- ;.5 = octave down, 2 = octave up, etc. ;SET MANUALLY: ianalperiod = .01 ;set period for spectral analysis ianalsamps = ianalperiod*sr ;set number of samples in spectral anal ;FROM SCORE: ipartialcount = p4 ;number of partials for analysis (from score) inum = p5 ;soundfile id number (from score) ;-------------------------------------------------------------------------- ;READ SOUNDFILE IN (mono) ;-------------------------------------------------------------------------- ;.5 = octave down, 2 = octave up, etc. ;(use ; to comment-out the options you do not wish to use) ; asig soundin inum ;read soundfile "inum" ; OR asig soundin "soundfile_name";read soundfile "file name" ; OR ; asig in ;real-time sound input from ADC ;-------------------------------------------------------------------------- ;ANALYZE THE SPECTRUM ;-------------------------------------------------------------------------- ;.5 = octave down, 2 = octave up, etc. ;downsample in 6 octaves: dsamp octdown asig,6,ianalsamps,0 ;calculate 72-point dft (dB): wsig noctdft dsamp,ianalperiod,12,33,1,1,1 ;sum the spec bins, and ksmooth: ksum specsum wsig, 1 ;analyze for pitch-tracking: koct specptrk wsig, ipartialcount, .8, 0 ;set ksig to = the tracked pitch in cpsoct mode: ksig = cpsoct(koct) ;************** On Thu, 26 Jun 1997, Mike Berry wrote: > The spectral operators, as far as I know, don't do anything, > other than supply each other with data. They do not interact in any way > with other csound opcodes. So you can't use them to in the way you are > describing. > > Mike Berry > mikeb@mills.edu > http://www.mills.edu/PEOPLE/gr.pages/mikeb.public.html/mikeb.homepage.html > > |
Date | 1997-06-29 19:48 |
From | Erez Webman |
Subject | Re: Realtime pitch detection on Csound? |
It seems that this program doesn't work on my PC (csound 3.46). The following error message is generated: "OCTDOWN was not initialized". Any ideas? Thanks, Erez Webman On Thu, 26 Jun 1997, Bill Kleinsasser wrote: > Here is one way that I have gotten it to work: > > ;While this is not a complete .orc file, it represents the heart of a > ;pitch-tracking instrument that reads input and spectrally extracts > ;the fundamental using octdown, noctdft, specsum, and specptrk. > > William Kleinsasser > Towson University > Baltimore, MD > > ;-------------------------------------------------------------------------- > ;INITIALIZE VARIABLES > ;-------------------------------------------------------------------------- > ;.5 = octave down, 2 = octave up, etc. > > ;SET MANUALLY: > ianalperiod = .01 ;set period for spectral > analysis > ianalsamps = ianalperiod*sr ;set number of samples in > spectral anal > > ;FROM SCORE: > ipartialcount = p4 ;number of partials for analysis (from score) > inum = p5 ;soundfile id number (from score) > > ;-------------------------------------------------------------------------- > ;READ SOUNDFILE IN (mono) > ;-------------------------------------------------------------------------- > ;.5 = octave down, 2 = octave up, etc. > ;(use ; to comment-out the options you do not wish to use) > ; asig soundin inum ;read soundfile "inum" > ; OR > asig soundin "soundfile_name";read soundfile "file name" > ; OR > ; asig in > ;real-time sound input from ADC > > ;-------------------------------------------------------------------------- > ;ANALYZE THE SPECTRUM > ;-------------------------------------------------------------------------- > ;.5 = octave down, 2 = octave up, etc. > ;downsample in 6 octaves: > dsamp octdown asig,6,ianalsamps,0 > > ;calculate 72-point dft (dB): > wsig noctdft dsamp,ianalperiod,12,33,1,1,1 > > ;sum the spec bins, and ksmooth: > ksum specsum wsig, 1 > > ;analyze for pitch-tracking: > koct specptrk wsig, ipartialcount, .8, 0 > > ;set ksig to = the tracked pitch in cpsoct mode: > ksig = cpsoct(koct) > > > > ;************** > |
Date | 1997-06-29 20:03 |
From | Erez Webman |
Subject | Pitch detection on PC Csound |
I've tried to use LPANAL for pitch detection on my PC (Csound 3.46 for DOS). I noticed that LPANAL runs fairly quickly for small sound files (say, 3 seconds). BUT, when the length of the sound file is SLIGHTLY longer (8 seconds, for example), the program runs for hours...!!! I guess it has something to do with misbehaved memory allocations, etc. Any suggestions? Thanks, Erez Webman |