fluid-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[fluid-dev] Drunken drummer and fluidsynth


From: D.Bartolec
Subject: [fluid-dev] Drunken drummer and fluidsynth
Date: Tue, 7 Apr 2009 23:16:37 +1000

Hi,
 
I've written simple windows console test app that opens midi port, accepts and plays messages through fluidsynth.
Thing that struck me straight away is drunken drummer style of percussion channel.
 
If you play reasonably complex MIDI file from hardware (MIDI sequencer) or software (PowerTracksPro) device it is likely to start falling apart
within the first few beats. It is not going out of sync. It is only that drum beats are going to be missed and in some cases drum track is not going to produce any sound at all.
 
I had a look at the code and it appears to be that fluid_synth_noteon() is handling notes correctly for melodic channels.
However, that might not be correct for percussive channels that are likely to be turned on and off rapidly.
 
I did a quick hack on my source base and it fixed it straight away. 
The fix is to check for channel number 9 or MSB bit of the bank set and not call
fluid_synth_noteoff() and fluid_synth_release_voice_on_same_note().
They should be called only for melodic channels.
 
This fixes it straight away and the reason is obvious.
If application is hooked to MIDI in port, or MIDI file is played using fluid_player_t, some of the drum beats are going to be presented to app within the same millisecond.
Current code will turn them off before it had a chance to be played.
 
I need to check MIDI specs but it seems to be that percussive channels need to be treated with caution.
 
Let me know what do you think.
 
Proper way of handling this would be to check for bank MSB on channel, rather than to rely on channel 9 being drum tracks.
 
Regards!
 
 Dub Bartolec
 

reply via email to

[Prev in Thread] Current Thread [Next in Thread]