Write and play audio file

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 comentarios

Kevin Chng
Kevin Chng el 11 de Sept. de 2018
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
John Hock
John Hock el 12 de Sept. de 2018
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 el 12 de Sept. de 2018
resample(YourSignal, 4, 1)
is the easiest approach.

Iniciar sesión para comentar.

Respuestas (1)

Kevin Chng
Kevin Chng el 14 de Sept. de 2018

0 votos

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)

Categorías

Más información sobre Audio I/O and Waveform Generation en Centro de ayuda y File Exchange.

Productos

Versión

R2013a

Etiquetas

Preguntada:

el 10 de Sept. de 2018

Respondida:

el 14 de Sept. de 2018

Community Treasure Hunt

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

Start Hunting!

Translated by