- 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.
1 次查看(过去 30 天)
显示 更早的评论
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 个评论
Divya Gaddipati
2019-12-4
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?
回答(1 个)
Divya Gaddipati
2020-1-6
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 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Audio and Video Data 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!