[Top][All Lists]

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

[fluid-dev] Streaming midi rendering data to playback output.

From: Иван Заярный
Subject: [fluid-dev] Streaming midi rendering data to playback output.
Date: Tue, 22 Oct 2013 14:03:03 +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);

Links to test data

Midi file:https://www.dropbox.com/s/agt158q7umvcuxv/testMelody.mid

Generated wave: https://www.dropbox.com/s/rt8p39zzsgbs8j7/generatedMelody.wav

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]