• If you haven't done so already, please add a location to your profile. This helps when people are trying to assist you, suggest resources, etc. Thanks

Register switches, Gray codes, and Euler circuits


Active member
Aug 24, 2021
Reaction score
Montana, USA
(Why, yes, I might also be a mathy guy, not just a musician. Who would ever have guessed?)

I am sure I am not the only one who is puzzled by the seemingly arbitrary order the register switches are placed in on a lot of accordions. I got to wondering, both about what might be a more logical order to place them in, and also what the easiest way would be to compare registrations that differ by a single voice, while exploring the sound of a new (or old!) instrument.

So, I asked myself: is it possible to arrange the register switches on (say) an LMMH instrument, so that a) adjacent switches only add or subtract a single reed bank; b) bassoon is first and piccolo is last -- a few manufacturers do that now, but not all -- and c) master is still in its traditional place in the middle?

The answer turns out to be yes, for MM, LM, LMM, and LMMH (whether 11 switches without cassotto, or 15 with), but no for LMH. (On the LMH, notice that the master is the fourth of seven switches, but is three reeds removed from silence, and each transition turns one reed on or off. You have to place the master third or fifth if you want to keep condition A, or violate A once to keep conditions B and C.)

Sequences that traverse an entire "dictionary" by changing one "letter" of a "word" at a time are called Gray codes, after a physicist who introduced them into analog electronics in the 1930s. There's a nice tidy way of constructing one for any "alphabet" - but the 'master switch in the middle' condition makes the problem harder.

For the usual 11-switch LMMH setup (where M2 is never sounded alone), there are only two possibilities (and they are mirror images of each other with bassoon and piccolo reversed):

L - LM - M - MM - LMM - LMMH - MMH - MH - LMH - LH - H and

L - LH - LMH - LM - LMM - LMMH - MMH - MM - M - MH - H.

There are several other options of course if you don't want the master in the middle. Notice that they both group all 4 musette voices together, and you have a choice of grouping all 6 L voices or all 6 H voices together.

With the 15-switch LMMH with LM in cassotto, so that we treat M in and out of cassotto as two completely different sounds, there are several possibilites - all related by family, in that you choose which order the reeds enter (6 sequences) and exit (6 more sequences). You can choose any two reeds to have in a contiguous block of 8 registers. Here is a sequence that has M2 in slots 4-11 and H in slots 8-15:

L - LM1 - M1 - MM - M2 - LM2 - LMM - LMMH - MMH - M2H - LM2H - LH - LM1H - M1H - H.

I know of no brands that actually use these orders, though you'll see some familiar subsequences on quite a few models.

It's trivially easy, in only one way, on MM (there are only two voices), LM (L, LM, M), and LMM (L, LM, LMM, MM, M).
On LMH, its possible to play all 7 registers in order, but not with the master in the middle and a single voice on each end.

Gray codes are a special case of a more general mathematical object called a Hamiltonian circuit, a path that visits every vertex of a graph exactly once and then takes you home.

Euler circuits, on the other hand, traverse every edge of a graph, rather than every vertex. That is, an Euler circuit through an accordion's registers plays every possible pair of sounds that differ by one voice once each. On the 15-register instrument, every voice has 4 neighbors; 2 of them got used to build the Gray-code path above; you can use the other two to build a second Gray-code path that starts and ends with M1 and M2:

L - LM1 - M1 - MM - M2 - LM2 - LMM - LMMH - MMH - M2H - LM2H - LH - LM1H - M1H - H
M1 - M1H - MMH - MM - LMM - LM1 -LM1H - LMMH - LM2H - LM2 - L - LH - H - M2H - M2

On the 11-switch LMMH instrument, a perfectly efficient Euler circuit is not possible. Any time a graph has more than two vertices with odd numbers of edges (registers with 3 nearest neighbors, e.g. MM can move to M, to MMH, or to LMM) it's not possible to traverse every edge without repeating some. Hearing every possible pair of adjacent sounds on the 11-switch LMMH requires 20 transitions rather than just 17. There are several ways to add the three repeats. One is

LMM - LM - LMH - LMMH - MMH - MM - M - MH - H - LH - (original Gray code sequence: ) L - LM - M - MM - LMM - LMMH - MMH - MH - LMH - LH - H, sounding H-LH, M-MM, and MMH-master twice.

I have been using these sequences to compare electronically generated simulations of voices. But if I ever had cause to make one of those Youtube videos demo-ing all the registers on an instrument I was trying to sell, I might use this sequence too.
Last edited:

Similar threads