music piece with matlab
6 ビュー (過去 30 日間)
表示 古いコメント
do you know how to create a discrete time signal with musical notes having a sampling rate of 8000 samples per second?
0 件のコメント
回答 (2 件)
Geoff Hayes
2022 年 4 月 4 日
@Giovanni Scamardo - from https://www.mathworks.com/matlabcentral/answers/335544-matlab-play-notes-for-different-duration-s-as-specified-by, you could do something similar to
fs = 8000;
t1 = 0:1/fs:0.3;
t2 = 0:1/fs:0.6;
t3 = 0:1/fs:0.9;
C2 = 65.4064;
D2 = 73.4162;
F2 = 87.3071;
ft = [t1*C2 t2*D2 t3*F2];
Y = sin(2*pi*ft);
player = audioplayer(Y,fs);
playblocking(player);
0 件のコメント
Star Strider
2022 年 4 月 4 日
Another approach —
A4 = 440;
A5 = 880;
Notes = A4*2^(1/12).^linspace(0, 11, 12); % Note Frequencies
Fs = 8000; % Sampling Frequency
t = linspace(0, Fs-1, Fs)/Fs; % Time Vector
NotesMatrix = sin(2*pi*t(:)*Notes); % Matrix Of One-Second Notes
for k = 1:size(NotesMatrix,2)
soundsc( NotesMatrix(:,k), Fs)
pause(1.1)
end
.
0 件のコメント
参考
カテゴリ
Find more on Audio Plugin Creation and Hosting in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!