This shows you the differences between two versions of the page.
| Both sides previous revision Previous revision Next revision | Previous revision | ||
|
vpde_lecture35 [2020/04/23 08:26] trinh |
vpde_lecture35 [2020/04/27 17:40] (current) trinh |
||
|---|---|---|---|
| Line 1: | Line 1: | ||
| ====== Lecture 35: Maths of music II ====== | ====== Lecture 35: Maths of music II ====== | ||
| + | |||
| + | < | ||
| + | <iframe width=" | ||
| + | </ | ||
| I don't want to dwell on the details of how the fft command works but it is enough to talk about analogies. Suppose we give you an $N$ vector $f_n$ with elements $n = 0, 1, 2, \ldots N-1$ that represents the signal we want to process. | I don't want to dwell on the details of how the fft command works but it is enough to talk about analogies. Suppose we give you an $N$ vector $f_n$ with elements $n = 0, 1, 2, \ldots N-1$ that represents the signal we want to process. | ||
| Line 39: | Line 43: | ||
| The rest is about more fun stuff. | The rest is about more fun stuff. | ||
| - | ===== Real sounds from instruments ===== | + | ===== Pitch modification |
| - | + | ||
| - | ===== Tuning music and beats ===== | + | |
| < | < | ||
| Line 60: | Line 62: | ||
| % sampling frequency. This is a cheap way of modifying pitch. | % sampling frequency. This is a cheap way of modifying pitch. | ||
| sound(fA, 659.3/ | sound(fA, 659.3/ | ||
| + | </ | ||
| + | |||
| + | ===== Tuning an instrument ===== | ||
| + | |||
| + | < | ||
| + | % Example of tuning | ||
| + | Fs = 2^13; T = 8; | ||
| + | t = 0:1/Fs:T; | ||
| + | |||
| + | % This is how tuning works. Play a 440Hz note with an off-tune 442Hz note | ||
| + | % signal | ||
| + | f = sin(2*pi*440*t) + sin(2*pi*442*t); | ||
| + | sound(f, Fs) | ||
| + | |||
| + | %% | ||
| + | |||
| + | % This is easy to show mathematically. When you add two sine waves together | ||
| + | % that differ very slightly in frequency, it gives a beating pattern | ||
| + | plot(t, f) | ||
| </ | </ | ||