MathGroup Archive 2009

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Re: Sound Spectrogram over time, in 3D, using Fourier?

  • To: mathgroup at
  • Subject: [mg95000] Re: [mg94993] Re: Sound Spectrogram over time, in 3D, using Fourier?
  • From: DrMajorBob <btreat1 at>
  • Date: Fri, 2 Jan 2009 06:54:45 -0500 (EST)
  • References: <gjict6$c7k$> <>
  • Reply-to: drmajorbob at

That's an excellent tutorial (to my ears) on DFT. Thanks!


On Thu, 01 Jan 2009 19:30:35 -0600, Sjoerd C. de Vries  
<sjoerd.c.devries at> wrote:

> Hi Justin,
> A couple of remarks with respect to your question:
> 1. Fourier returns the discrete fourier transform (DFT) of a list of
> numbers. There is no way the Fourier function could know how these
> were sampled. The same list of numbers may be the result of sampling
> at a rate of one sample a day or at 44.1 KHz or whatever. Therefore,
> you cannot interpret the output in terms of frequencies. At least, not
> directly. If you know the duration of your set of samples (T) then a
> number at position s of the output list corresponds to a frequency of
> (s-1)/T Hz.
> 2. The value of a Fourier result at position s equals the complex
> conjugated value at position n-s+2 for 1<=s<=n/2, with n the number of
> samples. Look for instance at this:
> res = Fourier[Table[Sin[2 \[Pi] 1 t], {t, 0, 1, 1/99}]]
> Table[Conjugate[res[[i]]] - res[[Length[res] - i + 2]], {i, 2,   Length
> [res]/2}]
> The DC term (the average value) of your samples is at position 1. So,
> the result can be expressed as the first n/2 complex numbers, the
> remainder of the output is redundant. Therefore, the highest
> representable frequency is n/2/T (Nyquist frequency). It therefore
> makes no sense to plot the whole range of the output of Fourier[ ].
> Half of it suffices.  If Fs is the sample frequency, then n = Fs T and
> the highest representable frequency equals Fs/2.
> BTW: note that n/2 complex numbers contain the same amount of
> information as n real numbers, so no information is lost in the
> transformation.
> 3. The size of the numbers in the output depends on the choice of the
> normalization term in the fourier transform. Look for
> FourierParameters in the documentation.
> 4. The decibel scale is a relative scale in which values are related
> to a given reference level. You have to provide this reference level
> yourself (it will have a dB level of 0). Given a certain ref power
> level P0, the value of a power level P1 in dB is given by 10*Log10[P1/
> P0]. Often, power is related to the amplitude squared so the value of
> P1 in dB will be 20* Log10[A1/A0] when using amplitudes.
> 5. As to the 3D plot: should not be too difficult. Collect a number of
> DFTs of some windows in your data set. Add them all to a list and you
> have a 3D set that can be plotted by ListPlot3D.
> Cheers -- Sjoerd
> On Jan 1, 2:28 pm, Justin <carillona... at> wrote:
>> I'm rather new to Mathematica, and am attempting to make a 3D plot  
>> showin=
> g how the frequency profile of a sound sample changes over time. I've  
> impor=
> ted a .5 second audio file:
>> wave = Import["clip.wav","Data"]
>> which returns a list of amplitude values of the wave (The file is  
>> sampled=
>  at 44.1 kHz, so there are about 22k numbers in the list).  I can get a  
> n=
> ice 2D plot of the frequency spectrum for the length of the whole clip  
> with=
> :
>> ListLinePlot[Take[Abs[Fourier[wave]],650],PlotRange -> {0,2.5}]
>> where 650 is the max frequency shown (in Hz I think?) and 0-2.5 is the  
>> in=
> tensity range (I'm not sure what these values mean, but I'd like to see  
> it =
> in dB).
>> What I would like to do is plot a 3 second long clip in 3D and show how  
>> t=
> he frequency profile changes over those 3 seconds, so x=frequency, y=in=
> tensity, z=time.
>> I understand that my above 2D plot is one fat slice, and that I need to  
>> m=
> ake hundreds or thousands of similar slices over the 3 second clip to  
> make =
> the 3D plot, I'm just not sure how to do it.
>> Any help would be greatly appreciated, thanks!!!
>> J

DrMajorBob at

  • Prev by Date: Re: Non-deterministic numerical inaccuracies in
  • Next by Date: Shorthand for MapThread
  • Previous by thread: Re: Non-deterministic numerical inaccuracies in Mathematica 7
  • Next by thread: Shorthand for MapThread