Friday, April 27, 2018

Designing a Polyphonic Music Keyboard Algorithm.


-->
After several weeks of development, I’m discovering quite how hard programming a polyphonic keyboard for Eurorack is!  There are several well-known algorithms for dealing with voice stealing, that is, when your system is 4 note polyphonic and someone presses 5 notes,  these can be dealt with buy top note priority, bottom note priority or last note priority (http://electronicmusic.wikia.com/wiki/Note_priority).  But a polyphonic keyboard for Eurorack produces some unique problems.

First of all, lets describe the problem, our controller has 4 voltage outputs coupled with 4 gates.  A simple algorithm will assign the first note pressed to the first output, the second note to the second and so on.  This works pretty well, but has a major problem, voice changing.    Suppose we press two keys,  a low C (C0) and a  high A (A3),  C0 will go to output 1 and A3 to output 2. If you now release C0, the A3 will change to output 0.  The problem is the patch connected to output 0 might be very different to the patch on output 1.  When the A3 moves from output 1 to output 0 the sound produced will be very different.

To solve this, the algorithm needs to make the notes stick to a output.  In this situation note A3 once assigned to output 1 will stick to it that output until it is released, other new notes are assigned to free outputs, if no notes are free the new note is ignored!  This works pretty well but introduces a new problem, it is impossible to play the keyboard in legato mode!

Suppose you press C0 and then A3.  You want to move the A3 to G3 smoothly so that A3 moves to G3 on output 1.  What happens with the “Sticky” algorithm is that G3 is assigned to output 2 because for a short while both A3 and G3 are pressed together:

Ouput
Key
Keys
Keys
Keys
0
C0
C0
C0
C0
1
A3
A3
2
G3
G3
3

The problem here is that the algorithm needs to distinguish between a new note being pressed and held and the player playing in legato mode.  The difference is in legato mode a new key is pressed and then an older one released within a certain time, so simply delay the new note for a short period of time to see if this new note is part of a legato mode. This of course does mean that adding the new note will be delayed slowing down the playing mode.

This is the current state of play, I’m experimenting with the delay and seeing what effect it has on the playability of the keyboard. I can’t help feeling there is a better way, let me know if you know of one !

The source code is at:


14 comments:

  1. Hi Andy,

    I've posted a comment on the GMSN! Forum...

    https://forum.gmsn.co.uk/t/anyone-know-a-polyphonic-algorithm/540

    ReplyDelete
  2. Thanks for the informative article. This is one of the best resources I have found in quite some time. Nicely written and great info. I really cannot thank you enough for sharing.

    Restaurant in OMR
    Apartments in OMR
    Villas in OMR
    Resorts in OMR

    ReplyDelete
  3. I have really happy to these reading your post. This product control and maintenance of our health.The daily routine can assist you weight lose quickly and safely.My life is completely reworked once I followed this diet.I feeling nice concerning myself.

    Herbalife in Chennai
    Herbalife Nutrition Products
    Nutrition centers in Chennai
    Weight Loss in Chennai
    Weight Gain in Chennai

    ReplyDelete

  4. BIG DATA Technologies provides you with a state of the art software which combines modern GPU technology (Graphic Processing Units) with the best practices in today’s Big Data platforms, providing up to 100x faster insights from data.
    Bigdata Training in Chennai OMR

    ReplyDelete
  5. Testers can build, enhance, and maintain scripts to regression test their mobile applications. Hands-on instruction is provided for those who want to explore the power of using Appium. The course covers content from installation to execution and reporting . The focus is on the practical application of Appium to resolve common mobile automated testing challenges. This course focuses on getting started with Appium.
    course/appiumtraininginsholinganallur/

    ReplyDelete
  6. Really a great post. Appreciate the effort in educating us. We are also same service provides in Bangalore.
    Web Design Company in Bangalore
    Website Designers in Bangalore
    Website Development Company in Bangalore

    ReplyDelete
  7. Thanks for your great and helpful presentation I like your good service. I always appreciate your post. That is very interesting I love reading and I am always searching for informative information like this.angular 4 training in chennai | angularjs training in chennai | .angularjs best training center in chennai | angularjs training in velachery |

    ReplyDelete
  8. Great Post,really it was very helpful for us.
    Thanks a lot for sharing!
    I found this blog to be very useful!!
    Web Design and Development training in Bangalore

    ReplyDelete
  9. This article is nicely written. A very well written guide to take care of your furnace.
    web development agent service in punjab

    ReplyDelete
  10. Thanks for sharing such beautiful information with us. I hope you will share more info about it. Please keep sharing.
    Toshiba Service center in Kukatpally

    Best Laptop Service center in Hyderabad

    ReplyDelete
  11. Nice blog post information
    Sanjary Kids is one of the best play school and preschool in Hyderabad,India. Give your child the best preschool experience by choosing the best playschool of Hyderabad in Abids. we provide programs like Play group,Nursery,Junior KG,Senior KG,and provides Teacher Training Program.
    Preschool in hyderabad

    ReplyDelete