Currently I am trying to write a program to create harmony. From an input wav file (human voice) , I used some signal processing to get tempo and pitch. My next step is to create harmony based on the tempo and pitches.

The pitches is a list of float numbers. The tempo is a list of time in seconds.

I have no knowledge in music, I just want to create a very simply harmony to make the music nicer. To do that, I want to know how pitches and tempo are related to harmony.

Thank you in advance.

Linked Question: https://stackoverflow.com/questions/19151170/questions-about-approach-for-background-music-generation-for-songs

  • 2
    This is a huge question. You'll have to learn a lot of theory. This article will help you convert your list of floats to a list of notes en.wikipedia.org/wiki/Pitch_(music) . To find the fitting chords you'll have to learn some music theory. If this is an open source project i'd be interested in contributing. I've been wanting to start such a project for a while, but it's a bit difficult I think.
    – Anthony
    Oct 29, 2013 at 14:45
  • As Anthony said, this will take a lot of music theory. ---- I would also be interested in helping out; musical programs are my favorite, since they combine my two favorite past-times! I'll look forward to more on this project... Oct 30, 2013 at 3:52

2 Answers 2


First, you need to translate your list of pitches into frequencies in hertz. This is the basis of what you need for a harmony. Doubling the frequency puts the note up an octave and halving it lowers it an octave.

Playing bot the original tone and your upper/lower octaver will give you a primative pitch shifter kind of sound like this track uses an octave pitch shifter

to do something more advanced, you'll need to find out the equation to get a perfect 5th, major 2nd etc from your fundamental pitch. Beyond this you start to run into problems...

The Problem The problem here, is that the basic major scale harmonised is not equal, and by that I mean if you were to play each note and the 3rd above it you would get the intervals of: major 3rd, minor 3rd, minor 3rd, major 3rd, major 3rd, minor 3rd, minor 3rd, then up to the next note.

In order to make an adaptive harmony you must also assume that the inputted pitches make a major(for example) scale, and then that you are in perfect pitch(though you could adjust how accurate the singer has to be).

If the intent is to make a cool little pitch shifting app, might I suggest juts buying a pitch shifter, or doing some research into vocoders and voice synthesis equipment. There's probably even a vst plugin somewhere for free that will do the job for you!

Hope that helped :)


Tempo, which is how slowly or quickly a piece of music is played, will have no relation to any harmony. This should make your job a little easier.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.