How to generate a song on Matlab?
조회 수: 53 (최근 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!