[mus422] CalcSMRs without for loop

Marina Bosi mbosi at stanford.edu
Fri Feb 12 18:17:21 PST 2010


You should be able to find tonal peaks by looking for a peak in the
spectrum as a local maximum in the spectrum that exceeds a certain
threshold.  You do not need to create a masker for each FFT line !!!  For
example, see p. 281 of the book which discusses peak detection in MPEG
psychoacoustic model 1.)  Having identified a tonal peak, you can estimate
its frequency location by computing the intensity-weighted average
frequency of the peak and its two adjacent lines, and you can estimate its
intensity as the sum over that line and its two adjacent lines.  (This
accounts for tonal peaks that fall between FFT line locations which causes
their intensity to be split between the FFT lines.)  I would not recommend
using a zero-padded FFT to identify tonal peaks. 

 

In terms of maskers, you probably need to first identify the tonal maskers
(and aggregate the rest of the spectrum into noise maskers) and then loop
over the maskers to create the masked threshold.  However, you should be
able to vectorize the calculation of a masker's masking level at a vector
of MDCT line locations and also the addition of masking at those line
locations.

 

 

Marina Bosi

Consulting Professor, Department of Music

Stanford University

 

Computer Center for Research in Music and Acoustics

The Knoll,  660 Lomita Court

Stanford, California 94305-8180, USA

http://ccrma.stanford.edu

mbosi at stanford.edu

 

  _____  

From: 422-bounces at ccrma.Stanford.EDU
[mailto:422-bounces at ccrma.Stanford.EDU] On Behalf Of Jon Peterson
Sent: Friday, February 12, 2010 4:00 PM
To: Colin Raffel
Cc: 422 at ccrma.Stanford.EDU
Subject: Re: [mus422] CalcSMRs without for loop

 

I ran a loop, but I only created maskers for each peak detected in the
frequency domain.

 

1.  Take the FFT with some amount of zero padding (5x, for example)

2.  Find all of the peaks in the spectrum (simplest way of doing this is
looking for a low-high-low transition)

3.  Create your maskers based on the peaks you detected in step 2.

 

I hope this helps!

 

-Jon-

 

On Fri, Feb 12, 2010 at 3:17 PM, Colin Raffel <craffel at ccrma.stanford.edu>
wrote:

Hi guys, did anyone get a CalcSMRs function that doesn't use a for
loop?  My problem is that I can't mass instantiate the masker class,
so I have to do it one by one for each FFT bin:

  # Create maskers
  for i in xrange(np.size(dataFFT)):
    masker = psychoac.Masker(binFreqs[i], psychoac.SPL(dataFFT[i]))
    # Find max
    maskerSum =
np.maximum(psychoac.SPL(masker.IntensityAtFreq(binFreqs)),maskerSum)

It runs very slow with this loop.  Any ideas?

-Colin

_______________________________________________
422 mailing list
422 at ccrma.stanford.edu
http://cm-mail.stanford.edu/mailman/listinfo/422

 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://cm-mail.stanford.edu/pipermail/422/attachments/20100212/d9ef6b78/attachment.html 


More information about the 422 mailing list