Peak detection with an FFT

Jan 14, 2009 at 10:22pm

Peak detection with an FFT

Hi All,

I’m trying to work inside a pfft~ subpatch to detect amplitude peaks and
their associated frequencies from a recorded sine sweep [this is a test
patch for a larger project in which i am attempting to detect room modes
by analyzing recordings of sine sweeps through a room and looking for
amplitude spikes]. However, I can’t seem to be able to simply read
through the buffer~ of fft output and pick out the loudest X bins and
their associated amplitudes. This seems like it should be a fairly
simple task (and with a language such as Perl, Javascript, etc. it would
be), but using MSP objects to do this seems quite tricky. For one thing,
everything is forced to work at signal rate, even though the analysis
would ideally be at CPU rate, and using scheduler-rate objects seems to
be a dead end due to the synchronization issues they run into. I’ve
attached two patches below (please let me know if there is a better way
to attach these). The first is the parent patch where you trigger the
sweep. the second is the pfft~ subpatch where the magic should happen.
If you read the comments inside of it, you’ll see where the problem is
and get an idea as to how I’m approaching it. Many thanks in advance for
any and all assistance!

Best,

Peter Traub

– Pasted Max Patch, click to expand. –

– Pasted Max Patch, click to expand. –
#41684
Jan 15, 2009 at 2:28pm

You can analyze a buffer~ in Java. See [mxj buf.Op] (help file is called
buf.Op.help )
Another option is to record your spectral data into Jitter matrices instead
of buffers. Then, you may find data easier to manipulate and visualize.
Jean-Francois.

> Hi All,
>
> I’m trying to work inside a pfft~ subpatch to detect amplitude peaks and
> their associated frequencies from a recorded sine sweep [this is a test
> patch for a larger project in which i am attempting to detect room modes
> by analyzing recordings of sine sweeps through a room and looking for
> amplitude spikes]. However, I can’t seem to be able to simply read
> through the buffer~ of fft output and pick out the loudest X bins and
> their associated amplitudes. This seems like it should be a fairly
> simple task (and with a language such as Perl, Javascript, etc. it would
> be), but using MSP objects to do this seems quite tricky. For one thing,
> everything is forced to work at signal rate, even though the analysis
> would ideally be at CPU rate, and using scheduler-rate objects seems to
> be a dead end due to the synchronization issues they run into. I’ve
> attached two patches below (please let me know if there is a better way
> to attach these). The first is the parent patch where you trigger the
> sweep. the second is the pfft~ subpatch where the magic should happen.
> If you read the comments inside of it, you’ll see where the problem is
> and get an idea as to how I’m approaching it. Many thanks in advance for
> any and all assistance!
>
> Best,
>
> Peter Traub

#148570
Jan 16, 2009 at 8:16am

If you are looking for peaks extraction, you could also use iana~.
It extracts peaks with various parameters (width, level difference between
centre bin and adjacent ones, keep or not peaks below threshold of hearing)
and allows you to order them by frequency, sound pressure level, or
psychoacoustically perceived level or contribution to pitch perception.

Best,
Todor

> You can analyze a buffer~ in Java. See [mxj buf.Op] (help file is called
> buf.Op.help )
> Another option is to record your spectral data into Jitter matrices instead
> of buffers. Then, you may find data easier to manipulate and visualize.
> Jean-Francois.
>
>
>> Hi All,
>>
>> I’m trying to work inside a pfft~ subpatch to detect amplitude peaks and
>> their associated frequencies from a recorded sine sweep [this is a test
>> patch for a larger project in which i am attempting to detect room modes
>> by analyzing recordings of sine sweeps through a room and looking for
>> amplitude spikes]. However, I can’t seem to be able to simply read
>> through the buffer~ of fft output and pick out the loudest X bins and
>> their associated amplitudes. This seems like it should be a fairly
>> simple task (and with a language such as Perl, Javascript, etc. it would
>> be), but using MSP objects to do this seems quite tricky. For one thing,
>> everything is forced to work at signal rate, even though the analysis
>> would ideally be at CPU rate, and using scheduler-rate objects seems to
>> be a dead end due to the synchronization issues they run into. I’ve
>> attached two patches below (please let me know if there is a better way
>> to attach these). The first is the parent patch where you trigger the
>> sweep. the second is the pfft~ subpatch where the magic should happen.
>> If you read the comments inside of it, you’ll see where the problem is
>> and get an idea as to how I’m approaching it. Many thanks in advance for
>> any and all assistance!
>>
>> Best,
>>
>> Peter Traub
>
>

#148571
Jan 16, 2009 at 6:20pm

Thanks! I’ll certainly check this one out as it may solve most of my
problems. I’ve actually had a bit of success since emailing the list by
adding a function to the java buf.Op library. I’m not a java writer at
all, but have done plenty of Perl, so I was able to hack my way to a
function that returned the three highest peaks. Of course, they’re all
right next to each other, so I need something that looks at surrounding
bins and essentially does a lot more sophisticated analysis. That said,
does anyone have a link to the iana~ library? I’m having a very hard
time finding it via Google, and as I don’t speak French, I’m not getting
too far on the Ircam site. Thanks again!

Best,

Peter

Todor Todoroff wrote:
> If you are looking for peaks extraction, you could also use iana~.
> It extracts peaks with various parameters (width, level difference between
> centre bin and adjacent ones, keep or not peaks below threshold of hearing)
> and allows you to order them by frequency, sound pressure level, or
> psychoacoustically perceived level or contribution to pitch perception.
>
> Best,
> Todor
>
>
>> You can analyze a buffer~ in Java. See [mxj buf.Op] (help file is called
>> buf.Op.help )
>> Another option is to record your spectral data into Jitter matrices instead
>> of buffers. Then, you may find data easier to manipulate and visualize.
>> Jean-Francois.
>>
>>
>>
>>> Hi All,
>>>
>>> I’m trying to work inside a pfft~ subpatch to detect amplitude peaks and
>>> their associated frequencies from a recorded sine sweep [this is a test
>>> patch for a larger project in which i am attempting to detect room modes
>>> by analyzing recordings of sine sweeps through a room and looking for
>>> amplitude spikes]. However, I can’t seem to be able to simply read
>>> through the buffer~ of fft output and pick out the loudest X bins and
>>> their associated amplitudes. This seems like it should be a fairly
>>> simple task (and with a language such as Perl, Javascript, etc. it would
>>> be), but using MSP objects to do this seems quite tricky. For one thing,
>>> everything is forced to work at signal rate, even though the analysis
>>> would ideally be at CPU rate, and using scheduler-rate objects seems to
>>> be a dead end due to the synchronization issues they run into. I’ve
>>> attached two patches below (please let me know if there is a better way
>>> to attach these). The first is the parent patch where you trigger the
>>> sweep. the second is the pfft~ subpatch where the magic should happen.
>>> If you read the comments inside of it, you’ll see where the problem is
>>> and get an idea as to how I’m approaching it. Many thanks in advance for
>>> any and all assistance!
>>>
>>> Best,
>>>
>>> Peter Traub
>>>
>>
>
>
>

#148572
Jan 16, 2009 at 6:44pm

I could send it to you. On what system are you?
Best,
Todor
> Thanks! I’ll certainly check this one out as it may solve most of my
> problems. I’ve actually had a bit of success since emailing the list by
> adding a function to the java buf.Op library. I’m not a java writer at
> all, but have done plenty of Perl, so I was able to hack my way to a
> function that returned the three highest peaks. Of course, they’re all
> right next to each other, so I need something that looks at surrounding
> bins and essentially does a lot more sophisticated analysis. That said,
> does anyone have a link to the iana~ library? I’m having a very hard
> time finding it via Google, and as I don’t speak French, I’m not getting
> too far on the Ircam site. Thanks again!
>
> Best,
>
> Peter
>
> Todor Todoroff wrote:
>> If you are looking for peaks extraction, you could also use iana~.
>> It extracts peaks with various parameters (width, level difference between
>> centre bin and adjacent ones, keep or not peaks below threshold of hearing)
>> and allows you to order them by frequency, sound pressure level, or
>> psychoacoustically perceived level or contribution to pitch perception.
>>
>> Best,
>> Todor
>>
>>
>>> You can analyze a buffer~ in Java. See [mxj buf.Op] (help file is called
>>> buf.Op.help )
>>> Another option is to record your spectral data into Jitter matrices instead
>>> of buffers. Then, you may find data easier to manipulate and visualize.
>>> Jean-Francois.
>>>
>>>
>>>
>>>> Hi All,
>>>>
>>>> I’m trying to work inside a pfft~ subpatch to detect amplitude peaks and
>>>> their associated frequencies from a recorded sine sweep [this is a test
>>>> patch for a larger project in which i am attempting to detect room modes
>>>> by analyzing recordings of sine sweeps through a room and looking for
>>>> amplitude spikes]. However, I can’t seem to be able to simply read
>>>> through the buffer~ of fft output and pick out the loudest X bins and
>>>> their associated amplitudes. This seems like it should be a fairly
>>>> simple task (and with a language such as Perl, Javascript, etc. it would
>>>> be), but using MSP objects to do this seems quite tricky. For one thing,
>>>> everything is forced to work at signal rate, even though the analysis
>>>> would ideally be at CPU rate, and using scheduler-rate objects seems to
>>>> be a dead end due to the synchronization issues they run into. I’ve
>>>> attached two patches below (please let me know if there is a better way
>>>> to attach these). The first is the parent patch where you trigger the
>>>> sweep. the second is the pfft~ subpatch where the magic should happen.
>>>> If you read the comments inside of it, you’ll see where the problem is
>>>> and get an idea as to how I’m approaching it. Many thanks in advance for
>>>> any and all assistance!
>>>>
>>>> Best,
>>>>
>>>> Peter Traub
>>>>
>>>
>>
>>
>>
>

#148573
Jan 16, 2009 at 7:06pm

I’m using Max/MSP 5 on OS 10.5 on a Powerbook (PPC). Thanks!

Peter

Todor Todoroff wrote:
> I could send it to you. On what system are you?
> Best,
> Todor
>
>> Thanks! I’ll certainly check this one out as it may solve most of my
>> problems. I’ve actually had a bit of success since emailing the list by
>> adding a function to the java buf.Op library. I’m not a java writer at
>> all, but have done plenty of Perl, so I was able to hack my way to a
>> function that returned the three highest peaks. Of course, they’re all
>> right next to each other, so I need something that looks at surrounding
>> bins and essentially does a lot more sophisticated analysis. That said,
>> does anyone have a link to the iana~ library? I’m having a very hard
>> time finding it via Google, and as I don’t speak French, I’m not getting
>> too far on the Ircam site. Thanks again!
>>
>> Best,
>>
>> Peter
>>
>> Todor Todoroff wrote:
>>
>>> If you are looking for peaks extraction, you could also use iana~.
>>> It extracts peaks with various parameters (width, level difference between
>>> centre bin and adjacent ones, keep or not peaks below threshold of hearing)
>>> and allows you to order them by frequency, sound pressure level, or
>>> psychoacoustically perceived level or contribution to pitch perception.
>>>
>>> Best,
>>> Todor
>>>
>>>
>>>
>>>> You can analyze a buffer~ in Java. See [mxj buf.Op] (help file is called
>>>> buf.Op.help )
>>>> Another option is to record your spectral data into Jitter matrices instead
>>>> of buffers. Then, you may find data easier to manipulate and visualize.
>>>> Jean-Francois.
>>>>
>>>>
>>>>
>>>>
>>>>> Hi All,
>>>>>
>>>>> I’m trying to work inside a pfft~ subpatch to detect amplitude peaks and
>>>>> their associated frequencies from a recorded sine sweep [this is a test
>>>>> patch for a larger project in which i am attempting to detect room modes
>>>>> by analyzing recordings of sine sweeps through a room and looking for
>>>>> amplitude spikes]. However, I can’t seem to be able to simply read
>>>>> through the buffer~ of fft output and pick out the loudest X bins and
>>>>> their associated amplitudes. This seems like it should be a fairly
>>>>> simple task (and with a language such as Perl, Javascript, etc. it would
>>>>> be), but using MSP objects to do this seems quite tricky. For one thing,
>>>>> everything is forced to work at signal rate, even though the analysis
>>>>> would ideally be at CPU rate, and using scheduler-rate objects seems to
>>>>> be a dead end due to the synchronization issues they run into. I’ve
>>>>> attached two patches below (please let me know if there is a better way
>>>>> to attach these). The first is the parent patch where you trigger the
>>>>> sweep. the second is the pfft~ subpatch where the magic should happen.
>>>>> If you read the comments inside of it, you’ll see where the problem is
>>>>> and get an idea as to how I’m approaching it. Many thanks in advance for
>>>>> any and all assistance!
>>>>>
>>>>> Best,
>>>>>
>>>>> Peter Traub
>>>>>
>>>>>
>>>>
>>>>
>>>
>>>
>>
>
>
>

#148574
Jul 29, 2009 at 6:47pm

excuse me, where can i find iana~ for max5 (ub mac os10.5)?

#148575
Jul 30, 2009 at 11:33am

iana~ is part of the Ircam’s forum.

#148576
Jul 30, 2009 at 12:16pm

is it right that i have to pay for downloading this library?

#148577
Jul 30, 2009 at 1:08pm

That’s the theory about it. You might also have a look to zsa.freqpeak, it doesn’t use Terhard algorithm though.

#148578

You must be logged in to reply to this topic.