brianhorn / Tunerly

A minimalistic, multi-language pitch tuning app
GNU General Public License v3.0
44 stars 8 forks source link

Adding more instruments and afinations #3

Closed Porrumentzio closed 3 years ago

Porrumentzio commented 3 years ago

What do you think about adding more instruments, such as violin, cello... and afinations for them?

brianhorn commented 3 years ago

That's something I would like to do, but I only own Guitars, Basses and Ukuleles so for the first release I only wanted to include those that I can "real life test".

I will read about how some other instruments are tuned and what common tunings there are for those when I find the time, I believe adding additional instruments and tunings for them should not be too much work (as long as they are not tuned in a very different way than the string instruments included so far). Maybe even add some instruments without strings? I will have to make an overview to see which instruments make sense to include :)

Porrumentzio commented 3 years ago

I could help you with this :) I can easily know the tuning of some instruments as I have friends playing them. If you explain me how they are added to the code, I could try to!

brianhorn commented 3 years ago

To quickly point you into the direction: The new instrument and tuning need to be added in the string array in the (currently 4, thanks for the translation to a language I have never heard of before!) according string arrays in the strings.xml files, to display the tunings in the spinner they must be mapped to the according instruments in MainActivity line ~135. Pitches need to be added in TuningData.kt in Hz (Float rounded to 2 decimal points), at last the tuning name must be mapped to the TuningData in tuningMap in file PitchProcessing.kt - unfortunately this needs to be done for all translations as the tunings are not strings directly in the corresponding strings.xml files but they are items of a string array, which complicates this (but if the tuning name is the same in all languages obviously one entry is enough).

The way I implemented this unfortunately also means, that two tunings for different instruments cannot have the exact same name - which is why I renamed "Drop D" for bass to "Drop-D" so that it is not the same as "Drop D" for Guitar. This is not a clean solution obviously, but so far I think the solution to this is at most a "huh" for the user, and intuitively I would not have an idea how to effectively rewrite this. For now that is not a problem in practice, but should multiple instruments be added that all share the same tuning names it could be (not sure if that even could be the case though).

Porrumentzio commented 3 years ago

Thanks a lot! When I'll have time, I'll have a look if I'm able to make this. Again, a pleasure to speak with you :)