Hi! I want to use fluidsynth to explore different tunings with my mathematics classes. As a start, I've modified ~example.c~ to include a 'tuning' of all notes being tuned at 200 cents, and not knowing how banks and progs work, I try to set the tuning for the full range for both bank and prog.
However, the random notes are still tuned distinctly, and I'm at a loss as to what my errors are. I have tried googling, but I can't find a clear example of fluid_synth_activate_key_tuning in use. All help would be much appreciated! Kind regards, Tarjei Bærland #include <fluidsynth.h> #if defined(WIN32) #include <windows.h> #define sleep(_t) Sleep(_t * 1000) #else #include <stdlib.h> #endif const double tuning[128] = {200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0}; int main(int argc, char **argv) { fluid_settings_t *settings; fluid_synth_t *synth; fluid_audio_driver_t *adriver; int sfont_id; int i, key; /* Create the settings. */ settings = new_fluid_settings(); fluid_settings_setstr(settings, "audio.driver", "alsa"); /* Change the settings if necessary*/ /* Create the synthesizer. */ synth = new_fluid_synth(settings); /* Create the audio driver. The synthesizer starts playing as soon as the driver is created. */ adriver = new_fluid_audio_driver(settings, synth); /* Load a SoundFont and reset presets (so that new instruments * get used from the SoundFont) */ sfont_id = fluid_synth_sfload(synth, "Sinus.sf2", 1); /* Initialize the random number generator */ for (int j = 0; j < 128; j++) { for (int k = 0; k < 128; k++) { fluid_synth_activate_key_tuning(synth, j, k, "Test", tuning, 1); } } srand(getpid()); /* fluid_synth_bank_select(synth, 0, 0); */ for(i = 0; i < 12; i++) { /* Generate a random key */ key = 60 + (int)(12.0f * rand() / (float) RAND_MAX); /* Play a note */ fluid_synth_noteon(synth, 0, key, 80); /* Sleep for 1 second */ sleep(1); /* Stop the note */ fluid_synth_noteoff(synth, 0, key); } /* Clean up */ delete_fluid_audio_driver(adriver); delete_fluid_synth(synth); delete_fluid_settings(settings); return 0; }
_______________________________________________ fluid-dev mailing list fluid-dev@nongnu.org https://lists.nongnu.org/mailman/listinfo/fluid-dev