Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dfischer/006c870d6944167e8cf9f496bbc4db0b to your computer and use it in GitHub Desktop.
Save dfischer/006c870d6944167e8cf9f496bbc4db0b to your computer and use it in GitHub Desktop.
An empirical example demonstrating the use of harmonics to generate music from noise
/**
How to Emperically measure the Quality of Music,
or Applying Harmonics to Non-Musical Source to Produce a Musical Signal
When people ask for empirical evidence that Harmonic Theory works,
we must first agree on a method to measure the "musicality" of a signal.
Generally we can agree that a pure White Noise signal (even distribution of frequencies across the given range in Hertz) is not musical. In the domain of sound, it is the antithesis of music because there is no discrete rhythmic structure and no discrete harmonic structure (example 1)
The same may be said for any type of constant noise, with some argument being made for harmonic favoritism for noises and how their frequencies distributed.
To make any noise signal musical:
Choose one arbitrary root value in hz
Then select some harmonics at random
And apply a bandstop filter to the noise at those selections.
You will get a new signal that begins to have musical quality.
(example 2)
For more still musical results using only harmonics:
Filter the selected harmonics to only values which are prime numbers less than 8.
(example 3)
*/
(
var root = 500;
SynthDef(\noise, { Out.ar(0, WhiteNoise.ar * Env.perc.ar!2) }).add;
SynthDef(\monic_noise, {|root, monic| Out.ar(0, BPF.ar(WhiteNoise.ar, root * monic, rq: 1/4, mul: 4) * Env.perc.ar!2) }).add;
TempoClock.tempo = 4;
// Example 1
// Pbind(\instrument, \noise, \dur, 1).play;
// Example 2
// Pbind(\instrument, \monic_noise, \dur, 1, \root, root, \monic, Prand((1..16), inf)).play;
// Example 3
// Pbind(\instrument, \monic_noise, \dur, 1, \root, root, \monic, Prand([2,3,5,7], inf)).play;
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment