How do I measure the sample rate of an imported file in Mathematica?
I imported the WAV file:
solo = Import["solo.wav"]
When I wrote:
SampleRate[solo]
But I just need a number like 28.000
to be returned.
Mathematica Stack Exchange is a question and answer site for users of Wolfram Mathematica. It only takes a minute to sign up.
Sign up to join this communitysolo = Import[ "ExampleData/rule30.wav" ]
Cases[solo, (SampledSoundFunction | SampledSoundList)[__, r_] :> r, Infinity][[1]]
44100
One can also use Import[]
to directly query the *.wav file's sample rate, like so:
Import["ExampleData/rule30.wav", "SampleRate"]
44100
The sample rate is the second element in solo. The first element (i.e., solo[[1, 1]]) is the waveform data.
solo = Import["ExampleData/rule30.wav"];
solo[[1, 2]]
44100
QuantityMagnitude@AudioSampleRate@Audio@solo
(*44100*)