Replies: 9 comments 19 replies
-
Hi! It would be easier to help if you could explain a bit more what you want to achieve. There are a few different ways to intercept and modify MIDI events before they are rendered by FluidSynth. The easiest way might be either the FluidSynth-internal MIDI router or an external application (like mididings, for example). Cheers |
Beta Was this translation helpful? Give feedback.
-
I write in C++ for Windows and I think I do something similar to what I think you want to do. In my case I take MIDI In and manipulate it to simulate a theatre pipe organ, including making a graphical display of the organ console that shows what the MIDI In is doing. I only use FluidSynth for the output. You can use FluidSynth's MIDI Channel Messages, such as fluid_synth_noteon, pretty much as a one-to-one replacement for MIDI Out messages. I have all the FluidSynth output paralleling Windows MIDI Out messages so that my program can be configured to output either MIDI or FluidSynth audio. |
Beta Was this translation helpful? Give feedback.
-
Hi @drtquin - I've contributed a decent amount to pyfluidsynth, and I've written my own Python FluidSynth wrapper as part of another project that implements a custom midi message router that I think does the kind of thing you're looking for. If you look at the linked function, as well as the |
Beta Was this translation helpful? Give feedback.
-
Hello Albedo Zero, Excellent to hear from you. This is robust and professional work, but I think I'll need a bit of help to use it ;o(
Many thanks indeed. |
Beta Was this translation helpful? Give feedback.
-
Hello Bill,
Can I test your patience once again?
Having successfully intercepted messages from a MIDI keyboard, I now want to do the same from a file.
I can load and play a file using new_fluid_player(), fluid_player_add(), and fluid_player_play(), however rather than have fluidsynth play the file directly, I want to intercept the MIDI events.
I think I can do this using the custom router call back we created for intercepting MIDI keyboard events. I’ve tried using this when creating the router, ie
self.router = new_fluid_midi_router(self.settings, self.custom_router_callback, self.synth)
However this seems to do nothing: it doesn’t crash and the player still plays the file.
Guidance appreciated!
A different question: I think I’ve broken something somewhere. When I play a note on my physical MIDI keyboard, or my virtual screen keyboard, I get a very short note. This is the case for both percussive (eg piano) and sustained (eg organ) instruments. Any thoughts?
Very many thanks once again.
¬Jonathan
From: Bill Peterson ***@***.***>
Sent: 03 September 2021 21:08
To: FluidSynth/fluidsynth ***@***.***>
Cc: drtquin ***@***.***>; Mention ***@***.***>
Subject: Re: [FluidSynth/fluidsynth] pyfluidysnth users? (#958)
Hey, whatever works! Happy to help. Make some awesome music!
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub <#958 (reply in thread)> , or unsubscribe <https://github.com/notifications/unsubscribe-auth/AU5HKYERQABX2IZ6R655M2LUAETLTANCNFSM5B6GGUFQ> .
Triage notifications on the go with GitHub Mobile for iOS <https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675> or Android <https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub> .
|
Beta Was this translation helpful? Give feedback.
-
Hello Bill,
Fantastic!
1. The latest download (2.2.3) did indeed solve the short note problem. I thought I’d broken something!
2. Your arguments for fluid_player_set_playback_callback(self.player, self.custom_router_callback, self.synth) did the trick. I’d started down this road, but got stuck because the third argument is different to that given at https://www.fluidsynth.org/api/group__midi__player.html#ga615cfa9d81227d9253dddebc49d8edcb
I’m happy to share the work I (we) have done on fluidsynth.py. Is there an interest group or similar who might be interested?
Very best,
¬Jonathan
From: Bill Peterson ***@***.***>
Sent: 20 September 2021 16:44
To: FluidSynth/fluidsynth ***@***.***>
Cc: drtquin ***@***.***>; Mention ***@***.***>
Subject: Re: [FluidSynth/fluidsynth] pyfluidysnth users? (Discussion #958)
Hi, Jonathan - no problem. I'll answer the second question first by saying I think you just need to grab the latest release of FluidSynth - the note-squashing sounds like #935 <#935> , which was fixed in v2.2.2.
To get your player to send its events to your custom (or any) router, you just need to call fluid_player_set_playback_callback() on it, e.g.
fluid_player_set_playback_callback(self.player, self.custom_router_callback, self.synth)
When first created, the player's playback_callback is set to send directly to the synth by default, which is why you can hear it but your router has no effect.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub <#958 (reply in thread)> , or unsubscribe <https://github.com/notifications/unsubscribe-auth/AU5HKYHRFIHQE5EWFVNVABTUC5JCPANCNFSM5B6GGUFQ> .
Triage notifications on the go with GitHub Mobile for iOS <https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675> or Android <https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub> .
|
Beta Was this translation helpful? Give feedback.
-
I'm trying to stop a file playing by calling |
Beta Was this translation helpful? Give feedback.
-
Per the above, I'm using the fluid player to read in a MIDI file, and intercepting the events generated by the player. I have a handle on most events being generated, however I'm not sure how to handle event 0x51. I think this means set tempo, however I can't see how to extract the tempo from the event. Once I have the tempo, I assume I can set the tempo with fluid_player_set_tempo() |
Beta Was this translation helpful? Give feedback.
-
Hi, Working on DrumNotes an addon to Music21 to play drum parts, I dev a StreamPlayer full based on FluidSynth. python3 fluidsynth_test.py and see 2 different callbacks to intercept MIDI events working. Hope it can help. JB. |
Beta Was this translation helpful? Give feedback.
-
Sadly I'm a Python programmer, not a C programmer.
I've made some good progress with a music teaching application based around pyfluidsynth, the Python Fluidsynth wrapper. However I now need to understand how in Python I can intercept events generated by a MIDI keyboard.
Any pointers to helpful sources much appreciated.
Beta Was this translation helpful? Give feedback.
All reactions