Forums > MaxMSP

Peak detection with an FFT


pmt
January 14, 2009 | 10:22 pm

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. –

January 15, 2009 | 2:28 pm

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


January 16, 2009 | 8:16 am

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
>
>



pmt
January 16, 2009 | 6:20 pm

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
>>>
>>
>
>
>


January 16, 2009 | 6:44 pm

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
>>>>
>>>
>>
>>
>>
>



pmt
January 16, 2009 | 7:06 pm

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
>>>>>
>>>>>
>>>>
>>>>
>>>
>>>
>>
>
>
>


July 29, 2009 | 6:47 pm

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


July 30, 2009 | 11:33 am

iana~ is part of the Ircam’s forum.


July 30, 2009 | 12:16 pm

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


July 30, 2009 | 1:08 pm

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


Viewing 10 posts - 1 through 10 (of 10 total)