Yeah, the individual messages thing is great, but also kinda weird. The
typical use case for a note-on message is to turn a note on, which is why
the keywords `freq`, `gate`, and `gain` are great as generic catch-alls for
a poly (or mono) instrument.

I can see how it's more generally cool and useful for `0xBn` control
signals.

What you propose, Stéphane, could work - "[midi:on CHAN]"... and/or having
the ability to specify `-midi_channel X` where X is 1-16, on the command
line wrapper script. Either way would be better than having to manually
hack the `.cpp` file!

Aaron Krister Johnson
Music, etc.:
https://soundcloud.com/aaron-krister-johnson
https://soundcloud.com/filtercreed
https://www.youtube.com/channel/UC_utjGYbSizWE0dNyr0Vdmg
https://aaronkristerjohnson.bandcamp.com/
http://www.untwelve.org
Code:
https://github.com/akjmicro <http://www.untwelve.org>


On Tue, Dec 9, 2025 at 3:11 PM Stéphane Letz <[email protected]> wrote:

> See : https://faustdoc.grame.fr/manual/midi/#configuring-midi-in-faust
>
> We already have MIDI channel for individual messages ,
>
> We could possibly extend the global: declare options "[midi:on] »;   with
> an extended version: declare options "[midi:on  CHAN] »; that would
> specific a given CHAN for all MIDI aware controllers ?
>
> Stéphane
>
> > Le 9 déc. 2025 à 22:30, Aaron Krister Johnson <[email protected]> a
> écrit :
> >
> > Hi,
> >
> > In case anyone else was interested in this issue, I wanted to report my
> process to successfully get a Faust executable for e.g. a synth to only
> listen to one particular MIDI channel (by default, for ON, OFF, CTRL, BEND
> messages will respond to ALL MIDI channels).
> >
> > In short, if you look at what the shell scripts that compile a `.dsp`
> file do, they first call `faust` to get a `.cpp` file that wraps an
> architecture file. If you recreate this process by seeing what the actual
> command that run are with bash debugging on:
> >
> >     bash -x /usr/bin/faust2jackconsole -osc -midi -nvoices 1
> your_synth.dsp
> >
> > ...you'll see the `faust` command that spits out a `.cpp` file. Run this
> separately, then edit lines that look something like:
> >
> > if (type == MIDI_NOTE_ON) {
> >     ...
> > }
> >
> > and change them to:
> >
> > if (type == MIDI_NOTE_ON & channel == 2) {  // if you want to only
> listen on channel 3
> >     ...
> > }
> >
> > Do this for the stanzas for `MIDI_NOTE_OFF`, `MIDI_PITCH_BEND`, etc. and
> any message type you want to filter by channel.
> >
> > Once you've finished editing the `.cpp` file, continue running the `c++`
> command you saw the faust wrapper script (e.g. `faust2jackconsole`) spit
> out.
> >
> > When you test it, you'll see that your instrument will properly only
> respond to the midi channel you edited it to respond to. Bear in mind, midi
> channel 1 is `0` in code, and 2 is `1`, etc. etc. i.e. for MIDI_NOTE_ON:
> >
> > 0x90          // channel 1
> > 0x91          // channel 2
> > 0x92          // channel 3
> > etc. etc.
> >
> > Hope this helps someone else wanting to do the same.
> >
> > Devs: should be a simple matter to make this dynamic from `faust` itself
> so that the front-end can make this easy with an extra optional parameter,
> like so....?:
> >
> >     faust2jackconsole -osc -midi -nvoices -midi_channel 4 -effect auto
> my_synth.dsp
> >
> > Where `-midi_channel ...` would be the new option that would effectively
> alter those intermediate `.cpp` lines I refer to.
> >
> > Aaron Krister Johnson
> > Music, etc.:
> > https://soundcloud.com/aaron-krister-johnson
> > https://soundcloud.com/filtercreed
> > https://www.youtube.com/channel/UC_utjGYbSizWE0dNyr0Vdmg
> > https://aaronkristerjohnson.bandcamp.com/
> > http://www.untwelve.org
> > Code:
> > https://github.com/akjmicro
> >
> >
> > On Mon, Sep 29, 2025 at 9:27 AM Stéphane Letz <[email protected]> wrote:
> > Not much time to work on that right now yes.
> >
> > Stéphane
> >
> > > Le 29 sept. 2025 à 18:26, Aaron Krister Johnson <[email protected]>
> a écrit :
> > >
> > > Stephane et al,
> > >
> > > Gentle nudge here: any more thoughts on this MIDI channel issue, or is
> the best approach for now to work (or hack) around it?
> > >
> > > Aaron Krister Johnson
> > > Music, etc.:
> > > https://soundcloud.com/aaron-krister-johnson
> > > https://soundcloud.com/filtercreed
> > > https://www.youtube.com/channel/UC_utjGYbSizWE0dNyr0Vdmg
> > > https://aaronkristerjohnson.bandcamp.com/
> > > http://www.untwelve.org
> > > Code:
> > > https://github.com/akjmicro
> > >
> > >
> > > On Sun, Sep 21, 2025 at 9:29 AM Aaron Krister Johnson <
> [email protected]> wrote:
> > > I guess this is a hack, but for keyOn and keyOff coming from the
> polyphony code (which I traced from looking for `freq` references) I'm
> thinking changing these in `poly-dsp.h` to further filter by channel at
> compile time would be key?
> > >
> > >         // MIDI API
> > >         MapUI* keyOn(int channel, int pitch, int velocity)
> > >         {
> > >             if (checkPolyphony()) {
> > >                 int voice = getFreeVoice();
> > >                 fVoiceTable[voice]->keyOn(pitch, velocity,
> fVoiceTable[voice]->fCurNote == kLegatoVoice);
> > >                 return fVoiceTable[voice];
> > >             } else {
> > >                 return 0;
> > >             }
> > >         }
> > >
> > >         void keyOff(int channel, int pitch, int velocity = 127)
> > >         {
> > >             if (checkPolyphony()) {
> > >                 int voice = getPlayingVoice(pitch);
> > >                 if (voice != kNoVoice) {
> > >                     fVoiceTable[voice]->keyOff();
> > >                 } else {
> > >                     fprintf(stderr, "Playing pitch = %d not found\n",
> pitch);
> > >                 }
> > >             }
> > >         }
> > >
> > > Change to:
> > >
> > >         // MIDI API
> > >         MapUI* keyOn(int channel, int pitch, int velocity)
> > >         {
> > >             if (checkPolyphony() & (channel == 1)) {  // to respond
> only to MIDI channel 2, actual number is MIDI channel - 1
> > >                 int voice = getFreeVoice();
> > >                 fVoiceTable[voice]->keyOn(pitch, velocity,
> fVoiceTable[voice]->fCurNote == kLegatoVoice);
> > >                 return fVoiceTable[voice];
> > >             } else {
> > >                 return 0;
> > >             }
> > >         }
> > >
> > >         void keyOff(int channel, int pitch, int velocity = 127)
> > >         {
> > >             if (checkPolyphony() & (channel == 1)) {  // to respond
> only to MIDI channel 2, actual number is MIDI channel - 1
> > >                 int voice = getPlayingVoice(pitch);
> > >                 if (voice != kNoVoice) {
> > >                     fVoiceTable[voice]->keyOff();
> > >                 } else {
> > >                     fprintf(stderr, "Playing pitch = %d not found\n",
> pitch);
> > >                 }
> > >             }
> > >         }
> > >
> > > But yes, would be better to allow the polyphony/voice-table
> architecture to be more standards compliant about channels, I'm thinking.
> I'll test this, for now it will do if it works.
> > >
> > > Aaron Krister Johnson
> > > Music, etc.:
> > > https://soundcloud.com/aaron-krister-johnson
> > > https://soundcloud.com/filtercreed
> > > https://www.youtube.com/channel/UC_utjGYbSizWE0dNyr0Vdmg
> > > https://aaronkristerjohnson.bandcamp.com/
> > > http://www.untwelve.org
> > > Code:
> > > https://github.com/akjmicro
> > >
> > >
> > > On Sun, Sep 21, 2025 at 8:26 AM Aaron Krister Johnson <
> [email protected]> wrote:
> > > Is this MIDI channel filtering option being considered? If not, would
> the dev team welcome a patch if I tried my hand at it?
> > >
> > > ~AKJ
> > >
> > > Aaron Krister Johnson
> > > Music, etc.:
> > > https://soundcloud.com/aaron-krister-johnson
> > > https://soundcloud.com/filtercreed
> > > https://www.youtube.com/channel/UC_utjGYbSizWE0dNyr0Vdmg
> > > https://aaronkristerjohnson.bandcamp.com/
> > > http://www.untwelve.org
> > > Code:
> > > https://github.com/akjmicro
> > >
> > > On Fri, Sep 12, 2025, 13:31 Aaron Krister Johnson <[email protected]>
> wrote:
> > > Ah, so it seems others have bumped into this limitation.
> > >
> > > Please, Faust devs, implement this! :D
> > >
> > > Aaron Krister Johnson
> > > Music, etc.:
> > > https://soundcloud.com/aaron-krister-johnson
> > > https://soundcloud.com/filtercreed
> > > https://www.youtube.com/channel/UC_utjGYbSizWE0dNyr0Vdmg
> > > https://aaronkristerjohnson.bandcamp.com/
> > > http://www.untwelve.org
> > > Code:
> > > https://github.com/akjmicro
> > >
> > >
> > > On Thu, Sep 11, 2025 at 2:17 AM <[email protected]> wrote:
> > > Additional reading here:
> https://github.com/grame-cncm/faust/discussions/696
> > >
> > > All of this must be carefully considered...
> > >
> > > Stéphane
> > >
> > > > Le 10 sept. 2025 à 19:26, Aaron Krister Johnson <[email protected]>
> a écrit :
> > > >
> > > > P.S. -- and if this is implemented, covering key/vel/velocity, too :D
> > > >
> > > > Aaron Krister Johnson
> > > > Music, etc.:
> > > > https://soundcloud.com/aaron-krister-johnson
> > > > https://soundcloud.com/filtercreed
> > > > https://www.youtube.com/channel/UC_utjGYbSizWE0dNyr0Vdmg
> > > > https://aaronkristerjohnson.bandcamp.com/
> > > > http://www.untwelve.org
> > > > Code:
> > > > https://github.com/akjmicro
> > > >
> > > >
> > > > On Wed, Sep 10, 2025 at 10:23 AM Aaron Krister Johnson <
> [email protected]> wrote:
> > > > Thanks, Stephane, yes, it would be most useful to have a Faust synth
> only respond on a declared channel, and `0` (or no specification) being
> "listen on all channels".
> > > >
> > > > Would this be in the "options" header, then?
> > > >
> > > > Aaron Krister Johnson
> > > > Music, etc.:
> > > > https://soundcloud.com/aaron-krister-johnson
> > > > https://soundcloud.com/filtercreed
> > > > https://www.youtube.com/channel/UC_utjGYbSizWE0dNyr0Vdmg
> > > > https://aaronkristerjohnson.bandcamp.com/
> > > > http://www.untwelve.org
> > > > Code:
> > > > https://github.com/akjmicro
> > > >
> > > >
> > > > On Wed, Sep 10, 2025 at 9:00 AM Stéphane Letz <[email protected]> wrote:
> > > > Hi Aaron,
> > > >
> > > > MIDI metadata for standard MIDI control can use MIDI channel:
> https://faustdoc.grame.fr/manual/midi/#configuring-midi-in-faust
> > > >
> > > > But it is currently not possible to set a given channel for
> polyphony, you can see that the channel info is not used in the polyphonic
> code for now:
> > > >
> > > >
> https://github.com/grame-cncm/faust/blob/f5c23da4fe6e09fa55667ae588f4b6ef9c226cae/architecture/faust/dsp/poly-dsp.h#L900
> > > >
> > > > Should we extend/revisit the syntax of freq/gate/gain convention for
> something like [freq: chan],  [gate: chan],  [gain: chan], with the
> convention chan = 0 would mean « receive on all channels», like for other
> MIDI messages ?
> > > >
> > > > Stéphane
> > > >
> > > > > Le 10 sept. 2025 à 17:35, Aaron Krister Johnson <
> [email protected]> a écrit :
> > > > >
> > > > > I notice in the manual, certain MIDI slider metadata operations
> can be filtered by a certain MIDI channel, like `keyon` uses the velocity
> of a given key on a given channel.
> > > > >
> > > > > But IMO, these kinds of operations seem geared towards a
> non-standard way of using a MIDI signal. Most useful mono- or poly- synths
> would want to use the general
> > > > > keywords with special meaning: `freq/key`, `gain/vel`, and `gate`
> to drive the usually needed MIDI parameters in, for instance, a synthesizer
> signal chain.
> > > > >
> > > > > The problem I am having is: I'd like to pair a custom Faust synth
> with an outboard analog monosynth. Ideally, I could assign Faust to listen
> only on a certain MIDI channel.
> > > > > As it is, it seems like I have to do the opposite: Faust will
> respond to _all_ channels (not ideal) and I make the hardware synth respond
> to MIDI channel 2. They are isolated only
> > > > > by the fact that they are listening on different MIDI ports
> (otherwise, the Faust synth would be "hearing" both channels and trying to
> respond to both). What I have works for now,
> > > > > but let's say I want 2 Faust synths -- they'd both be responding
> to all channels that particular virtual port is listening on.
> > > > >
> > > > > So, in short: is there an easy way to make a running Faust synth
> instance listen only to a particular MIDI channel when it's designed to use
> the keywords `freq`, `gain`, and `gate`,
> > > > > per the docs? How easy would it be to hack Faust or add a feature
> for users for this if not?
> > > > >
> > > > > Aaron Krister Johnson
> > > > > Music, etc.:
> > > > > https://soundcloud.com/aaron-krister-johnson
> > > > > https://soundcloud.com/filtercreed
> > > > > https://www.youtube.com/channel/UC_utjGYbSizWE0dNyr0Vdmg
> > > > > https://aaronkristerjohnson.bandcamp.com/
> > > > > http://www.untwelve.org
> > > > > Code:
> > > > > https://github.com/akjmicro
> > > > > _______________________________________________
> > > > > Faudiostream-users mailing list
> > > > > [email protected]
> > > > > https://lists.sourceforge.net/lists/listinfo/faudiostream-users
> > > >
> > >
> >
>
>
_______________________________________________
Faudiostream-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/faudiostream-users

Reply via email to