Closed Ploppz closed 3 years ago
Some DAWs have poor midi support, such as Ableton. Bitwig was modeled after Ableton. Maybe try with timing in terms of ticks per quarter note, that works everywhere.
Thanks for the reply. I tried to give timing in relation to BPM:
const TICKS_PER_BEAT: u16 = 4_000;
const US_PER_BEAT: u32 = 1_000_000 / 2; // half a second per beat = 120 bpm
fn us_to_tick2(us: u64) -> u32 {
(TICKS_PER_BEAT as u64 * us / US_PER_BEAT as u64) as u32
}
fn midi_header2() -> Header {
Header::new(
Format::SingleTrack,
Timing::Metrical(TICKS_PER_BEAT.into()),
)
}
fn initial_message<'a>() -> MetaMessage<'a> {
MetaMessage::Tempo(US_PER_BEAT.into())
}
But again it's too long when I load it into Bitwig. Same with Ardour.
Moreover, if I change US_PER_BEAT
, the length of the MIDI clip stretches proportionally in Bitwig (probably in Ardour too, didn't test yet), which hints that Bitwig does not pay attention to the timing info in my midi file, because changing US_PER_BEAT
should not change the actual timing in the MIDI file because I use it both in the initial Tempo message and in calculation of tick from microseconds. If my math is right that is.
out.mid.zip
Yeah, that's because bitwig uses the project's bpm, but when you import the Midi file, at least it will be on the grid. And if you set the project bpm to the midi file's bpm, it should have the intended length.
Doesn't look like a midly
issue. Create two midi files from the same notes at the same timestamps, but with different US_PER_BEAT
and/or TICKS_PER_BEAT
. Then load them up in a MIDI player, or upload them here. If they play back the same in a MIDI player, it's a bitwig issue.
Okay, closing.
Maybe not an issue with this library, but I cannot seem to get timing right.
Then when I receive a midi event, I calculate the tick based on the microseconds (
us
):In a small test run that lasted less than 10 seconds, I log:
But when I import the resulting MIDI file into Bitwig, it lasts for 35 seconds... Attaching zip file with midi file inside. out.mid.zip