Ejemplo n.º 1
0
        private void OnChordParsed(object sender, ChordParsedEventArgs e)
        {
            noteWindow.AddChordOctave(e.Chord.Root);
            string musicString = e.Chord.GetPatternWithNotes().ToString();
            string duration    =
                LilyPondNoteDurationHelper.GetDuration(e.Chord.Root.Duration.ToString(CultureInfo.InvariantCulture));

            ParallelNoteEvent(musicString, duration, e.Chord.Root.OriginalString);
            lilyPondString.Append($">{duration} ");
        }
Ejemplo n.º 2
0
 public void AddNote(Note note)
 {
     SecondPreviousNote   = PreviousNote;
     SecondPreviousNoteLy = PreviousNoteLy;
     PreviousNote         = CurrentNote;
     PreviousNoteLy       = CurrentNoteLy.ToString();
     CurrentNoteLy        = new StringBuilder();
     CurrentNote          = note;
     if (!note.IsRest)
     {
         string firstLetter = note.OriginalString.Substring(0, 1).ToLower();
         CurrentNoteLy.Append(firstLetter);
         CurrentOctave = note.Octave;
         if (note.OriginalString.Length > 1)
         {
             string secondLetter = note.OriginalString.Substring(1, 1).ToLower();
             if (secondLetter == "b")
             {
                 CurrentNoteLy.Append("es");
             }
             else if (secondLetter == "#")
             {
                 CurrentNoteLy.Append("is");
             }
         }
         int octaveChange = GetOctaveChange(firstLetter[0]);
         if (octaveChange > 0)
         {
             for (int i = 0; i < octaveChange; i++)
             {
                 CurrentNoteLy.Append("'");
             }
         }
         else if (octaveChange < 0)
         {
             for (int i = 0; i > octaveChange; i--)
             {
                 CurrentNoteLy.Append(",");
             }
         }
         LastNote = firstLetter[0];
     }
     else
     {
         CurrentNoteLy.Append("r");
     }
     SecondPreviousNoteDuration = PreviousNoteDuration;
     PreviousNoteDuration       = CurrentNoteDuration;
     CurrentNoteDuration        = LilyPondNoteDurationHelper.GetDuration(note.Duration.ToString(CultureInfo.InvariantCulture));
 }