fluid-dev
[Top][All Lists]
Advanced

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

Re: [fluid-dev] Some questions about Midi playback


From: Josh Green
Subject: Re: [fluid-dev] Some questions about Midi playback
Date: Sun, 09 Jul 2006 22:39:26 +0200

On Mon, 2006-06-26 at 14:27 +0200, Sebastien Frippiat wrote:
> Hi again !
> 
> I finally managed to do what I wanted to do without too much trouble. I 
> know it is not the main purpose of fluidsynth but as I don't think of my 
> modifications are a ugly hack, I post my code here. In fact, it add 
> three functions :
> - fluid_player_set_tempo_multiplier : multiply all received tempo by a 
> specified multiplier (useful for accelerating / slowing down music playback)
> - fluid_player_set_velocity_multiplier : multiply all notes velocities 
> by a specified multiplier (useful for decreasing volume)
> - fluid_player_set_midi_event_callback : call a specified callback 
> function on any Midi event and that function can specify wheter 
> FluidSynth must forward the event to the synthetizer
> 
> I wrote the first two functions last week and I posted the code on the 
> mailing list. For a quick explaination, I needed these functions to be 
> able to play some sort of adaptative music (like with DirectMusic for 
> those who know it).
> 
> The last one is in fact to redirect the Midi events to a real Midi 
> device. There seems to be something planned/ (?) in FluidSynth about 
> routers which would allow to apply filters to Midi events. However, like 
> said in the docs, it is only used for Midi inputs (and not Midi file 
> playback). With my modification, if you specify a callback and tell 
> FluidSynth to forward the event to the synthetizer, you'll be able to 
> provide feedback to the user of your application (add events to log, 
> show visual feedback like notes being played...). I personnaly used it 
> to prevent FluidSynth playing the Midi file and processed the event 
> myself. It allows me to load a .mid file and to play it without having 
> to take care of timing as fluidsynth already do it.
> 
> Even if it is not the main purpose of this lib, I do think that my code 
> is quite clean (I also wrote the Doxygen documentation to the functions) 
> and that it could be useful to some other people. Anyway, whether you 
> want it or not... here it is, attached to my post.
> 
> You need to copy the patch file into the fluidsynth directory and run 
> "patch -u -i fluidsynth_modifs.patch -p 1". Then copy the mididefs.h 
> file in the include/fluidsynth.h directory. I had to add it because the 
> _fluid_midi_event_t was defined in src/fluid_midi.h but not in 
> include/fluidsynth/midi.h and it was not accessible to users of the library.
> 
> Thanks for your advices,
> Sebastien Frippiat


Pardon the late reply, I've been neglecting FluidSynth a bit lately as
other things have been higher priority.

Thanks for contributing this code.  There is currently a bit of a back
log of tasks that need to be done with FluidSynth.  I'll add this to the
list of items though, to see what would be the proper way to apply your
changes.  At some point I'd like to add non-realtime rendering of MIDI
files to audio files (in other words, faster than real time).  That
would probably be the most convenient time to look over these changes.

You're functions do seem rather useful, I'd just like to check and make
sure there isn't any functionality being duplicated.  I'm not completely
familiar with the FluidSynth code base since I took over the project
from the previous author so sometimes I have to do a bit of code review
before I get the bigger picture.  Cheers.

        Josh Green






reply via email to

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