[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Denemo-devel] respelling and simplifying accidentals
From: |
Richard Shann |
Subject: |
Re: [Denemo-devel] respelling and simplifying accidentals |
Date: |
Mon, 08 Dec 2014 15:21:01 +0000 |
On Mon, 2014-12-08 at 09:58 -0500, Bric wrote:
> On 11/29/2014 03:05 PM, Bric wrote:
> > On 11/29/2014 01:20 PM, Richard Shann wrote:
> >> On Sat, 2014-11-29 at 18:09 +0000, Richard Shann wrote:
> >>>> It's spelling the
> >>>> notes as G#, C#, D#, etc. (instead of Ab, Db, Eb, etc)
> >> I should have mentioned that having transposed to the wrong key, you can
> >> always make a further transposition to correct your error. In the case
> >> you mention here, you need to transpose upwards by a diminished second
> >> (the code is d2 for the "Arbitrary transpose up" command).
> >
> > My brain is not working at the moment. (Not enough to understand your
> > explanation) But I applied the "d2" transposition, and the problem
> > went away.
> >
> > If the error was mine, then there's no need for the "simplify"
> > function I mentioned. Perhaps. It would/could have been a more
> > generalized function, used to correct mis-spelled sharps/flats
> > regardless of how they came about (whether through "transpose" or some
> > other way). But if these problems don't occur, then, obviously, no
> > need. Thanks for helping
>
> I came upon a situation that could use a "force re-spell" function ...
> this one could simply force the FIRST occurrence of a spelling upon all
> the subsequent variants (deviations) from the first occurrence...
>
> Here is a screen shot of the "misspelled" notes.... I arrived at them by
> copying and pasting sets of quadruplets and then transposing them a
> minor third, then a tritone, then a major sixth up... The key signature
> is D major.
>
> See attached/embedded png. I want the Ab to be spelled as G#, and
That is a transposition down by a diminished second.
> certainly the C double sharp to be spelled as a D.
and so is the transposition cisis to d. The use of the word "certainly"
here implies a certain fuzziness in your idea of what transposition is.
You couldn't transpose down by a diminished second and get any other
result.
>
> Here is a sketch of the basic algorithm in Perl. I realize there can be
> a different algorithm, not based on first-occurrence, but on some other,
> absolute normalization:
>
> foreach my $spelled (@lily_notes) {
>
> my $pitch=&MidiValue($spelled) % 12; # the MidiValue function
> computes the midi index...
>
> if(exists $pitch_spelling{$pitch}) { # if repeat occurrence
>
> push @respelled_notes, $pitch_spelling{$pitch};
>
> } else {
>
> push @respelled_notes, $spelled; # (first occurrence)
> # grab the first occurrence, to force all subsequent variations
> to be spelled as the first occurrence...
> $pitch_spelling{$pitch}=$spelled;
>
> }
>
> }
>
> #---------------------
>
> I don't know how one would do associative arrays in, say, scheme, but
> that's my thinking...
http://www.gnu.org/software/guile/manual/html_node/Association-Lists.html#Association-Lists
These are getting some use in Denemo scripts nowadays ... if you need
help with scripting in Denemo please ask; at the moment the only help is
the many sample scripts. If you look at more recent commits to git you
will see better examples of scripting for Denemo.
Richard