Choose frequency to plot and create sound
Mostrar comentarios más antiguos
I have the variable k, which is equal to n*pi (n = 1,2,3,4,5,6). Is there any way to have all the values of k and choose every time one of them to plot and create sound of sin(k).
Respuestas (1)
Star Strider
el 24 de Feb. de 2023
Editada: Star Strider
el 24 de Feb. de 2023
These frequencies are going to be too low to hear, so consider multiplying them by perhaps 100 in the sound call.
Fs = 44100; % Sampling Frequency (Hz)
Tlen = 10; % Signal Length (sec)
t = linspace(0, Tlen*Fs, Tlen*Fs+1)/Fs;
freq = pi*(1:6);
for k = 1:numel(freq)
chooseFreq = randi(numel(freq))
sv(:,k) = sin(t*freq(chooseFreq)).';
% sound(sv(:,k),Fs)
% pause(Tlen)
figure
plot(t, sv(:,k))
xlim([0 5])
title(sprintf('Frequency = %.2f',freq(chooseFreq)))
end
EDIT — (24 Feb 2023 at 23:34)
.
Categorías
Más información sobre Audio and Video Data en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!




