How to generate a song on Matlab?
49 次查看(过去 30 天)
显示 更早的评论
I have to make a song on Matlab and then set up sine waves that correspond to the notes on the scale. The notes are CFDGCEAmCFGC. can someone help me with this?
0 个评论
采纳的回答
David Barry
2016-12-19
Here's an example to get you started. 5 seconds of middle C.
fs = 1e4; % sampling frequency
t = 1:1/fs:5; % time signal
freq = 261.6; % note frequency in Hz (middle C)
y = sin(2*pi*freq*t); % create sine wave
player = audioplayer(y, fs); % create audio player object
play(player); % play the sound
更多回答(2 个)
zeeshan ali
2020-3-1
fs = 1e4; % sampling frequency
t = 1:1/fs:5; % time signal
freq = 261.6; % note frequency in Hz (middle C)
y = sin(2*pi*freq*t); % create sine wave
player = audioplayer(y, fs); % create audio player object
play(player); % play the sound
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Audio I/O and Waveform Generation 的更多信息
产品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!