Giter VIP home page Giter VIP logo

Comments (4)

kentron avatar kentron commented on June 11, 2024 1

Hi AlbedoZero, thank you again for the detailed information about fluidsynth internals. While I am still not quite sure how to implement this purely using the bank files, for a current solution I'm using a combination of program change and patches, which add specific programs from different pipe organ sounfonts , creating a mix.

Ill try to think on an implementation to emulate the way a pipe organ behaves. Perhaps some bank files can have a directive at the init level, to separate banks and its rules from the 'normal' banks. I'll write you later 👍

from fluidpatcher.

albedozero avatar albedozero commented on June 11, 2024

Unfortunately the only way to remove a rule once it's added to the router is to clear all the rules and start again. As the FluidSynth API states, once you pass a rule to fluid_midi_router_add_rule() it should not be accessed again. This is because rules are stored in the router in a linked-list structure - removing a rule would break the link and probably cause a segfault. I think delete_fluid_midi_router_rule() is meant to be used on a rule you've created but not yet added to the router.

What's your reason for not wanting to use CC7=0 to mute particular channels? I know that this can cause unwanted behavior if you also use the volume slider on your keyboard to control the volume on all channels - those muted voices will pop back on if you move the slider. The workaround is to use CC11 to mute voices when needed as discussed in FluidPatcher Lesson 4. The sound volume is the product of MIDI volume (CC7) and Expression (CC11), so an expression level of 0 is unaffected by changing the volume. This was designed into the MIDI specification for pretty much this exact reason. Here's an example bank file that would do something like you're suggesting:

patches:
  Drawbars:
    1: organ/Oberheim OB-3.sf2:000:001
    2: organ/Oberheim OB-3.sf2:000:002
    3: organ/Oberheim OB-3.sf2:000:003
    router_rules:
    - {type: note, chan: 1=2-3}
    - {type: cc, chan: 1, par1: 13=11}
    - {type: cc, chan: 1=2, par1: 14=11}
    - {type: cc, chan: 1=3, par1: 15=11}
    - {type; cc, chan: 1=1-16, par1: 7}

from fluidpatcher.

kentron avatar kentron commented on June 11, 2024

Hi, thank you very much for your detailed response. I wasn't aware that fluidsynth stored routing information in a r/o structure. This changes the plan for sure.

I've red in some forum (https://www.midi.org/forum/8492-is-there-a-channel-mute-message,-and-if-so-is-it-sysex-or-a-cc) some objections about using the volume control CC7 to mute a voice, but I didn't have the time to actually test if there is any issue related with their claim.
Anyway, when I see the behavior of many sequencers, it looks like the mute button doesn't affect the volume of a particular channel. Also, I didn't find a way to query the synth to tell what is the actual CC7 value for a channel before muting, in order to restore it when reactivating the voice.... Would it be a possible alternative to use fluid_synth_unset_program/fluid_synth_program_select instead?
I was thinking to add a route rule poiting to a listener which will query fluidsynth for information about the channel, then if the program is assigned it means the state is on, otherwise off.

I don't know if that could cause any lag, since the activation/deactivation of a voice needs to be immediate. Sadly I'm out of time this week to try all this but I look forward in seven days!..

Thank you again,

from fluidpatcher.

albedozero avatar albedozero commented on June 11, 2024

I see in that forum post that someone was worried about losing polyphony to voices that are being played at zero volume. That may or may not be true for the Roland Sound Canvas, but FluidSynth allocates only the voices it needs to produce sound, and won't use them up on channels that are at zero volume, even if those channels receive notes. If you use CC 11 to mute/unmute the channels as in my example above, it will automatically restore to the volume set by CC 7 on that channel when you umute, since the total volume is the product of CC 11 and CC 7 values. Another way to do it would be to create individual patches for each combination of organ stops and switch between them - you can use a router rule with a patch parameter as described in the bank file doc to select patches directly with a button or key.

The functions fluid_synth_unset_program/fluid_synth_program_select are already wrapped, but they aren't really meant to be accessed through the FluidPatcher API. The whole point of FluidPatcher is to create patches with the programs you want on each channel, then switch between the patches. You could add code to one of the listener functions that would handle a message from your custom router rule to set/unset programs on a given channel, but there are already ways to accomplish the same effect using bank files, without having to go into the code.

from fluidpatcher.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.