public MidiTimeSignature(long startTime, string metrum, string clocksPerCklicks, string thirtySecondNotesPerBeat, TempoMap tempoMap) { this.time = new MidiTime(startTime, tempoMap); this.metrum = metrum; this.clocksPerCklicks = clocksPerCklicks; this.thirtySecondNotesPerBeat = thirtySecondNotesPerBeat; }
public MidiEventsTimeline(string eventName, MidiPitchBend pb) { this.eventName = eventName; this.time = pb.time.midi; this.note = null; this.pb = pb; this.ts = null; this.midiTime = pb.time; }
public MidiEventsTimeline(string eventName, MidiTimeSignature ts) { this.eventName = eventName; this.time = ts.time.midi; this.note = null; this.pb = null; this.ts = ts; this.midiTime = ts.time; }
public MidiEventsTimeline(string eventName, MidiNote note) { this.eventName = eventName; this.time = note.time.midi; this.note = note; this.pb = null; this.ts = null; this.midiTime = note.time; }
public MidiNote(string name, int octave, MidiTime time, MidiTime length, int velocity, int velocityOff, int midiNumber) { if (name.Length > 1) { this.name = name.First().ToString() + "#"; } else { this.name = name; } this.octave = octave; this.time = time; this.length = length; this.velocity = velocity; this.velocityOff = velocityOff; this.midiNumber = midiNumber; this.frequency = MidiComposition.getFrequency(midiNumber); }
private void parseNotes(IEnumerable <Note> noteList, TempoMap tempoMap) { foreach (var note in noteList) { int nr = Int32.Parse(note.Channel.ToString()); if (nr == instrument.channel) { string name = note.NoteName.ToString(); int octave = note.Octave; MidiTime time = new MidiTime(note.Time, tempoMap); MidiTime length = new MidiTime(note.Length, tempoMap); int velocity = Int32.Parse(note.Velocity.ToString()); int velocityOff = Int32.Parse(note.OffVelocity.ToString()); int noteNr = Int32.Parse(note.NoteNumber.ToString()); MidiNote midiNote = new MidiNote(name, octave, time, length, velocity, velocityOff, noteNr); this.notes.Add(midiNote); } } }
public MidiComposition(string filePath) { MidiFile midiFile = MidiFile.Read(filePath); if (midiFile.OriginalFormat != MidiFileFormat.MultiTrack) { midiFile.Write(filePath, format: MidiFileFormat.MultiTrack, overwriteFile: true); midiFile = MidiFile.Read(filePath); } this.midiFormat = midiFile.OriginalFormat.ToString(); this.file = midiFile; this.title = ""; this.timeDivision = midiFile.TimeDivision.ToString(); this.duration = new MidiTime(midiFile.GetDuration(TimeSpanType.Midi).ToString(), midiFile.GetTempoMap()); this.tracks = new List <MidiTrack>(); this.timeSignatures = new List <MidiTimeSignature>(); this.tempo = new List <MidiTempo>(); initFrequencies(440); parseTracks(midiFile); initTimeSignatures(); }
public MidiComposition(string filePath, string mode) { CsvConverter csv = new CsvConverter(); MidiFileCsvConversionSettings setting = new MidiFileCsvConversionSettings { TimeType = TimeSpanType.Midi, NoteLengthType = TimeSpanType.Musical, NoteFormat = NoteFormat.Note, NoteNumberFormat = NoteNumberFormat.Letter }; MidiFile midiFile = csv.ConvertCsvToMidiFile(filePath, setting); this.file = midiFile; this.title = ""; this.midiFormat = midiFile.OriginalFormat.ToString(); this.timeDivision = midiFile.TimeDivision.ToString(); this.duration = new MidiTime(midiFile.GetDuration(TimeSpanType.Midi).ToString(), midiFile.GetTempoMap()); this.tracks = new List <MidiTrack>(); this.timeSignatures = new List <MidiTimeSignature>(); this.tempo = new List <MidiTempo>(); initFrequencies(440); parseTracks(midiFile); initTimeSignatures(); }
public MidiTempo(long startTime, long value, TempoMap tempoMap) { this.time = new MidiTime(startTime, tempoMap); this.midiValue = value; this.bpm = Convert.ToInt32(60000000 / value); }
public MidiPitchBend(long startTime, int value, TempoMap tempoMap) { this.time = new MidiTime(startTime, tempoMap);; this.value = value; }