Write and play audio file

조회 수: 11 (최근 30일)
John Hock
John Hock 2018년 9월 10일
답변: Kevin Chng 2018년 9월 14일
Hi everyone I have some data and i am creating the audio file of that data using audiowrite command with the sampling frequency of 256 Hz.but when i try to play back the same audio file again it starts giving error of invalid sample rate. Will anyone please help how to resolve this issue Thanks
  댓글 수: 3
John Hock
John Hock 2018년 9월 12일
Thanks @Kevin Now i want to re sample my data from 256 to 1024 hz using interpolation.Will you please help me in this regard
Walter Roberson
Walter Roberson 2018년 9월 12일
resample(YourSignal, 4, 1)
is the easiest approach.

댓글을 달려면 로그인하십시오.

답변 (1개)

Kevin Chng
Kevin Chng 2018년 9월 14일
Hi John Hock,
You may refer to the link below to check what is the minimum Hz can be play in your system or copy the code to test your system.
foo = rand(1,1000);
for r = 80:8000; try sound(foo,r); fprintf('\nOk at %d!\n', r); break; catch ME; if mod(r,100)==0; fprintf('%d...', r); end; end; end
In my system, it allow 1000 minimum to play audio.
You may refer the discussion below in stockoverflow
How to resample your data?
Answer from Walter Roberson,
resample(YourSignal, 4, 1)

카테고리

Help CenterFile Exchange에서 Audio I/O and Waveform Generation에 대해 자세히 알아보기

제품


릴리스

R2013a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by