- 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!