[PD] equal tempered scale object available

Mathieu Bouchard matju at sympatico.ca
Thu Nov 25 13:47:12 CET 2004

On Thu, 25 Nov 2004, Niklas Saers wrote:

> I'm relatively new to the Pd community so I'm not quite sure where
> would be a good place to announce this, so I guessed that this would
> be a good place: I have written an external object that takes a float
> with amount of Hz a sound is and determines the note of this tone.
> I.e, 440 is A, 415 is a 1¢ low Ab with a 0.174 Hz error (thus not
> quite as low as 1¢, but almost 1¢).

Candid question: what's the advantage of that over the builtin [mtof]

Then it's easy to postprocess the result of mtof to split it into:

1. an octave number (integer)
2. a note number (integer from 0 to 11 incl)
3. a cent offset (-50 to 50 excl)

[expr int($f1+0.5); $f1-int($f1+0.5)]
 |                                 |
[expr int($f1/12); $f1%12]         |
 |                      |          |
(octave)              (note)     (cents)

(caveat: ideally, % and int would be replaced by mod and floor, but the
latter aren't in pd afaik)

Mathieu Bouchard -=- Montréal QC Canada -=- http://artengine.ca/matju

More information about the Pd-list mailing list