Hello, I would test the FluidSynth command line application to see how fast it renders MIDI to a file. Use the --fast-render (-F) command line switch to specify the file to write to.
For a source code example, the FluidSynth command line code is probably the best resource. Search for "fast_render" in fluidsynth/src/fluidsynth.c to see how this works. Best regards, Element Green On Mon, Oct 21, 2013 at 12:18 PM, Иван Заярный <izayar...@gmail.com> wrote: > Hi everyone) > > I faced with next problem. Midi file rendering works slowly. It can take > 20-30 seconds for one minute midi file long. > > So i've decided to design streaming generated sound data from midi to a > playback output. > > Idea is simple :generated from midi file audio data goes to output, while > synth is generating other data. > > I've tried to do it by using fluid_player. But i faced with another > problem: generated audio file sounds much faster than it should be.(than > original midi file) > > I tried to set bpm(tempo) manually, it didn't help me. It looks like > fluid_player_set_bpm() method doesn't work at all. > > Example of code used for generating audio data from midi file: > > > player = new_fluid_player(synth); > > fluid_player_add(player, midiPath); > > fluid_settings_setstr(settings, "audio.file.type", "raw"); > > fluid_settings_setnum(settings, "synth.sample-rate", 44100); > > fluid_settings_setstr(settings, "audio.file.format", "s16"); > > fluid_settings_setstr(settings, "audio.file.endian", "little"); > > fluid_settings_setint(settings, "audio.period-size", 4096); > > fluid_player_play(player); > > fluid_player_set_bpm(player,65);// i get tempo from test midi file. > > fluid_synth_write_s16(synth, buffersize / 2 , buffer2 ,0 , 2, buffer2, 1, > 2); > > I attached test data to email. > > Could you give me an example of how to generate audio data from midi file > to memory in "streaming manner"? > > What’s wrong with my code example ? Is it bug of fluid player or i am just > incorrectly using fluidSynth lib? > > > _______________________________________________ > fluid-dev mailing list > fluid-dev@nongnu.org > https://lists.nongnu.org/mailman/listinfo/fluid-dev > >
_______________________________________________ fluid-dev mailing list fluid-dev@nongnu.org https://lists.nongnu.org/mailman/listinfo/fluid-dev