Hello Chris,

 

 

>When I am jamming away on a lot of keys at one time on the keyboard it seems 
>to sometimes miss midi noteon or noteoff events...

>It also happens that some notes don't turn on sometimes....

 

>I verified this by adding an error printout to my program to detect noteoff 
>events for notes that are already off and noteon events for notes that are 
>already on.

Be aware that when releasing a key, we cannot predict that a noteoff message 
will be generated. Most MIDI keyboard (low and medium cost) send a MIDI noteon 
with velocity set to 0.

 

So as it seems that there is a lost of messages (noteon, and noteoff) somewhere 
in the path between your MIDI keyboard and the

the MIDI driver output (i guess you use a MIDI keyboard).

The first thing to do is to verify that your keyboard send a MIDI message when 
a key is depressed, and another MIDI message when a key is released.

To do this check , we can simply print  "MIDI message received" ( regardless of 
the type of MIDI message !) in your intercept() function.

 
int intercept(void* data, fluid_midi_event_t* event)
{
  printf(MIDI message received\n");
  return fluid_synth_handle_midi_event((fluid_synth_t*) data, event);  
}
 

 

>The only warning fluidsynth prints out is this: "fluidsynth: warning: 
>Requested a period size of 64, got 256 instead"
>I don't think this would be related to not receiving midi events right??
 

Right, this is only related to the audio driver that said that actually you 
have requested a period size of 64 (audio.period-size=64) and it this

value is not possible so the driver had raised the buffer size to 256.

Generally using RPi we get this message when using the default RPI audio card 
(on 3,5 jack output). This audio card is a PWM device and doesn't

allow low latency. In this case we need to set audio.period-size= 1024 minimum 
otherwise we get a distorded output. Also, this kind of audio card

is really poor quality. All this is true for RPi 2. For RPi 3, i don't know but 
i am looking forward for your report, thanks.

 

jjc.

> Message du 08/06/18 05:21
> De : "Christopher Leger" 
> A : "Tom M." 
> Copie à : "FluidSynth mailing list" 
> Objet : Re: [fluid-dev] Intercepting midi events
> 
>
Thanks Tom for realizing my very stupid mistake! I've made some changes and I 
have got almost everything working how I wanted it to.

>
However, I have one issue and this problem happens only when I am running 
Fluidsynth on my Raspberry Pi 3. When I am jamming away on a lot of keys at one 
time on the keyboard it seems to sometimes miss midi noteon or noteoff events. 
I know this because when running Fluidsynth (compiled from the original git 
source code) if I set the midi channel to an organ and I press a lot of keys 
and I pull away my hands one or two notes will still be sustaining. It also 
happens that some notes don't turn on sometimes.

>
I verified this by adding an error printout to my program to detect noteoff 
events for notes that are already off and noteon events for notes that are 
already on. Sure enough I get  one of these error printouts when I hear an 
issue. 

>
I checked with top and the PI has plenty of memory and cpu power available when 
running fluidsynth. The only warning fluidsynth prints out is this:

>
fluidsynth: warning: Requested a period size of 64, got 256 instead
>

>

>
I don't think this would be related to not receiving midi events right??

>
Any suggestions?

>
Thanks for the help,
-Chris


>



>

On Mon, Jun 4, 2018 at 12:53 AM Tom M.  wrote:
>
> #include "fluid_midi.h"
> > #include "fluid_sfont.h"
> 
> I will never understand why people keep including fluidsynths private 
> headers. And I'm so tired of repeating that this way of programming is 
> undefined behaviour as there is no API / ABI stability guarantee for internal 
> data types and functions. That's why there are accessor functions of all 
> kinds.
> 
> 
> > new_fluid_midi_driver(settings, intercept, NULL);
> 
> You bascially asked for the synth instance being NULL. Have you read the API 
> doc of new_fluid_midi_driver() ?
> 
> http://www.fluidsynth.org/api/midi_8h.html#ad0971af69fb51398d468b151cba70bee
> 
> 
> Also you are deleting the synth before deleting the midiDriver. This will 
> cause the midiDriver to call a deleted synth instance. You must always 
> cleanup all objects exactly in the reverse order you've created them.
> 
> And your `fluid_midi_driver_t* midiDriver` will be uninitialized if any of 
> the `goto cleanup` happens.
> 
> Tom
> 
>




_______________________________________________
fluid-dev mailing list
fluid-dev@nongnu.org
https://lists.nongnu.org/mailman/listinfo/fluid-dev

_______________________________________________
fluid-dev mailing list
fluid-dev@nongnu.org
https://lists.nongnu.org/mailman/listinfo/fluid-dev

Reply via email to