Pitch Quant 1-to-1

An improvement to Digilog Pitch Quant's algorithm

(3 Votes)
1.04 (Updated 4 years ago)
November 22, 2018
Reaktor 6


This is my first offering to the UL. Pitch Quant BitShift 1:1. It’s just a pitch-quant block, and a remake at that.
But after 6 months of banging my head on a Reaktor, I wanted to have something to offer that required at least a little programming.

This very modest upgrade (I hope it’s an upgrade) is of course based on the Reaktor block, Digilog Pitch Quant (DPQ).
If you need straightforward, 1-to-1 pitch quantization, and you want to save retrievable snapshots, this might be your ticket.

It’s should be fundamental to pitch quantization that if an incoming pitch is among your selected pitches, then you should hear that as output pitch, not another pitch that’s close to it. Only incoming pitches that are outside the selection should get changed. The “1:1” algorithm, borrowed from a hidden macro in the Kodiak Shift Sequencer, guarantees this. If an incoming pitch is NOT among those you selected, you should get the closest one, measured from the selected pitches, to the incoming pitch.

But that’s not what the original DPQ does, in many cases. It always provides an output pitch within the selection; but it can and will change incoming pitches that are in the selection to OTHER pitches in the selection.

Details: The ‘right’ way to do this (easy using standard programming languages) amounts to setting a single, uniquely positioned, bit ON for each pitch in your selection, and combining these into a 12-bit integer that represents, together, all the selected pitches. What?
(We’re talking binary math here. So bit-shifting is all about powers of 2.)
We can notate our 12 equal-tempered pitches starting at C (pos=0) and going up to B (pos=11).
Then C is designated by 2⁰ = 1; C# by 2¹ = 2; D by 2² = 4; D# by 2³ = 8; etc. up to B, 2¹¹ = 2048.

If you select, say, C, D, E, F, G, the composite integer value is: 1 + 4 + 16 + 32 + 128 = 181.
If you select all 12 pitches the composite integer value is: 1 + 2 + 4 + 8 + 16 + 32 + 64 + 128 + 256 + 512 + 1024 + 2048 = 4095.

The 1-to-1algorithm chooses an output pitch by testing the incoming pitch’s bit-shift value, see above, against the selection-composite integer using logical AND. If the result is TRUE, output the incoming pitch. If FALSE, output the closest pitch from within the selection. That’s all! (If you want to know how the latter aspect is achieved, look inside the macro sequence: Process -> Quantize -> Pitch -> Pitch Quant -> array makers -> distribute range. The Kodiak programmers did a nice job of documenting their code too!)

Big thanks go to Thala Estra for his guidance, without which I would have given up and decided Reaktor is just too bleeping hard.
I wish I could promise perfection, but at this point I’m still taking baby steps, so…
Please let me know of any bugs, if you use the block and run into problems.


Brian Watterson
4 months ago
Hi Catman - Just added this module to my Reaktor 6. Looks great but I can't figure out how to use it! No I/O sockets. How do I patch the signal In or Out?
Forrest Riege
6 months ago
Great module! Love being able to shift the pitch both before and after quantization.
Catman Dude
4 years ago
Thanks for the kind words, Jonatan! So far so good -- no bugs reported yet.
Jonatan Rosengren Drake
4 years ago
Good job!