Handling quantization of midpoints with Braids code on OC

Hi! First time poster here, working on my first app for OC that uses the braid quantization code.

It’s a precision adder that can take semitone intervals as added intervals and quantize the final output. Some.notes are very unstable and I think it’s because the adder outputs an exact semitone step between two scale values, which then glitch between the higher and lower notes.

Is there a way to handle this with that code?

Demo here (about midway through when I start fiddling with scales) Intervalic Demo - A new adder & harmonic CV source for OC Hemisphere - YouTube

Code here: Release HACKISPHERE-0.0.1-alpha1: Intervalic alpha release · eethann/O_C-HemisphereSuite · GitHub

Thanks!

Quick note that the glitch in the quantizing can be heard around :23 in the video, where one of the high notes sounds like it’s doing a glissando.

Braids’ code handles that by adjusting the decision boundary (for example if the threshold to get to the next pitch is an increase of 100 cents, the threshold to go back to the previous one is -105 cents).

Maybe there is more noise on your device and the hysteresis needs to be made larger?

https://github.com/pichenettes/modules/blob/master/braids/quantizer.cc#L99

1 Like

Thank you for pointing me to that code, @pichenettes! I’m not sure how to best address that without potential regressions in OC, I’ll see if there’s a quick way to parameterize it, I suppose. I might also try to use sample averaging for a crude filter.

Not sure about Hemisphere but in the base o_C there was a filtered ADC value available, but the quantisers generally used a raw one.

Having tuneable hysteresis was always on some vague list of things to do because there are some pathological cases that get introduced with masks; I’d have to check if I ever actually did anything. IIRC it didn’t come up as a complaint, the quantiser survived the mutilation (sorry) and worked great despite questionable additions :slight_smile: Somewhere in the code there might still be the simple SemitoneQuantizer that’s maybe easier to experiment with.
I’d also check if it might be a non-pitch value that needs the hysteresis - e.g. scale selection.

@pld thanks for your reply, that’s a good point regarding the non-pitch hysteresis. Currently I’m just quantizing semitones with a simple division. That makes a lot more sense. Looking at the hysteresis code I think it’s unlikely the issue is with the braids quantized signal. Took me a second to grok that optimized weighted averaging…I’ll probably just try to adapt that to the raw semitone quantization. Maybe that SemitoneQuantizer will do the trick. I’ll post back when I’ve had a chance to test.

One more question, while testing is in progress for this solution. Is there an elegant way to transpose by scale degree? E.g. it would be nice to have the adder be able to add scale degree offsets, but those are post-quantization, so I’m not sure the best approach.

There’s a third parameter that was added to the Process function for that.

Oy, I knew that! I was looking for it, but silly me looked at the original Braids code thinking it was the OC code by accident. Excited to give it a try!