[mirtoolbox] Re: Mirspectrum

  • From: ivonne julietta <vonni_julietta@xxxxxxxxx>
  • To: "mirtoolbox@xxxxxxxxxxxxx" <mirtoolbox@xxxxxxxxxxxxx>
  • Date: Wed, 20 Apr 2011 16:40:38 +0800 (SGT)

Thank you Hendrik. You help me to understanding the two different frame length.
If i write the command as you give me:
a=miraudio('Laksin')
f=mirspectrum(a, 'Length', 8192, 'Frame', 0.04)
it produce a figure with time axis and frequency axis. But, actually i need a 
figure with frequency axis and amplitude axis (dB). How can i produce it?
And also how can i get the power amplitude spectrum values?not as a figure but 
as a tuple of data (frequency and amplitude),for example when the frequency 
50hz, the amplitude 20dB.

thank you,



 
Cheers,
Ivon
Faculty Of Computer Science 2007
University Of Indonesia 
--------------------------------------------------------------------------
The Lord is close to those who are of a broken heart and saves such as are 
crushed with sorrow for sin and are humbly and thoroughly penitent.


________________________________
From: Hendrik Schreiber <hs@xxxxxxxxxxxx>
To: mirtoolbox@xxxxxxxxxxxxx
Sent: Wednesday, April 20, 2011 2:38 PM
Subject: Re: [mirtoolbox] Re: Mirspectrum

Ivon,

I think you mixed up two concepts here, let me explain..

Length in s and length in frames describe the same concept so it only make 
sense to specify one or the other.

Length in seconds is a good choice, if for whatever reason you need to have the 
spectral data for audio chunks of a certain temporal length. E.g. a length that 
means something to humans.

Internally MIRToolBox then converts that length in seconds to a length in 
frames and works with that. It can only do that, because it knows the sample 
rate of your data. E.g. 44.1kHz for a wave file from CD.

LengthInS * sampleRate = frames, or 0.2s*44100frames/s=8820frames

Now, if you specify the window length in frames instead of seconds, depending 
on your sample rate, you specify the length in seconds implicitly.

In your case, most likely the paper talks about two different frame lengths 
though.

1) 0.04s is the length of the data chunk you want to analyze (for 44.1kHz that 
would be 1764 samples)
2) 8192 is the length of the FFT you want to use for this analysis

FFTs have a resolution, i.e. each bin describes a frequency. The more bins 
there are, the finer grained is the result of the transform. By mandating 8192 
instead of just 1764 samples as input, you get a higher resolution. Because you 
only have 1764 samples, the rest is zeropadded.

So what you need to do is IMO:

a=miraudio('Laksin')
f=mirspectrum(a, 'Length', 8192, 'Frame', 0.04)

The length parameter takes care of the FFT length, the frame parameter cuts the 
input into 0.04s long pieces.
What you now still need to think about it whether and how those frames should 
overlap (hopsize). The manual will tell you how to specify that.

Good luck,

-hendrik

On Apr 20, 2011, at 7:24 AM, ivonne julietta wrote:

> Hallo,
> I have some questions here.
> My 1st question:
> I have just read a paper and it is said that:
> 1. "i need to extract the power spectrum for each 0.04 s". I interprete that 
> i need to do: f=mirframe(a,'Length',0.04); 
> but it is also said 
> 2."in order to represent accurately the spectrum with high resolution in 
> frequency axis, long analyzing frame with 8192 numeric sample was choosen".
> From that statement i interprete that i need to do 
> :f=mirframe(a,'Length',8192,'sp');
> 
> from both of that statement, i write:
> a=miraudio('Laksin');
> f1=mirframe(a,'Length',0.04);
> f2=mirframe(f1,'Length',8192,'sp');
> 
> but, it gave warning "  WARNING IN MIRFRAME: The input data is already 
> decomposed into frames. No more
> frame decomposition. "
> 
> So, what should i do to slice them for each 0.04s and also 8192 numeric 
> samples?
> 
> 
> 2nd question:
> How can i get the power amplitude spectrum values (points)?
> 
> thank you
> 
> 
> 
> Cheers,
> Ivon
> Faculty Of Computer Science 2007
> University Of Indonesia 
> --------------------------------------------------------------------------
> The Lord is close to those who are of a broken heart and saves such as are 
> crushed with sorrow for sin and are humbly and thoroughly penitent.

Other related posts: