On Friday 06 September 2013 07:20:01 D. Michael McIntyre wrote:
> On 09/06/2013 05:33 AM, Niek van den Berg wrote:
> > When looking on how to transpose chords (and note names) I found simply
> > using tr() will not work since tr() requires a static string and in
> > general, note and chord names will "generated".
>
> The way it works is we provide a list of strings we anticipate being
> generated, and have translations ready for those. It only goes so far,
> obviously, and as a bonus it's all a gigantic pain in the ass.
>
> I'm just not sure yet how I want to handle any of that. It is totally
> safe for you to ignore translation, and avoid the issue entirely. I'll
> come up with a solution as I see fit once I've had some time to think
> about it, and have consulted with some friends in other countries.
>
> Whatever I have to do to your bits to make my bits work is fine. I'll
> go back and hack it to get translations working to satisfy whatever
> requirements I end up writing.
Maybe I have another solution. Looking at some other musical notation programs
it seems these programs support something like "notation". You can select a
"notation" and the notation defines how the note and chords are named.
This is relatively simple to implement. Create a XML file which defines the
chords (like a major chord consists of a root, major 3rd and a 5th) so they
are no longer hard coded).
Then the file defines several notation sections which define the names for
every
note ("Standard" defines a C, C#, Db, ..., "German" defines the notes as C,
Cis,
Des and "French" uses Do, Do# or whatever they use :-)).
Besides the note names the notation section also define how chords are written
using a template. The template of a standard dominant chord could be {0}7. The
string {x} will be replaced by the x-th note of the chord (starting at zero).
So C-E-G-Bb will results C7.
This makes it possible to have several ways of writing the same chord. E.g. a
Am7 (A-C-E-G) can be written as Am7 using template "{0}m7", as C6 ("{1}6") or
even as G-E-C-Am ("{3}-{2}-{1}-{0}").
I wrote some code to experiment this idea and it seems to work. There are two
classes, ChordLabel which is an adapter class for the new ChordLabel event,
replacing the Text::Chord. The second class is ChordNotation. This class
contains the content of the XML file and there "knows" how notes and chord are
formatted. To convert a ChordLabel event to a string this ChordNotation class
is used.
A question, what would be to best structure to contain this ChordNotation
class, RosegardenDocument?
Best regards,
Niek
------------------------------------------------------------------------------
Learn the latest--Visual Studio 2012, SharePoint 2013, SQL 2012, more!
Discover the easy way to master current and previous Microsoft technologies
and advance your career. Get an incredible 1,500+ hours of step-by-step
tutorial videos with LearnDevNow. Subscribe today and save!
http://pubads.g.doubleclick.net/gampad/clk?id=58041391&iu=/4140/ostg.clktrk
_______________________________________________
Rosegarden-devel mailing list
[email protected] - use the link below to unsubscribe
https://lists.sourceforge.net/lists/listinfo/rosegarden-devel