Weird behaviour with Calf Fluidsynth

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

Weird behaviour with Calf Fluidsynth

Bill Purvis
Hi,
Does anyone use Calf FluidSynth?
I have used it for ages now with my home-grown midi sequencer, but have
noticed
odd behaviour just lately.
This is to do with sending Program Change events. My sequence (and the
MIDI protocol)
expect channels to be numbered 0 - 15, though most programs and physical
devices tend
to refer to these as 1 - 16. That's not a problem for me. What is a
problem is Fluidsynth
now seems to be treating 0 - 15 as 2 - 17?

I'm trying to sort out a midi file for a friend - generated by a Windows
Package - and
the file has 4 tracks (not counting track 0) for Violinx3, Viola and
Cello. The midifile
treats these as channels 0 - 3, at least initially. However, Fluidsynth,
which always
starts up with Piano for all channels (except 10) sets channels 2,3,4
and 5 to these
devices. I've got a program to monitor the midi events sent over Jack
and this convinces
me that the Program Change events are specifying the right channels, so
I can only assume
that Fluidsynth is mapping 0 - 3 onto 2 - 5, which sounds like a bug.

As it happens it turns out that when the midifile want to witch to
pizzicato, it switches
to channels 4-7 (5-8 in user terms) but hasn't specified a program for
those channels!

I found the Calf website not very helpful about fluidsynth, and I don't
really want to get
signed up to another email list to discuss bugs in fluidsynth. Just
wondered if anyone
on this list had come across this.

Bill

--
+----------------------------------------+
| Bill Purvis                            |
| email: [hidden email]                  |
+----------------------------------------+
_______________________________________________
Linux-audio-user mailing list
[hidden email]
https://lists.linuxaudio.org/listinfo/linux-audio-user
Reply | Threaded
Open this post in threaded view
|

Re: Weird behaviour with Calf Fluidsynth

Robert Jonsson
Hi Bill,

Not really a Calf Fluidsynth user but I tried a few of the things you mention. I tried using MusE as host, loading the lv2 version of Calf Fluidsynth with a GM soundfont.
If I create a midi track and click on the pianoroll the synth will respond on the channel set up on the track. At least for the first three channels.
Also tried adding program change to switch between presets and it seems to behave as expected. But this is with LV2, you mention jack, is there a jack version? Have not tried that.

Regards,
Robert



Den tis 2 feb. 2021 kl 15:42 skrev Bill Purvis <[hidden email]>:
Hi,
Does anyone use Calf FluidSynth?
I have used it for ages now with my home-grown midi sequencer, but have
noticed
odd behaviour just lately.
This is to do with sending Program Change events. My sequence (and the
MIDI protocol)
expect channels to be numbered 0 - 15, though most programs and physical
devices tend
to refer to these as 1 - 16. That's not a problem for me. What is a
problem is Fluidsynth
now seems to be treating 0 - 15 as 2 - 17?

I'm trying to sort out a midi file for a friend - generated by a Windows
Package - and
the file has 4 tracks (not counting track 0) for Violinx3, Viola and
Cello. The midifile
treats these as channels 0 - 3, at least initially. However, Fluidsynth,
which always
starts up with Piano for all channels (except 10) sets channels 2,3,4
and 5 to these
devices. I've got a program to monitor the midi events sent over Jack
and this convinces
me that the Program Change events are specifying the right channels, so
I can only assume
that Fluidsynth is mapping 0 - 3 onto 2 - 5, which sounds like a bug.

As it happens it turns out that when the midifile want to witch to
pizzicato, it switches
to channels 4-7 (5-8 in user terms) but hasn't specified a program for
those channels!

I found the Calf website not very helpful about fluidsynth, and I don't
really want to get
signed up to another email list to discuss bugs in fluidsynth. Just
wondered if anyone
on this list had come across this.

Bill

--
+----------------------------------------+
| Bill Purvis                            |
| email: [hidden email]                  |
+----------------------------------------+
_______________________________________________
Linux-audio-user mailing list
[hidden email]
https://lists.linuxaudio.org/listinfo/linux-audio-user

_______________________________________________
Linux-audio-user mailing list
[hidden email]
https://lists.linuxaudio.org/listinfo/linux-audio-user
Reply | Threaded
Open this post in threaded view
|

Re: Weird behaviour with Calf Fluidsynth

Bill Purvis
Hi Robert
On 05/02/2021 17:09, you wrote:

> Hi Bill,
>
> Not really a Calf Fluidsynth user but I tried a few of the things you
> mention. I tried using MusE as host, loading the lv2 version of Calf
> Fluidsynth with a GM soundfont.
> If I create a midi track and click on the pianoroll the synth will
> respond on the channel set up on the track. At least for the first
> three channels.
> Also tried adding program change to switch between presets and it
> seems to behave as expected. But this is with LV2, you mention jack,
> is there a jack version? Have not tried that.
>
> Regards,
> Robert
I raised a query on the Fluidsynth list, and they suggested trying with
the command-line
version of fluidsynth. I tried that and it responded as it should -
which suggests the
problem is in the Calf Gui. I guess I should raise it with the Calf list
(if I can find it.)

I assume that LV2 uses either Alsa or Jack to communicate, but I've not
used LV2 at all.
Certainly Fluidsynth, and hence Calf, is quite happy using Jack. I don't
know about the
other Calf plugins, as I've never used any, other than the synth.

Bill

--
+----------------------------------------+
| Bill Purvis                            |
| email: [hidden email]                  |
+----------------------------------------+
_______________________________________________
Linux-audio-user mailing list
[hidden email]
https://lists.linuxaudio.org/listinfo/linux-audio-user
Reply | Threaded
Open this post in threaded view
|

Re: Weird behaviour with Calf Fluidsynth

Edgar Aichinger

> I raised a query on the Fluidsynth list, and they suggested trying with

> the command-line

> version of fluidsynth. I tried that and it responded as it should -

> which suggests the

> problem is in the Calf Gui. I guess I should raise it with the Calf list

> (if I can find it.)

>

> I assume that LV2 uses either Alsa or Jack to communicate, but I've not

> used LV2 at all.

> Certainly Fluidsynth, and hence Calf, is quite happy using Jack. I don't

> know about the

> other Calf plugins, as I've never used any, other than the synth.


I think I found the cause, LV2 version indeed is fine...  it's a change in calfjackhost done in 2018:


https://github.com/calf-studio-gear/calf/commit/1b37e753876fdd104a906aed1e712ff28ec4611f#diff-3fc4abf5e55f800decb309a734fcd5b32b519c7a3a8e8c7b973759593bf67009


To me it looks that this commit is just plain wrong in raising the channel number by one.


The intent (see issue #97 referenced in this commit msg) is to compensate the offset seen in calf monosynth and other synths, but apparently this change simply increases the input buffer channel by one...


So I changed line 197 in jackhost.cpp from:


 int channel = (buffer[0] & 0x0f) + 1;


to read:


 int channel = (buffer[0] & 0x0f);


and this fixes the off by one error in fluidsynth, and it seems the other synths still respond on correct channels, even if displaying 0-15 in their MIDI channel selectors.


(tried with Mamba virtual keyboard on my laptop, which also displays channels as 1 - 16)


>

> Bill

>

>



_______________________________________________
Linux-audio-user mailing list
[hidden email]
https://lists.linuxaudio.org/listinfo/linux-audio-user

signature.asc (499 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Weird behaviour with Calf Fluidsynth

Bill Purvis
On 06/02/2021 11:19, Edgar Aichinger wrote:

> I raised a query on the Fluidsynth list, and they suggested trying with

> the command-line

> version of fluidsynth. I tried that and it responded as it should -

> which suggests the

> problem is in the Calf Gui. I guess I should raise it with the Calf list

> (if I can find it.)

>

> I assume that LV2 uses either Alsa or Jack to communicate, but I've not

> used LV2 at all.

> Certainly Fluidsynth, and hence Calf, is quite happy using Jack. I don't

> know about the

> other Calf plugins, as I've never used any, other than the synth.


I think I found the cause, LV2 version indeed is fine...  it's a change in calfjackhost done in 2018:


https://github.com/calf-studio-gear/calf/commit/1b37e753876fdd104a906aed1e712ff28ec4611f#diff-3fc4abf5e55f800decb309a734fcd5b32b519c7a3a8e8c7b973759593bf67009


To me it looks that this commit is just plain wrong in raising the channel number by one.


The intent (see issue #97 referenced in this commit msg) is to compensate the offset seen in calf monosynth and other synths, but apparently this change simply increases the input buffer channel by one...


So I changed line 197 in jackhost.cpp from:


 int channel = (buffer[0] & 0x0f) + 1;


to read:


 int channel = (buffer[0] & 0x0f);


and this fixes the off by one error in fluidsynth, and it seems the other synths still respond on correct channels, even if displaying 0-15 in their MIDI channel selectors.


(tried with Mamba virtual keyboard on my laptop, which also displays channels as 1 - 16)

Fine, I trust that will percolate through. For the moment I can live with it, I'd rather
not get into recompiling Calf, got enough on my plate...

Bill
-- 
+----------------------------------------+
| Bill Purvis                            |
| email: [hidden email]                  |
+----------------------------------------+

_______________________________________________
Linux-audio-user mailing list
[hidden email]
https://lists.linuxaudio.org/listinfo/linux-audio-user