MUFF WIGGLER Forum Index
 FAQ & Terms of UseFAQ & Terms Of Use   Wiggler RadioMW Radio   Muff Wiggler TwitterTwitter   Support the site @ PatreonPatreon 
 SearchSearch   RegisterSign up   Log inLog in 
WIGGLING 'LITE' IN GUEST MODE

[Prototyping] Kassutronics Quantizer
MUFF WIGGLER Forum Index -> Music Tech DIY  
Author [Prototyping] Kassutronics Quantizer
kassu
Here is a project I've been working on off and on during the last few months. It is still a work in progress, and I'll share a bit of that progress here.

The project: I decided I need a quantizer, and as these things go, I then quickly decided I should design my own.

The main goal is to find a balance between feature set and ease of use. After some experimenting I decided to break free from the piano keyboard layout, and adopted a bracelet paradigm for the musical scale: a ring of 12 illuminated push buttons that enable and disable individual notes. So far I'm quite happy with this ring, it invites experimentation rather than trying to understand or remember musical theory.

Here is a picture of the first prototype (with a rather dull looking cardboard front panel):



Below the ring there are 4 more illuminated function buttons. I'm not yet sure how exactly the functions will be distributed over these buttons.

As the picture shows it will be a two-channel quantizer, with trigger inputs and gate outputs on each channel. I'm now working on the second prototype, which adds 2 CV inputs.

The planned feature set is as follows:
- Save/recall of scales, probably 12 memory locations + autosave of the current scale
- Rotate the scale (change root note)
- Transpose the output (by semitones and octaves), each output individually which generates chords
- Keyboard mode for tuning oscillators etc
- CV control over rotate, transpose, and perhaps load scales based on CV

On the hardware side, I am trying to keep it affordable.
- MCU: ATmega328P, so far the code is written in the Arduino IDE.
- DAC: PWM, filtered and scaled to +/-5.333V or 128 semitones.
- construction: 2 PCBs. The "main" PCB is completely through hole, the front panel PCB has some SMD parts (SOIC and 0805, with big pads for easy hand soldering).

Here is a render of the 2nd prototype:



While PWM is often considered a poor-mans DAC, it has some specific advantages. Since it derives from the crystal timing, PWM can give extremely good linearity, better than many quite fancy DACs. It's also very easy to use in the code. Challenges are providing a very stable power supply to the MCU, and of course filtering the PWM properly.

In my prototype the accuracy over the full range is on the order of 1 mV or better, the measurement is limited by my multimeter. The MCU supply is a LP2951 adjusted to 5.333 mV, which seems to handle any load and line variations fine on the same level of accuracy. The temperature coefficient should be something like 0.3 mV/K, so that may give a larger error in practice (I still have to measure this). However that is still better than the tempco of my VCOs, so it will not dominate the total tuning error of the system.

I'm still experimenting with the PWM filter. Filtering the fundamental PWM frequency of 125 kHz is no problem, I set the filter such that these are attenuated to less than 1mVpp. However the harmonics of the signal go up to around 100MHz, and can be easily transmitted through stray coupling giving potentially large high-frequency spikes in the output. The first prototype uses a third order filter (1st order passive + 2nd order Sallen-Key), which limits the spikes to ~13mVpp. These spikes are pretty harmless in audio circuits due to their high frequency, but for good measure I'm changing the filter topology to see if I can reduce them a bit. In the second prototype I will try a 4th order passive filter (2*2nd order with buffer in between), which is potentially much better at high frequencies compared to a Sallen-Key design. Time will tell if this gives improvement at all - this high frequency stuff can't really be tested other than building up the actual PCB.

The next step is mostly software, in particular the user interface. The core algorithm is working well at the moment, consisting of a main loop running with the ADC at 19 kHz (52 us per sample), interleaved to get 104us per sample on each channel. There will be a 2 or 3 sample delay from input/trigger to gate output to allow the PWM filter to settle, so the overall latency will be 0.3-0.4 ms. Then there is a UI loop running at 1kHz.
Jaytee
This is a really rad project. Lots of things I’m digging about it, and the circular scale is pretty high on the list. I really like visualizing music spatially, and neither traditional notation or piano keyboards do a good job of that for me.
BARD
Looks like real fun and useful tool for playing live.
That circle would also do great job as sequencer note input cool
jorg
I'm delighted to see a new quantizer, and I like your proposed feature set.

I have a request for something lacking in the market today:

Let's say the user selects notes defining a major scale, resulting in a mix of whole and half steps. Now let's say I play a ribbon controller into it. If I'm trying to play in rhythm, I'll have to slide in accurate whole- and half-step distances on the ribbon, or the rhythm will be off. Same with a saw LFO input for an arpeggio. Or maybe feed in S/H voltage from a random source. In that case, the rhythm will be OK (forced by a clock) but the statistical distribution of notes will be uneven - whole steps will be less frequent than half-steps.

The cure is to take the input voltage and evenly split it in the octave (8 equal voltage thresholds on the input, in this case). Then once the input is quantized, look up the output in a table indexed by that quantized input.

Sorry my description makes it sound so complicated, but for the user, it will feel so much more intuitive to play.
kassu
BARD wrote:
Looks like real fun and useful tool for playing live.
That circle would also do great job as sequencer note input cool


Thanks. The software side will be open source and arduino compatible, so it will be totally feasible to experiment with other uses!
kassu
jorg wrote:
I'm delighted to see a new quantizer, and I like your proposed feature set.

I have a request for something lacking in the market today:

Let's say the user selects notes defining a major scale, resulting in a mix of whole and half steps. Now let's say I play a ribbon controller into it. If I'm trying to play in rhythm, I'll have to slide in accurate whole- and half-step distances on the ribbon, or the rhythm will be off. Same with a saw LFO input for an arpeggio. Or maybe feed in S/H voltage from a random source. In that case, the rhythm will be OK (forced by a clock) but the statistical distribution of notes will be uneven - whole steps will be less frequent than half-steps.

The cure is to take the input voltage and evenly split it in the octave (8 equal voltage thresholds on the input, in this case). Then once the input is quantized, look up the output in a table indexed by that quantized input.

Sorry my description makes it sound so complicated, but for the user, it will feel so much more intuitive to play.


This is a nice idea. There are quite a few possibilities what to do when the incoming voltage does not match an enabled note. So far I implemented nearest-note quantization, meaning that it always goes to the closest enabled note. When fed with a saw input this gives a different, but still nonregular, rythmic pattern compared to for example the different options on the addac quantizer.

Your idea is certainly worth a try. It must be configurable, because with that mode you cannot anymore use the quantizer to correct pitch for a source that already roughly follows some desired melody.
MapacheRaper
applause

I love the PCBs you have designed but this one could possible be my fave.

In fact I tried to do an arduino quantizer and codewise it works, but the output voltage drifts quite noticiably. I was using a mcp 12bits DAC instead PWM and finally I left semi abandoned the project because of the drifting.

So Im following this project with interest and I will be getting a PCB/panel set when ready. Do you have an estimated release date?

I was going to suggest you to use an arduino nano instead of the DIP atmega version. It has some advantages: cheaper (2€), easier to build. Easier to reprogram/hack. Takes less space.

But I guess it lefts out the LP2951 and it would produce the note drifting, isn´t?. Would be possible to use the LP2951 while using a nano?. Whatever if possible or not, Im really interested in this project. Please keep us updated.

Good work, man!
pld
kassu wrote:
There will be a 2 or 3 sample delay from input/trigger to gate output to allow the PWM filter to settle, so the overall latency will be 0.3-0.4 ms.

FWIW some sources (see here and here) take > 4ms to reach the target value, i.e. there's a very loose relationship between the output being at the correct value and the gate signal.
So it might be useful to add an optional delay on the input side to compensate that (i.e. delay processing triggers by some configurable time). We had up to 4ms on o_C and apparently even that's not enough... it's kind of bonkers if you ask me.


jorg wrote:
Let's say the user selects notes defining a major scale, resulting in a mix of whole and half steps. Now let's say I play a ribbon controller into it. If I'm trying to play in rhythm, I'll have to slide in accurate whole- and half-step distances on the ribbon, or the rhythm will be off. Same with a saw LFO input for an arpeggio. Or maybe feed in S/H voltage from a random source. In that case, the rhythm will be OK (forced by a clock) but the statistical distribution of notes will be uneven - whole steps will be less frequent than half-steps.

I have an abandoned hack somewhere for o_C that implements an optional equal distribution mode. You can probably also get there with a layer of indirection between source and quantizer but it'd take some setup work.
kassu
MapacheRaper wrote:
I was going to suggest you to use an arduino nano instead of the DIP atmega version. It has some advantages: cheaper (2€), easier to build. Easier to reprogram/hack. Takes less space.

But I guess it lefts out the LP2951 and it would produce the note drifting, isn´t?. Would be possible to use the LP2951 while using a nano?. Whatever if possible or not, Im really interested in this project. Please keep us updated.

Good work, man!


Thanks!

It is possible to bypass the onboard regulator of the arduino board, but I'll probably stick with the bare atmega for now since I like the more integrated approach. Programming is not too difficult, if you have a spare arduino you can use it as SPI programmer, and once the arduino bootloader is on board you can also program it over the serial port. Both SPI and serial headers are on board.
kassu
pld wrote:
kassu wrote:
There will be a 2 or 3 sample delay from input/trigger to gate output to allow the PWM filter to settle, so the overall latency will be 0.3-0.4 ms.

FWIW some sources (see here and here) take > 4ms to reach the target value, i.e. there's a very loose relationship between the output being at the correct value and the gate signal.
So it might be useful to add an optional delay on the input side to compensate that (i.e. delay processing triggers by some configurable time). We had up to 4ms on o_C and apparently even that's not enough... it's kind of bonkers if you ask me.


Thanks for the info. My current algorithm has a 2 sample delay as noted, and if the input changes to a next quantized note during this delay it will restart the timer. Hence it kind of waits for a steady signal, but of course slow rise times like you mention still cause multiple triggers. I will have to experiment with this more!
djthopa
Hey kassu!

It looks ace, great idea.

So getting good results out of arduino pwm? Those numbers are good smile

Looking forward to future development!
kassu
It's about time for an update on this project.

I've built the second prototype a few weeks ago, and am pretty satisfied with the hardware at this point. The main hardware change was the addtion of two CV inputs (for now just labelled A and B), as well as some small improvements to input and output filtering and offset zero trimpots on the pitch outputs.

There is also now a bit more informative panel layout (excuse the crude photo):



To help understand how the module will work, here is a simplified block diagram:



The quantizer core itself is pretty obvious: the scale can be set with the ring of push buttons. The scale can also be rotated with the rotate buttons, which effectively changes the root note, so it can be used for example to generate harmonic progressions. Finally (but not yet implemented), scales can be saved and loaded to EEPROM memory.

The output of the quantizer can be transposed, either both channels together or independently, in semitone steps. Semitones are entered on the button ring, and octaves with the up/down buttons. This allows, for example, two-note chords and another variation of progressions.

Similarly, the Offset function adds an offset to the input before quantizing, again in semitones and octaves. With this you can change the range without changing the scale.

The CV inputs A and B can each be assigned to any of these functions: rotate, offset, transpose, gate length, and load scale. The CV inputs track 1V/oct as well, and quantize internally to semitone steps. This means, for example, you can assign a CV keyboard to Rotate, and play harmonic progressions on the keyboard.

As far as the timeline concerns, most of this has been implemented and I'm now mostly just experimenting with patching it, which is a lot of fun. On the to do list is still load/save functionality, different quantization modes, a noise reduction mode that should also take care of the slow keystep/beatstep issue, further tweaks to the panel design, and of course the minor detail of documenting it all...
Jarno
Looks great, took me a few moments to see which note goes where, bu that works.
Totally dig the penrose quantiser, but I think the circular layout is quicker to control. Nice!

And also, your project is two channel and allows for more cv control! Really nice .
MapacheRaper
Helluva sexy applause
aragorn23
This looks great! Will you be selling PCBs and panels for it once it's complete?
templar
Nice! Following
ello
this looks awesome.
kassu
aragorn23 wrote:
This looks great! Will you be selling PCBs and panels for it once it's complete?


Yes, I will be selling PCBs and panels. Perhaps even partial kits, for example including the push buttons and preprogrammed MCU could be a good convenience for builders.
ello
kassu wrote:
Perhaps even partial kits, for example including the push buttons and preprogrammed MCU could be a good convenience for builders.

that would be really cool
jgb
Great work!
devinw1
Really nice job on that! It's peanut butter jelly time!
kassu
Some more technical details:

I measured the output linearity of the new prototype with a proper 6.5 digit multimeter, and it gave the folowing results for the two channels:



The result is actually quite strange. The output of channel A clearly shows some nonlinearity, causing a maximum error of 1mV over the full scale. Channel B on the other hand is extremely linear, the nonlinear error is only some tens of uV. While both channels are perfectly fine (better than an analog VCO anyway), it is strange to see such a difference between the channels.

I also measured the PWM switching noise again. It has indeed improved on "intermediately high" frequencies compared to the previous prototype: in a 20MHz bandwidth I measure now around 4mVpp of noise which is pretty good. In the full 200MHz bandwidth of the scope I still measure around 20mVpp, so the highest frequency components are not attenuated as much. This very high frequency stuff may couple to the output through some parasitic couplings, or directly to the oscilloscope probe lead.

For comparison I also measured the output of an Arturia Keystep, and it has 30mVpp noise in a 20MHz bandwidth.

A perhaps more imporant change is that I now have also some low pass filtering on the signal and CV inputs. These help when using a noisy signal as an input, such as a PWM LFO with mediocre filter I hacked together some years ago eek!, or indeed a Keystep.
MUFF WIGGLER Forum Index -> Music Tech DIY  
Page 1 of 1
Powered by phpBB © phpBB Group