asBands actually returning the bacnds like low frequencies, mdeium frquencies and stuff. I believe you need asFrequencies() which will split the whole interval 0-11KHz into equal chunks and calc the power of the desired audio chunk in a particular range.
See doc for example:
http://pymedia.org//docs/pymedia.audio.sound.html#SpectrAnalyzer
For now the smallest frequency range you can get via asFrequencies() is 44000/ ( 4* 512 )= 22Hz
Dmitry/

----- Original Message ----- From: "Robert Helmer" <[EMAIL PROTECTED]>
To: <[email protected]>
Sent: Sunday, January 08, 2006 12:27 AM
Subject: Re: [Pymedia-users] pitch detection


Hi Dmitry,

Thank you for your reply! I have been trying out the asBands() method, which seems to yield some result to different voice tones. However, it seems that asBands() can only return a limited set of possible frequencies.. I am basically doing this :

snd= sound.Input( RATE, CHANNELS, sound.AFMT_S16_LE )
snd.start()
analyzer= sound.SpectrAnalyzer( CHANNELS, SAMPLES, NUM_FREQS )

while 1:
 largestFreqName= 0
 largestFreqValue= 0
 previousLargestFreqValue= 0
 bands= analyzer.asBands( BANDS, snd.getData() )
 for i in range( 0, len( bands ) ):
   for j in range( 0, len( bands[i] ) ):
     freqName= bands[i][j][0]
     if freqName >= 1000:
       continue
     freqValue= bands[i][j][1]
     if freqValue > largestFreqValue:
       previousLargestFreqValue= largestFreqValue
       largestFreqName= freqName
       largestFreqValue= freqValue
       print largestFreqValue

Am I understanding how this data may be used correctly? Is there some way to do something similar with the analyzer.asFrequencies() method? I cannot seem to make any sense out of the returned data through experimentation :)


Thanks!
Rob Helmer

Dmitry Borisov wrote:
Hi,
It could work for you.
Basically SpectrAnalyzer is taking the fixed number of samples >512 and returns the frequencies strength. If you use much more samples it may not work well for you though. Sorry I never did pitch detection myself, so I cannot tell if it'll work for you.
Dmitry/

----- Original Message ----- From: "Robert Helmer" <[EMAIL PROTECTED]>
To: <[email protected]>
Sent: Tuesday, January 03, 2006 12:25 PM
Subject: [Pymedia-users] pitch detection


Hello,

I am working on a voice-training python application that involves pitch detection. I have had some good results using FFT but it's a bit too slow (I can't get good detection without a very large sample size it seems).

Could SpectrAnalyzer be useful for pitch detection? I am a bit confused as to how to use this class properly; the example (sound_viz.py) doesn't work in the latest release due to what looks like API changes. I think being able to experiment with a working implementation would help me to be able to play around with FFT and other algorithms (Schmitt-triggering for instance).

I took a peek at the implementation of SpectrAnalyzer in C and I am not sure how much overlap there is between what I am trying to do and SpectrAnalyzer; it seems quite capable but my inexperience in digital audio processing is holding back my understanding.

I've been learning just how little I know about DSP by embarking on this, so any suggestions would be greatly appreciated!


Thanks,
Rob Helmer


-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
http://ads.osdn.com/?ad_id=7637&alloc_id=16865&op=click
_______________________________________________
Pymedia-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/pymedia-users




-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
http://ads.osdn.com/?ad_id=7637&alloc_id=16865&op=click
_______________________________________________
Pymedia-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/pymedia-users



-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
http://ads.osdn.com/?ad_id=7637&alloc_id=16865&op=click
_______________________________________________
Pymedia-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/pymedia-users




-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
http://ads.osdn.com/?ad_id=7637&alloc_id=16865&op=click
_______________________________________________
Pymedia-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/pymedia-users

Reply via email to