public PianoNote(long Tick, long Length, PitchValuePair PitchValue, string Lyric) { this.pvp = PitchValue; this.Tick = Tick; this.Length = Length; this.Lyric = Lyric; }
void LoadMidi(string MidFile, string Track) { TempoWorker tempo = new TempoWorker(120, TempoWorker.NoteType.Crotchet); MidiRResult MidiRecv = MidiWorker.ReadMidi(MidFile, Track); NoteOnEvent FN = MidiRecv.Notes[0]; long off = FN.AbsoluteTime; for (int i = 0; i < MidiRecv.Notes.Count; i++) { NoteOnEvent NoteEvent = MidiRecv.Notes[i]; PianoNote PNote = new PianoNote( NoteEvent.AbsoluteTime - off, NoteEvent.NoteLength, new BalthasarLib.PianoRollWindow.PitchValuePair((uint)NoteEvent.NoteNumber, 0) ); PNote.OctaveType = PitchValuePair.OctaveTypeEnum.Piano; PNote.Lyric = PNote.PitchValue.NoteChar + PNote.PitchValue.Octave.ToString(); NoteList.Add(PNote); } int j = 0; int k = 0; PitchList.Add(k, new List <PitchNode>()); for (int i = 0; i < MidiRecv.Pitchs.Count; i++) { if (j >= MidiRecv.Notes.Count) { break; } if (MidiRecv.Pitchs[i].PitchWheelChangeEvent.AbsoluteTime - off < NoteList[j].Tick) { continue; //在音符前,抛弃 } if (MidiRecv.Pitchs[i].PitchWheelChangeEvent.AbsoluteTime - off > NoteList[j].Tick + NoteList[j].Length) { //在音符后 j++; k++; i--;//重来一遍 PitchList.Add(k, new List <PitchNode>()); continue; } PitchValuePair pvp = new PitchValuePair((uint)MidiRecv.Notes[j].NoteNumber, MidiRecv.Pitchs[i].PIT, (uint)MidiRecv.Pitchs[i].PBS); PitchNode PitN = new PitchNode(MidiRecv.Pitchs[i].PitchWheelChangeEvent.AbsoluteTime - off, pvp.PitchValue); PitchList[k].Add(PitN); } }
public PianoNote(long Tick, long Length, PitchValuePair PitchValue) { this.pvp = PitchValue; this.Tick = Tick; this.Length = Length; }
public PianoNote(long Tick, BalthasarLib.PianoRollWindow.PianoProperties.NoteType NoteType, PitchValuePair PitchValue, string Lyric) { this.Lyric = Lyric; this.pvp = PitchValue; this.Tick = Tick; this.Length = (uint)(SemibreveLength / (uint)NoteType); }
public PitchNode(long Tick, PitchValuePair PitchValue) { this.pvp = PitchValue; this.Tick = Tick; }