amowry / warbl

warbl public
GNU General Public License v3.0
31 stars 13 forks source link

An idea on how to add custom fingering. #13

Open louis-barman opened 2 years ago

louis-barman commented 2 years ago

I have been thinking about how to add custom fingering to the warbl and came up with an idea of defining the custom fingering in a simple text file see below for an example:

% D Whistle
D4 : x ooo ooox x
E4 : x ooo oo-x x
F4 : x ooo o-ox x
F#4: x ooo o-xx x
G4 : x ooo -xxx x
A4 : x oo- xxxx x
Bb4: x o-o xxxx x
B4 : x o-- xxxx x
C#5: x -oo -xxx x
C#5: x -o- -xxx x
C5 : x --- ---x x
D5 : x -oo ooox x

key:

<note-name>:<fingering>

'o' Covered hole
'-' Open hole 
'c' half covered hole
'x' Don't care (open or closed)
'~' allow vibrato on a don't care hole
'^' allow pitch bend on an open hole

I have had a quick go at implementing this see my repo in the wip/fingering branch see https://github.com/louis-barman/warbl/tree/wip/fingering

I was surprised how cleanly it fits in with minimal change to the existing code base see this change.

I used this program to upload the custom fingering text file to the warbl https://github.com/louis-barman/warbl-send

I realise that integrating this fully into the Warbl code base would cause a lot of disruption so don't worry if you don't want to use it. And also now is probably not a good time to do it.

It took me a couple of days to get it working. It was much faster writing tests on a PC and then it worked first time when I tried it on the Warbl. (But more work is needed if you want to use or modify this idea. I want to implement half hole for the C natural and so this is the cleanest way for me to implement it.

Let me know what you think.

louis-barman commented 2 years ago

I now think this pattern is much clearer:

% D Whistle
D4 : x *** ***x x
E4 : x *** **ox x
F4 : x *** *o*x x
F#4: x *** *oxx x
G4 : x *** oxxx x
A4 : x **o xxxx x
Bb4: x *o* xxxx x
B4 : x *oo xxxx x
C#5: x o** oxxx x
C#5: x o*o oxxx x
C5 : x ooo ooox x
D5 : x o** ***x x

Key:
'*' Covered hole
'o' Open hole 
'x' Don't care (open or closed)
'~' Allow vibrato on a don't care hole
'^' Allow pitch bend on an open hole
'c' Half covered hole on an open hole

And now o stands for open hole which is much less confusing.

amowry commented 2 years ago

Looks great! I think this would be really popular, as the current custom fingering option is fairly limited. This might be something I'd wait to officially add until the next hardware version, when we'll be making more major changes anyway and we will no longer have to worry about memory size. I assume it would be possible to import text file directly into the Config Tool similarly to how the settings files are currently imported.

It might eventually be useful to have a few additional options in the text file, like the ones that available to the current custom fingering UI to use both the thumb and overblowing for register control and use the right pinky to shift any note down one semitone. One other minor suggestion might be to use "x" for covered holes, because that seems to be a pretty common convention with these fingering charts, and when I look at the chart I automatically see the "x" as a covered hole. Then maybe the "*" could be used for the "I don't care" holes?

louis-barman commented 2 years ago

we will no longer have to worry about memory size. I assume it would be possible to import text file directly into the Config Tool similarly to how the settings files are currently imported.

Actually my warbl-send.py first converts the text file to binary and sends that (so your javscript configTool would need to do the same thing). It currently takes 7 bytes per line but I can reduce that easily to 5 bytes per line (one byte for the midi data and three bits for each hole) so if we allow room 50 lines that would take up 250 bytes. Hopefully there would be room to fit this in the current warbl -- eventually. (but I don't suggest doing this now).

This might be something I'd wait to officially add until the next hardware version.

It should be possible to have ONE code base that supports both the current Warbl and the the proposed new hardware using hardware abstraction layers in the code. I can help with this.

One other minor suggestion might be to use "x" for covered holes, because that seems to be a pretty common convention with these fingering charts, and when I look at the chart I automatically see the "x" as a covered hole. Then maybe the "*" could be used for the "I don't care" holes?

Yes 'x' for covered holes holes is MUCH better. I used '-' for don't care. See tinwhistle.txt for how this looks now.

amowry commented 2 years ago

There might barely be 250 bytes of EEPROM available, but it wouldn't leave room for much of anything else. That's the main reason I haven't implemented a full-featured custom fingering option like this in the past. So, I think we'd need to wait for a later hardware version with an external EEPROM. I could size the EEPROM plenty big so we wouldn't need to worry about this sort of thing.

waltercool commented 1 year ago

Hi,

Sorry to reopen an old topic, but is there any good way to configure your own fingerings at WARBL right now? Except at firmware (fingering_charts.ino)

I feel like the current web option is not good enough since it force you to use a specific fingering which does not make much sense at certain instruments.

15 max custom fingerings is fine I guess for most cases.

waltercool commented 1 year ago

Okay, just did the build/test from louis-barman, but seems like it's only loaded at RAM. Once you disconnect the WARBL, then all settings are lost. Still not bad if could be implemented using the web interface in some way, but still a little buggy likely due space as mentioned.

Now, if I would like to configure my own fingerings at firmware for own personal uses, how should I read fingering_charts.ino ? It is possible to override current instruments?

Sorry for double comment here.

Another option may be adding extra finger options at "Custom Fingering", but that's not maintainable because different people may require different fingering patterns for different instruments. As mentioned before, allowing around 12 to 15 fingerings patterns -> MIDI Notes should be fine, but no idea how the VRAM and VROM works here.

amowry commented 1 year ago

Sorry for the delay. I'll probably still wait for a hardware upgrade with more EEPROM to implement a completely customizable fingering option. One tricky thing about having 12 or 15 fingering patterns that can be customized is that the firmware also needs to know what to do with all the other possible patterns that aren't explicitly stated-- that's why the current implementation lists a MIDI note for every possible pattern (it also makes it very fast to look up a fingering pattern). However, for now you can definitely modify the fingering_charts.ino. It's easiest to find a chart that is similar to the one you want to implement, so if you don't need the thumb hole or bell sensor you can modify the tin chart, for example. For all of the tone holes, you could modify the GHB or Gaita chart. Many of them have a few extra instructions in the get_note function for some special cases.

louis-barman commented 1 year ago

Hi @waltercool , Sorry this is very much experimental and proof of concept code and only half completed as does not save to EEPROM, handled pitch bend or do vibrato. I wrote this as a clean way of added half holing especially on the C natural. At the moment I very busy with other things so it will be some time until I get back onto this to progress it further.

However as Andrew said in his post above you can modify the fingering_charts.ino. (it takes quite a bit of head scratching to work out out to change it -- but is possible to put any fingering in there and, for others reading this, you also need to build and program the warbl from the source code )