- p8-cut_1, p8-cut_2, p8-cut_3, p8-cut_4
- p9-cut_3
[Concatenating .wav files on the base of the values specified in a separate matrix.
3 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
I have several .wav files in a folder and I need to join them following the values specified in the columns of a matrix. This is a example of the matrix:
ID FileName Trial
1 p8-cut_1 1
1 p8-cut_2 1
1 p8-cut_3 1
1 p8-cut_4 1
1 p8-cut_5 2
1 p8-cut_6 2
2 p9-cut_1 1
2 p9-cut_2 1
2 p9-cut_3 2
And so on. Now I would need to join together the files with the same values on both ID and Trial columns (e.g the the first four files, than the next two, and so on...). Is there a way to do that? I didn't find nothing similar in previous threads.......
2 commentaires
Divya Gaddipati
le 4 Déc 2019
Can you elaborate which files you want to combine in the example that you have given?
The way I understand it is, you'll get two different files by combining in the following way
And discard the p8-cut_5, p8-cut_6, p9-cut_1, p9-cut_2 as ID and Trial of these are not same.
Is that right?
Réponses (1)
Divya Gaddipati
le 6 Jan 2020
You can concatenate wav files in the following way:
y_concat = [y1; y2];
As for checking if ID and Trial are same for the files, you would have to loop through all the files. Rough steps are provided below:
- Store the IDs and Trials in two variables, ID and Trial for example.
- Create an empty cell matrix where you want to store the concatenated wav files.
y_concat = {};
for i = 1 : length(num_files) % num_files = total number of files
[y1, Fs] = audioread(filename{i});
y_concat{ID(i), Trial(i)} = [y_concat{ID(i); Trial(i)}; y1];
end
Hope this helps!
0 commentaires
Voir également
Catégories
En savoir plus sur Audio and Video Data dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!