0

I've been doing research on trying to understand the way sounds and sine waves work, particularly with chords. So far, my understanding is as follows:

1) b(t) = sin(Api(t)) is the base note of the chord at frequency A.
2) T(t) = sin(5/4piA(t)) is the major third of the base b(t).
3) D(t) = sin(3/2piA(t)) is the dominant (fifth) of the base b(t).
4) A(t) = sin(2Api(t)) is the octave.

Each one alone is a separate frequency which is easy for a computer generator to sound. However, the major chord of the note with frequency A is as follows:

Major Chord = b+T+D+A

I was wondering if anyone has a way to make a computer synthesizer play this function so I can hear the result; most programs I have found only take Hz as an input, an while this function has a wavelength, it's different from the simple sine wave with the same wavelength.

Note: will post this in the physics and music sections as well - just wondering if you computer scientists know something about this.

  • This question appears to be off-topic because it is about music algorythms, rather than programming, and was cross-posted here: http://stackoverflow.com/questions/26334531/science-of-chords – Andrew Barber Oct 13 '14 at 15:12

1 Answers1

2

You just need to scale the function so that the root of the chord is at the desired frequency. For example, the root frequency of the A in an A major chord is at 440Hz. Therefore the 3rd, 5th and octave would be at 440*5/4, 440*3/2 and 440*2, respectively.

To generate the sounds on the computer, the first thing your going to need to do is convert the functions from continuous time to discrete time and from continuous level to a quantized level. There are a lot of good references on the internet about this topic.

The continuous time version of a sine wave would be something like

y = ampl * sin(2 * pi * freq)

The discrete time version would like this:

y[n] = ampl * sin(2 * pi * freq / sampleRate)

where n is a sample number and sampleRate is the number of divisions of a second.

Then components of the major chord would be constructed in the following manner:

root[n]   = ampl * sin(2 * pi * freq / sampleRate)
third[n]  = ampl * sin(2 * pi * freq * (5/4) / sampleRate)
fifth[n]  = ampl * sin(2 * pi * freq * (3/2) / sampleRate)
octave[n] = ampl * sin(2 * pi * freq * 2 / sampleRate)
jaket
  • 9,140
  • 2
  • 25
  • 44