Trinh @ Bath

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision Both sides next revision
vpde_lecture35 [2020/04/23 08:16]
trinh
vpde_lecture35 [2020/04/23 08:26]
trinh
Line 35: Line 35:
 This is what the above code does. It takes the Fourier transform (or Fourier series) of f, then plots the amplitudes. The funny code around it is because Matlab places the Fourier transform coefficients in a 'deranged' fashion.  This is what the above code does. It takes the Fourier transform (or Fourier series) of f, then plots the amplitudes. The funny code around it is because Matlab places the Fourier transform coefficients in a 'deranged' fashion. 
  
-===== Real sounds =====+That's a lot to take in. You do not have to understand this theory on fft beyond the basic understanding we presented in Lecture 34. 
  
-That's a lot to take in. The rest is about more fun stuff. +The rest is about more fun stuff. 
  
 +===== Real sounds from instruments =====
 +
 +===== Tuning music and beats =====
 +
 +<Code:Matlab linenums:1 | Pitch>
 +% Example of pitch modification
 +Fs = 2^13; T = 5;
 +t = 0:1/Fs:T;
 +
 +% This is an A note of 440 Hz
 +fA = sin(2*pi*440*t);
 +sound(fA, Fs)
 +
 +%% This is an E note of 659.3 Hz
 +fE = sin(2*pi*659.3*t);
 +sound(fE, Fs)
 +
 +%% We can make our A note sound like an E note
 +%  by essentially changing our definition of 'time' or changing the
 +%  sampling frequency. This is a cheap way of modifying pitch.
 +sound(fA, 659.3/440*Fs)
 +</Code>