MATLAB/Sound/Emergence of beats
Appearance
< MATLAB
clc; clear all; close all; % Most sound cards support sample rates between approximately 5,000 and 48,000 % hertz. Specifying sample rates outside this range can produce unexpected results. dt=1/8192; %is Matlab's default sampling rate (period) dur=15; %sets how long each note should be played t = [0:dt:dur]; %sets the timeframe for a single note f0=200;omega0=2*pi*f0; %Sets the fundamental frequency a=.0001*dur; y1=sin(omega0*t); y2 =sin(omega0*(1+a.*t).*t); soundsc(y1+y2);