When I'm trying to do Discrete Fourier Transform or just get a ListPlot of values from Sound object, I get error message.. I understand that Fourier command (and ListPlot of course) works only with lists. May be there is some command to extract values from Sound/Audio/Image object so further I could apply DFT?

p.s.: it's interestingly though that similar transforms like Wavelet could be applied directly on image or sound samples...

Thanks in advance!

  • 1
    $\begingroup$ Could you make a MWE of what you tried? $\endgroup$
    – Nasser
    Commented Jun 7, 2023 at 11:07
  • $\begingroup$ I'd like to apply Fourier to an image as easyly as ImagePeriodogram can be applied :) But it's occured to me just now that we can use Sqrt@ImagePeriodogram, so we can get magnitude of Fourier spectrum :) Periodogram is just an modulus of Fourier squared, isn't it?! $\endgroup$ Commented Jun 14, 2023 at 11:16

1 Answer 1


If you already, have Audio or lists of samples, then the answer is simple. For Sound objects, you should convert them to Audio first.

music = Sound@SoundNote["A", 1.25, "Violin"]

(* Convert it to Audio *)
asaudio = Audio[music];

(* You can call Periodogram directly on audio without needing a list of samples *)
Periodogram[asaudio, ScalingFunctions -> "dB"]

(* ... and spectrogram *)

(* ... and you get get data from the periodogram / spectrogram directly too *)
periodogramData = PeriodogramArray[asaudio]
spectrogramData = SpectrogramArray[asaudio];

(* You can get the sample rate and the samples like this *)
rate = AudioSampleRate[asaudio];
data = AudioData[asaudio];

(* and do your own DFT (note data can be stereo so I choose the first channel here) *)
channel1 = data[[1]];
four = Fourier[channel1];
powerSpectrumInDecibels = 20 Log10[Abs[four[[1 ;; Length[four]/2]]]];
  • $\begingroup$ Thank u, it's very useful! Especially the use of AudioData in order to extract data (list of values) from Audio object. As far as I understand, we can analogously use ImageData to extract data from an Image. Concerning Fourier command, it's still seems pretty inconvinient and even strange that we cannot apply Fourier directly on a image/Audio, but similar commands like Periodogramm, Spectrogramm, Wavelet can be apllied... I'm telling that because I use another (more automized) ImageJ program. So I'd like to compare Wolfram results and ImageJ ones. $\endgroup$ Commented Jun 14, 2023 at 10:58
  • $\begingroup$ By the way, Spectrogramm/Periodogram can be applied on Sound object as well as on Audio object :) $\endgroup$ Commented Jun 14, 2023 at 11:10
  • $\begingroup$ @shamilkhal I didn't know that. I guess that makes it really easy then. $\endgroup$
    – flinty
    Commented Jun 14, 2023 at 14:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.