[Top][All Lists]

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

[fluid-dev] Streaming midi rendering data

From: Иван Заярный
Subject: [fluid-dev] Streaming midi rendering data
Date: Mon, 21 Oct 2013 22:18:02 +0400

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_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?

reply via email to

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