How to design a frequency quantizer ?

Julien Bayle's icon

Hi,

we are trying to design a frequency quantizer which would take a frequency (Hz, no midi pitch) as input and outputs a quantized frequency depending on an unequal temperament scale (ratios list).

We are more looking for a formula than a lookup table.

Roman Thilenius's icon


do it on linear level? ftom~ *~ /~ mtof~?

Julien Bayle's icon

Hi Roman, this is what we did, but we wanted to do this for unequal temperament, and maybe for more than 12 steps (semi-tones). But actually, ftom/mtof can calculate micro-tonal, as far as we saw, as they gives pitches as floats when it is occuring.

Roman Thilenius's icon


eh, for all my own weird designs i missed that "ratios" is done to Hz (and not with linear).

well, i dont know, what about this:

- split signal into octaves
- use trunc~ to create the number of keys per octave you need
- now calculate the offset from your arbitrary scale to the ET scale and "correct it"; everything but the +~ could be done at data rate.

your input is eT, right? or also random.

Roman Thilenius's icon

nah that still does not solve the unknown number of keys issue. poly~/mc?

Julien Bayle's icon

We went FAR with mc, yes. Especially for the resynthesis part.
But for the quantizer, we do only equal temperament at the moment.

Roman Thilenius's icon


this is basically how i´d do it for data rate, too.

take your alternate scale, transform to [ftom 0.], get difference to eT (aka integer numbers) and add it to the key´s values of 0. - 11.

should be quite possible polyfy or mcfy it.

Roman Thilenius's icon


you can now drive that further and do it to the whole spectrum by using >=0. && <1. for the "route". (i´d use [110.split~]. )

but first decide what you want portamento to actually do. ;)

Julien Bayle's icon

thanks a lot Roman, we'll have a look at it asap

vojko v's icon

could the new [stash~] object be the answer? or something in gen codebox that would compare the given input to all the values in the list and return the nearest?

vojko v's icon

it's a bit clunky but it seems to do the job

Max Patch
Copy patch and select New From Clipboard in Max.