matsune / MidiParser

Read/Write SMF(Standard Midi Files) in Swift for iOS/macOS
MIT License
84 stars 36 forks source link

Playback speed problem #7

Open srgzah-ida opened 4 years ago

srgzah-ida commented 4 years ago

Hello. Thanks for the nice library, but there is a problem with it.

I generated a .mid file according to your instructions. Then I try to play the recording using AVMIDIPlayer. For some reason the recorded midi is played at double speed. If I set AVMIDIPlayer.rate = 0.5, then it sounds like normal. Could you help me with problem? Maybe I'm generating the midi incorrectly?

9SL9 commented 4 years ago

I agree, great library. It seems the default bpm is 60 but is playing back at 120 when you import it. I'm seeing this behaviour when I create a new midiData object from scratch. But I haven't figured out yet how to change the midi files BPM to 60 (or any other tempo) by default so a player knows what the bpm should be.

bcichowlas commented 2 years ago

I just read today that 120 is the default speed for MIDI files that don't provide a tempo, so perhaps it has something to do with that.