How do I get valuables from audioinfo
Show older comments
Hello everyone. I need help about auidoinfo. I want to use audioinfo valuables as veriables. For example I want to get BitsPerSample or NumChannels as veriable because I will make if else about that. For example I want to make 16 BitsPerSample if my file has 24 BitsPerSample or change samplerate. Thank you for helping.
Answers (1)
The audioinfo function returns a structure, so refer to its fields —
load handel.mat
filename = 'C:\Temp\handel.wav';
audiowrite(filename,y,Fs);
clear y Fs
info = audioinfo(filename);
BPS = info.BitsPerSample
Consult the documentation for audiowrite to understand how to save the file with the chosen changed parameters.
(This code uses code from the audioinfo documentation page to create the file.)
.
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!