public static SequencerClip CreateClip(List <NoteOnEvent> events, int length = 96 * 4)
        {
            var ret = new SequencerClip();

            ret.Length = length;

            foreach (var e in events)
            {
                if (e.Velocity > 0)
                {
                    var note = new SequencerClip.Note();
                    note.Tick     = ConvertMidiTimeToTicks(e.AbsoluteTime);
                    note.Pitch    = e.NoteNumber;
                    note.Velocity = e.Velocity;
                    note.Length   = ConvertMidiTimeToTicks(e.NoteLength);
                    ret.Notes.Add(note);
                }
            }

            ret.Analyze();
            ret.Sort();
            return(ret);
        }
示例#2
0
 /// <summary>
 /// Adds all of the notes from the other clip and reanalyzes.
 /// </summary>
 public void CombineWith(SequencerClip other)
 {
     Notes.AddRange(other.Notes);
     Sort();
     Analyze();
 }