the home-made MIDI-guitar

MIDI protocol
Frets and strings
Analog part
Control and indications
Algorithm of note detection


About author

Algorithm of note detection

sygnal.gif (1034 bytes)

Data from strings are received about 50 times per second. Magintude of pickup signal lies in range of 0..127, fret number - 0..17.

Model of input data is shown above (1 pixel across corresponds to 1 cycle). This specific data plot is obtained from the first prototype of Tryndelka. Blue color indicates data from ADC, red - fret number. At the end of the plot you can see a slide from 0 to 5th fret, at that the string is picked on the 4th fret and goest to the 5th already sounding.

During analyse of data, amplitude of pickup signal of the string and the fret where it is pressed to are taken into consideration.

Advanced detection algorithm works with maximum accumulating analog circuit of each string like the following:

1. If there is "no sound" state and amplitude from pickup exceeds the activation threshold, then for some cycles the string turns to "ready to sound" state, but note still is not sent.

2. If during all intermediate cycles amplitude from pickup exceeds the activation threshold, the string turns from "ready to sound" to "sound", and Note On command is sent. Otherwise the string returns to "no sound" state.

3. If the string is currently sounding and amplitude from pickup drops below deactivation threshold (which is significantly less than activation threshold, i.e. 10 and 50) then Note Off command is sent and the string turns to "no sound state".

4. If the string is now sounding but large positive delta from pickup is detected (e.g., guitarist hit the string by mediator, and it sounds again louder), then send Note Off and turn the string to "no sound" state New note will be detected due (1) on the next cycles.

5. If the string is sounding and the fret is changed then also act like (4).

6. After all - discharge the accumulating capacitor of the string.

This algorithm does not require buffers for several samples per eachc string - only current and previous state is required. All data require 70 bytes of RAM to store.

<<< Previous   |   Next >>>

Хостинг от uCoz