Detect Number of Pitches

Namfon.Natcha's icon

Hi. I am completely new to the software.

Is there a way to detect how many pitches are being played simultaneously?
The number of pitches would not be more than 4.

Thank you in advance for your kind answer!

Source Audio's icon

If you want any help than make the question understandable.
Are you talking about midi notes or audio voices ?

Namfon.Natcha's icon

Sorry for that I am unclear. I am talking about audio voices.
i.e. 4 horns play 4 different pitches at the same time and I want the program to detect that there are 4 pitches.

Max Gardener's icon

A hint as to the difficulty of your problem is suggested by how much money Melodyne wants for the version of their software that does polyphonic pitch detection. :-)

Roman Thilenius's icon


fiddle~ always supported 4 voices. but it is not melodyne. in fact it is close to conicidence if it actually detects the pitch of one voice from time to time.

Max Gardener's icon

Right, Roman. In my experience, fiddle~ (and sigmund~ to a lesser extent) both don't really do their best unless they're given audio filtered closely to the pitch range you want to detect. I've never had much success with multiple voices with anything other than sine waves. Other people may be had different experiences.

Roman Thilenius's icon


a bandpassfilter is aways a good idea for fiddle. a peak clipper and a noise gate are, too.

otoh that is so complicated to build all of that youself, you could as well write your own pitch detector using pfft.

and one problem always remains: the nominal pitch of a sound might not be the loudest partial in a recording of like every second or so acoustic instrument.

overblown saxophone? not a chance.

Roman Thilenius's icon


now that the have ceased making a VST plug-in we need a melodyne max external more than ever. ;)

Namfon.Natcha's icon

Thank you very much for your replies! I will try them out. :)

Source Audio's icon

Did not try myself, but chordid~ external which is
chord detector is also targeting poly pitch detection.

https://github.com/scblakely/chordid
more links:
https://cycling74.com/forums/some-utility-externals-rubberband-noteid-chordid/
Mac Version :
https://github.com/carthach/chordid

Simon Blakely's icon

ChordID specifically identifies chords, and not notes.

Something I have been meaning to do is to build an object that just implements the Constant-Q Discrete Fourier Transform used in ChordID - i.e for 8192 (I think) audio samples in, outputs a vector of note energies from low to high.

You can then select the four highest values for what I would hope would be the four primary notes being played.

Source Audio's icon

I mentioned it as a test - how good is actually polypitch detection in chordid ?
Did I misunderstand the 4th outlet?
States list of notes in a chord ?
For test it should be enough.
I mean only problem would be if that 4 pitches
are not detected as a chord, but at least one could decide
if chordid comes in question as
polypitch detector ...


Roman Thilenius's icon


if you dont need onset detection, a "chord" and "three notes" is basically the same. ;)

Simon Blakely's icon

chordid~ compares the *chromagram* (ie a graph of relative pitch strength) against a list of valid three or four note chords to determine the best possible match. The list of matches only contains common chords and doesn't output an arbitrary list of notes.

From research I did at the time, there are about 500 possible 3, 4 and 5 note chords, and chordid can classify about 120 of those. It probably won't keep up if you play jazz.

I'll look at either outputting the raw chromagram, or the output of the DFT as a vector. I have some vacation time coming up, so I'll try to relearn Visual Studio...

Simon Blakely's icon

Just to add to this thread - I have been reworking chordid~, and one of the outlets now outputs a filtered chromagram. This is a list of the relative strength of the notes being played (from C to B).

Because the filter discards the noise floor, you can easily count the number of simultaneous different notes being played, even if they do not form a recognizable chord (which is the original purpose of chordid~).

I'll still provide an external to output the entire DFT in the future.

I can at least re-compile the external, which is progress.