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 *)
Spectrogram[asaudio]
(* ... 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]]]];
ListPlot[powerSpectrum]