length of audio sample

G
God'sSon · Dec 16, 2022 · 1.9K views
Question
hello!   I am trying to import an audio sample into matlab and get matlab to tell me the length of the sample. Please can someone help me with this ,
Expert Answer
Profile picture of Prashant Kumar
Prashant Kumar PhD Expert
Answered Sep 12, 2026

Just in case you got a wave file

[y, Fs, nbits] = wavread(filename) %load the wav
[m d] = wavfinfo(filename) %get the wav information

Another way to get the length in seconds is:

siz = wavread(filename,'size') %siz = [samples channels]
siz(1)/Fs %should give you the length in seconds

 

100% Run Guarantee 3-Hour Fast-Track Delivery

Need a Custom Version or Complete Simulation for This Problem?

Our 500+ PhD engineers build, debug, and optimize working MATLAB scripts and Simulink (.slx) models tailored to your exact assignment rubrics with zero plagiarism.

Tested on MATLAB R2024b / R2026a
Turnitin 0% Plagiarism Report
Free 7-Day Revisions Guarantee
Have a different question? Ask here

Get a Free Consultation or a Sample Assignment Review!