List WAV file attributes without audioread
Show older comments
Hi all,
I have a large data set of wav files (each file is sampled at 500kHz on 4 channels) and I need to create a table with the filename and duration (as well as some other data which is extracted fromt he file name). I am able to do this with audio read but it takes such a long time to load in each file. Is there anyway to extract the file name and duration from windows explore for example? Or are there any other functions that could do this without loading in everyfile like audioread does? Or even any way of speeding up audio read, for example only loading in one channel rather than all four?
Thanks in advance! :)
Thomas
3 Comments
Mathieu NOE
on 13 Jan 2021
hello
if you know the sampling freq nad the resolution, you can estimate the duration by the size of the file
you can access this info by doing this : (example with 5 files in this directory)
s = dir('*.wav')
s =
5×1 struct array with fields:
name
folder
date
bytes
isdir
datenum
>> s.bytes
ans =
1536256
ans =
1536256
ans =
1536256
ans =
5300900
ans =
5322284
Mathieu NOE
on 13 Jan 2021
just remembered that there is a better way ! just do this inside a loop and you're done
info = audioinfo(filename)
info =
struct with fields:
Filename: 'C:\Temp\handel.wav'
CompressionMethod: 'Uncompressed'
NumChannels: 1
SampleRate: 8192
TotalSamples: 73113
Duration: 8.9249
Title: []
Comment: []
Artist: []
BitsPerSample: 16
Thomas Webber
on 15 Jan 2021
Accepted Answer
More Answers (0)
Categories
Find more on Audio and Video Data in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!