audio extraction from individual/selective data column.
Show older comments
Would be glad if someone could help me with this question.
In my 'data', there are two columns. I am trying to run the code below on only the second column and extract it's data to replace with the original data (with both coloumns).

If I just purely run the below code, the script will run on the first column,
how do I choose the second column, or insert data (:,end) to this working code?
[data,samp_rate] = audioread(Audio_files(p).name);
%% equations worked on the audio file and get s, the new starting point of the audio
startSample = s;
endSample = length(data);
extractedData = data(startSample:endSample);
extractedData(1:2*samp_rate ) = [];
audiowrite(Audio_files(p).name '.m4a', extractedData,samp_rate );
I tried inserting data(:,end) like how it is written below, but it aint working.
[data,samp_rate] = audioread(Audio_files(p).name);
%% equations worked on the audio file and get s, the new starting point of the audio
xdata = data(:,end) %choose the second column and save into xdata
startSample = s;
endSample = length(xdata);
extractedData = xdata(startSample:endSample);
extractedData(1:2*samp_rate ) = [];
audiowrite(Audio_files(p).name '.m4a', extractedData,samp_rate );
Accepted Answer
More Answers (0)
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!