How to resample multiple sampling frequencies within a large dataset?
Show older comments
Good day
I have a data set of 920 audio samples, 96 of these audio samples are recorded at a different sampling rate and are spreaded throughout the data set. I want to code a loop to single out the 96 audio samples and resample them from 4000 Hz to 41000 Hz. I have written code to do it for a single sample, but can not seem to implement over the whole data set.
%%Resampling code
[X, Fs]=audioread('104_1b1_Al_sc_Litt3200.wav');
[P,Q]=rat(41000./Fs);
Xn = resample(X,P,Q);
%%The following code is the loop that runs through my entire data set
myFolder = 'C:\Users\Ré van Zyl\Downloads\ICBHI_final_database\All';
if exist(myFolder, 'dir') ~= 7
Message = sprintf('Error: The following folder does not exist:\n%s', myFolder);
uiwait(warndlg(Message));
return;
end
filePattern = fullfile(myFolder, '*.wav');
wavFiles = dir(filePattern);
for k = 1:length(wavFiles)
baseFileName = wavFiles(k).name;
fullFileName = fullfile(myFolder, baseFileName);
%%Insert code to resample sampling frequencies?
end
If anyone can help me in this regard it would be much appreciated. Or just let me know if it is possible to do something like this.
Kind regards Re
Accepted Answer
More Answers (0)
Categories
Find more on Audio Processing Algorithm Design 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!