How do I write a new wave file based on frame selected?
1 次查看(过去 30 天)
显示 更早的评论
Dear all, I am new to signal processing, and I am trying to write a new wave file using a segment I am selecting from a plot. Below is what I have so far, but I am stuck and don't know how to actually write a wave file. Please help!
%If you have not established a .wav file - do so! clear,clear all % comment this out if you are using the same file [filename, pathname]=uigetfile('*.wav', 'Select a wave file');% comment this out if you are using the same file [y, fs] = audioread(fullfile(pathname, filename));% comment this out if you are using the same file
%Next step is simple- do you want to hear your .wav file?
q3= input('Would you like to segment your .WAV file?(y/n)');
%at this point variable q1 will contain whatever answer the user puts in
if strcmpi(q3,'y')% this looks at the answer
t=0:1/fs:(length(wave)-1)/fs; % get sampling frq
plot(t,y);
figure(1);
plot(t,wave);
title('Wave File');
ylabel('Amplitude');
xlabel('Length (in seconds)');%plots a raw spectrogram of your data. This doesn't include much info, it's just for you to select point of time
disp('Now select your beginning');
[x1,y1]=ginput(1);% this is the point of time for your new segment
disp('Now select the end of your new segment');
[x2,y2]=ginput(1);
else
end
0 个评论
回答(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!