Create a time delayed cosine function
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
I have a signal that I'm trying to output as sound that looks like this
ts=0.0001; %sampling rate
n=[0:1057]; %number of samples
t7=4.26:ts:5; %time in seconds to play
c4=261.626; %note frequencey
ynote7=cos(2*pi*c4*t7); %cosine function
sound(ynote4,1/ts,16) %plays the sound from 4.26 sec to 5 sec
but the note plays immediately with no time delay, and I have no clue what I'm doing wrong with this
0 comentarios
Respuestas (1)
Kai Domhardt
el 8 de Feb. de 2018
Editada: Kai Domhardt
el 8 de Feb. de 2018
Your signal starts with the cosine wave, you will need to define the signal for 0 sec to 4.26 sec.
ts=0.0001;
freq = 261.626;
amp = 0.1; %in case somebody tries this without checking their speakers.
empty_signal = zeros(1,5/ts)
sound_signal = cos( linspace( 0, 2*pi*freq, (5-4.26)/ts ));
delayed_signal( end-length(signal)+1 : end ) = sound_signal;
sound(delayed_signal * amp, 1/ts)
Ver también
Categorías
Más información sobre Discrete Fourier and Cosine Transforms en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!