Show the Code
music <-
Music() +
Meter(4, 4) +
Line(c("C5", "D5", "E5", "F5"))
show(music)
January 23, 2025
March 4, 2026
So we understand the Fourier Transform: we can express any waveform as a sum of sinusoids that are appropriately weighted and are at discrete multiples of a chosen “fundamental frequency”.
How do we use these ideas to synthesize sound?
TO BE ADDED (sic!)
First we need to get used to the idea of an oscillator.
An oscillator is a source: it generates waveforms that we perceive as sound. Let us play with a few oscillator types here:
https://musiclab.chromeexperiments.com/Oscillators/
Each of these waveforms, by the Fourier series, is the sum of an ( infinite) number of sine wave outputs.
In Fourier series, we normally use just sine wave oscillators, and use many of them to add up to obtain the wave form we need. Now let us hear from Mr Shiffman again:
In general, we can write a sum of sine/cos waves as:
\[ g(t) = \large{a_0 + \sum_{k=1}^{\infty} \Bigg[ a_k*sin(k* 2\pi *f *t) + b_k*cos(k* 2\pi *f *t) \Bigg]} \tag{1}\]
\(g(t)\) is the desired time-waveform, \(\omega = 2\pi\times f\) is the fundamental frequency in radians/sec, and the \(a_k\) and \(b_k\) are weights for the individual components that are to be designed.
How does this look like? Mr. Shiffman again:
Now let us see how we can design something using the Additive Method.
How do we do this with intent? We will follow the development in Farnell and Risset and Mathews, (Risset and Mathews 1969) and Moorer.
ADSR stands for “Attack Decay Sustain Release”. These related to the way a note of music varies over time in a typical piece of music.
When different instruments play the same note, we always know that they sound different. It is impossible to mistake a violin for a flute or saxophone for a piano! So how does this work?
Each musical instrument has a characteristic set of frequencies (harmonics and in-harmonics) that it generates when a specific note is played. Think of this a an audio signature. These drop off in amplitude over frequency and are a function of the structure, resonances, and even playing technique ( e.g. bowing of a violin) of the intstrument.
Another way to view the multiple spectral components of a musical sound is using a spectrogram: https://musiclab.chromeexperiments.com/Spectrogram
music <-
Music() +
Meter(4, 4) +
Line(c("C5", "D5", "E5", "F5"))
show(music)
controllably synthesize in p5.js using the p5.sound librarygm: the grammar of Music. https://cran.r-project.org/web/packages/gm/vignettes/gm.html
| Package | Version | Citation |
|---|---|---|
| gm | 2.0.0 | Mao (2024) |
@online{2025,
author = {},
title = {Additive {Sound} {Synthesis}},
date = {2025-01-23},
url = {https://mathforcoders.netlify.app/content/courses/MathModelsDesign/Modules/35-Media/50-AdditiveSynth/},
langid = {en}
}