How to play a variation of frequency?

4 visualizaciones (últimos 30 días)
jérôme TAÏEB
jérôme TAÏEB el 29 de Sept. de 2018
Comentada: Walter Roberson el 3 de Oct. de 2018
Hi,
1)Starting from a pure wave of a given frequency (4000 Hz) I can not implement this pseudo code to play a sound (pure wave) whose frequency decreases continuously from 4000 to 200:
demo matlab
t = (0:0.001:100)';
for n = 4000:-1:200
y = sin(2*pi*n*t)
sound(y,Fs);
end
How to implement this correctly?
2)same question but starting from an very short audio file or an sound sample
thanks
  3 comentarios
jérôme TAÏEB
jérôme TAÏEB el 2 de Oct. de 2018
Editada: Walter Roberson el 3 de Oct. de 2018
corrected script:
t=0:0.001:100;
for n=200:1:4000
y=sin(2*pi*n*t);
sound(y,n);
end
Now:
How to create in format.wav the obtained result by adding and scripting ?
thanks
Walter Roberson
Walter Roberson el 3 de Oct. de 2018
That code changes frequency in two different ways simultaneously. You should not do that. Either change the n used in the construction of y or else change the frequency used for playback, but do not do both.
Hint: changing the n used in the construction of y is much easier to put together into a single .wav file than if you change the playback frequency.

Iniciar sesión para comentar.

Respuestas (0)

Categorías

Más información sobre Audio I/O and Waveform Generation en Help Center y File Exchange.

Etiquetas

Productos


Versión

R2018b

Community Treasure Hunt

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

Start Hunting!

Translated by