• Status Unconfirmed
  • Percent Complete
  • Task Type Patches
  • Category Plugins
  • Assigned To No-one
  • Operating System All players
  • Severity Low
  • Priority Very Low
  • Reported Version Daily build (which?)
  • Due in Version Undecided
  • Due Date Undecided
  • Votes
  • Private
Attached to Project: Rockbox
Opened by eastcheap - 2010-11-12

FS#11752 - pitch_detector: Mixed accidentals and Key Transposition

Patch against r28560.

Adds options for displaying pitches according to key (for transposing instruments) and “mixed” accidentals a la Korg (C#, Eb, F#, G#, Bb).

I’d also like to add some kind of support for alternate temperaments (perhaps even just intonation), however this isn’t trivial and I probably won’t undertake the project unless some interest is expressed.

fml2 commented on 2011-01-05 16:10

A few notes and questions:

1. I think the two features should be separated into two patches

2. Why did you choose to display only A# and D# as Bb and Eb? Because Korg does this? I’d do it in a different way: introduce a setting for the key signature (C-Dur by default) and then display the notes according to that signature (with e.g. F# or Gb chosen automatically).

3. I don’t quite understand what the key transposition is for. I understand it now as follows: I’d use the feature if I play a transposed (differently tuned) instrument (say, guitar). The ideal tuning is C. If I know that it’s tuned a tone higher than it should be, I’d set this setting to “D”. And then, if the detector detects a D, it would display it as C, so that I’d play the same string at the same position as I would do it if the guitar was tuned in the ideal way. He-he, try to describe it in the manual! :-)

1. Two independent patches are a definite possibility, since only the transposition bit adds a menu item. I’ll keep it in mind for the next revision.

2. I chose to emulate Korg because it seems like a reasonable compromise and because the TM-40 is so wildly popular. Why they chose G# is a head-scratcher. Ab makes more sense, at least in a harmonic context. I had considered accidentals according to key, but was just too lazy to work it out. :-) I’ll go ahead and see what I can come up with for the 13 common keys, at least.

3. It makes sense if you play a transposing instrument (trumpet, horn, sax, etc.). How useful it is is another question. And, no doubt about it, anything involving transposition will be a beast to document.

fml2 commented on 2011-01-06 07:41

1. So we agree on this

2. I don’t use TM-40 and hence can’t know how it works. I’m not sure how many people do. But we could have four possible values for accidentals: “sharps only”, “flats only”, “like Korg TM-40” (or “Bb and Eb only”) and “Based on the key”. The latter will require another setting with some popular keys. (Dur or Moll only or both?) What do you think about this?

3. OK, I’ve read up about transposing instruments and see that my intuition was correct. A nice feature!

fml2 commented on 2011-01-06 07:42

Another thing: I’d introduce an enum for possible values of accidental_mode – for better code readability.

fml2 commented on 2011-01-07 19:44

Could you please provide your real name (for the credits). I’d like o commit the “transposing instrument” part. Thanks.

Great, especially since, once I started working on accidentals-by-key, there wasn’t enough fuzz in the world to keep two patches compatible.

“R.L. Horn” is my preference, but “Robert Horn” is fine too. If you use the latter, I’ll change my profile to match.

I’ve attached a revised and tested transposition patch (against r28972) which can use, if you like. The only differences are a comment in display_frequency() to explain what’s happening and some (mostly decorative) #defines.

Once it’s committed, I believe it would be best to close this task – anything to do with accidentals can be submitted separately. However, as regards (2) above, after some thought, I’m now inclined to think that the Korg approach is a bad idea. Try as I might, I just can’t make any sense out of that G# (maybe someone at Korg really likes the Dorian mode?). The harmonic chromatic scale adds three flats to arrive at accidentals, which neatly encompasses the major and natural minor scales, and is probably the way to go (with some cheating to avoid double sharps and flats) for key-based accidentals.

fml2 commented on 2011-01-09 13:48

OK, I will use “Robert Horn”, but that doesn’t necessarily mean that you have to update your profile. That would be convenient though so that no questions will have to be asked when committing future patches from you!

After committing the transposition part, I will leave this task open since the other part can still be tracked here.

I’ve tweaked your patch a bit (no functional changes). Basically, I did the following:

- eliminated the constants for the transpositions since they are really not needed and, as a sequence, not used anywhere in the
renamed the “transposition” setting from ..._idx to key_... thus making it semantical rather than purely technical. This is OK IMO since the setting is exactly that: the number of semitones between the concert C and the instrument
added a comment to the setting

I attach the modified patch. If you find it OK, I’ll commit it.

Looks good to me.

fml2 commented on 2011-01-11 06:55

Good! Another thought: what do you think about renaming the “transposition” setting (and the menu entry) to “instrument key”?

fml2 commented on 2011-01-14 21:42

The key transposition part has been committed as r29052.

Terrific. Sorry I’ve been a bit preoccupied lately, but the “Instrument Key,” idea also seems like a good one to me.


Available keyboard shortcuts


Task Details

Task Editing