% % Example of tonal disconsonance and "beats" % duration = 30.0; sampling_freq = 8192; delta_t=1/sampling_freq; t = 0 : delta_t : duration; % The following is a 300 Hz harmonic, which is 'shaped' by % 2 Hz envelope. Modify both frequencies. signal = sin( 2*pi*300*t).*sin(2*pi*2*t); % This is the same as the signal % signal = .5*(cos( 2*pi*298*t)-cos(2*pi*302*t)); %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %% uncomment the following for nonstationary instantaneous phase %%% %% (be sure to comment out the earlier defn of 'signal' %%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % signal = sin( 2*pi*300*t).*sin(2*pi*2*t.^2.5); sound(signal, sampling_freq) plot(t, signal) % axis([0, 0.4, -1, 1]) % Estimate the frequency of the tone from the graph. % For the nonstationary signal, use various axes to % observe the values of the local frequency