audiowrite audio file create
이전 댓글 표시
I should create an audio file with audiowrite, to save the same sound I can hear with sound function. How should I set function parameters?
% code
load flux_adaptive_100
filename = 'flux_adaptive_100.wav';
audiowrite (filename,y,Fs);
clear y Fs
end
댓글 수: 10
Image Analyst
2015년 11월 26일
What parameters? You already have y and Fs when you played the sound in the sound function, and you're specifying the filename, so what additional parameters do you think you need for audiowrite()?
Marco Cornero
2015년 11월 26일
Geoff Hayes
2015년 11월 26일
편집: Geoff Hayes
2015년 11월 26일
You mention a two second file...is that the first two seconds, or last two, or is your audio data just two seconds in length?
If you want the first two seconds, then you would do something like
audiowrite (filename,y(1:2*Fs),Fs);
assuming Fs is the number of samples per second and 2*Fs is less than 200000.
Marco Cornero
2015년 11월 26일
Marco Cornero
2015년 11월 26일
Geoff Hayes
2015년 11월 26일
If Fs is 100000 and your y is of length 200000, then it is two seconds in length. So
audiowrite (filename,y,Fs);
is correct. Or are you saying that this doesn't work?
Marco Cornero
2015년 11월 26일
Geoff Hayes
2015년 11월 26일
Okay. What are the units of y? You mention how y is an array of doubles, so what is the minimum and what is the maximum? What happens when you read the flux_adaptive_100.wav back into MATLAB? Can you hear any audio once you start playing it? If not, then check the samples and compare to those that you saved to file (what is the minimum and what is the maximum?).
Marco Cornero
2015년 11월 26일
Marco Cornero
2015년 11월 26일
답변 (0개)
카테고리
도움말 센터 및 File Exchange에서 Audio I/O and Waveform Generation에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!