MATLAB: How to generate a song on Matlab

MATLABmusicsine wavessong making

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?

Best Answer

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