'Android how to convert a midi input to wav file

I konw how to convert a midi file to wav, and it's successful

but, I can't convert a midi input ,like some note,then convert to wav file

please help me, tks.

I mean not midi driver, for example:

fluid_synth_noteon(synth, 0, 60, 127); // play middle C
sleep(1); // sleep for 1 second
fluid_synth_noteoff(synth, 0, 60); // s

this code simulate a midi input then to play

fluid_player_add(player, midiPath);
fluid_player_play(player);

// set basic channel to export
channelToExport = jChannel;
fluid_player_set_playback_callback(player, handle_midi_event , synth);

// start conversion
renderer = new_fluid_file_renderer (synth);
while (fluid_player_get_status(player) == FLUID_PLAYER_PLAYING)
{
    if (fluid_file_renderer_process_block(renderer) != FLUID_OK)
    {
        break;
    }
}

this code can convert a midi file to .wav file to somewhere.

I want write some code in my .cpp program, I want use like fluid_synth_noteon(xxx) to simulate a midi note, then use fluid_file_renderer_process_block(xxx) to convert it to .wav file。

now, I don't know how to write this code, please help me , thanks



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source