fluid-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [fluid-dev] invalid instrument/drum selection problem


From: jimmy
Subject: Re: [fluid-dev] invalid instrument/drum selection problem
Date: Mon, 26 Jan 2009 07:05:13 -0800 (PST)

Hi Josh,

I am replying to an old message so you can hunt down the original messages with 
the same email subject line if it may help refresh your memory.  This time, 
similar problem, different midi song.

Let me refresh your memory of the scenario.  The result was that even if an 
invalid bank_num, or prog_num was selected, fluidsynth keeps the existing 
instrument already in that channel.  Previously, fluidsynth assigned invalid 
bank_num, or prog_num to the channel anyway which causes the channel to point 
to non-existing instrument so the whole channel was muted.  From what I 
understand, hardware soundcards would keep existing instruments and won't allow 
invalid selection of bank_num, or prog_num to mute the channel, it just keep 
playing the already loaded instrument.

I think the ticket number was:

   http://fluidsynth.resonance.org/trac/ticket/8

The midi files to test were:

www.geocities.com/TheTropics/Cabana/4967/inicial.html
www.geocities.com/TheTropics/Cabana/4967/Amor_Eterno.mid
www.geocities.com/TheTropics/Cabana/4967/Ansiedad.mid
www.geocities.com/TheTropics/Cabana/4967/allanera.mid
www.geocities.com/TheTropics/Cabana/4967/Bailamos.mid
www.geocities.com/TheTropics/Cabana/4967/bamboleo.mid
www.geocities.com/TheTropics/Cabana/4967/besame.mid
www.geocities.com/TheTropics/Cabana/4967/caballo.mid


You did fix up fluidsynth using those midi files as test cases.

Recently, I try listening to some at www.sternton.com/midi/xgmidi/ .  I try to 
play this midi file:

   www.sternton.com/midi/xgmidi/orion_xg.mid

For what it's worth, Debian timidity 2.13.2-20 plays it just fine, so does a 
SoundBlaster 5.1 Live! PCI card.

However, I try with both Debian fluidsynth 1.0.8-1.1, and 
fluidsynth.svn.20090108.  What I seem to get is that the drum channel still 
plays drum just fine, but a few channels seem to load up invalid instrument, 
and causes the channel to turn mute.

So far, I tracked it down to the following code in src/fluid_synth.c:

>>>

int fluid_synth_program_select( . . .)

  . . .

  preset = fluid_synth_get_preset(synth, sfont_id, bank_num, preset_num);
  if (preset == NULL) {
    FLUID_LOG(FLUID_ERR,
             "There is no preset with bank number %d and preset number %d in 
SoundFont %d",
             bank_num, preset_num, sfont_id);
    return FLUID_FAILED;
  }

<<<

I believe the "preset" variable should have been set to NULL because the 
bank_num is not available for the loaded soundfonts, but 
fluid_synth_get_preset() returns a non-NULL value.  So the "preset" would be 
used a few statements below that to select the invalid instrument.

Can you take a look when you have a chance?  This is low priority, casual 
listening for me.  Let me know if you can reproduce the problem, or if I could 
be of any further help.  Thanks,

Jimmy



--- On Wed, 1/9/08, jimmy <address@hidden> wrote:

> From: jimmy <address@hidden>
> Subject: Re: [fluid-dev] invalid instrument/drum selection problem
> To: "Josh Green" <address@hidden>
> Cc: address@hidden
> Date: Wednesday, January 9, 2008, 10:50 AM
> --- Josh Green <address@hidden> wrote:
> 
> > Hello Jimmy,
> > 
> > On Mon, 2008-01-07 at 16:15 -0800, jimmy wrote:
> > > For quick test, I use Kmid to play the MIDI
> files,
> > > connect to Qsynth/FluidSynth wiht QJackctl.  I
> > drag
> > > the MIDI file to Kmid and it interrupts the
> > existing
> > > playing, starting to play the new file.  So
> > probably
> > > Fluidsynth doesn't know much (or just
> guessing)
> > about
> > > a new file being played.
> > > 
> > > But how about using FluidSynth as a sound module
> > for
> > > praticing or live playing?  If a
> > song/accompaniment
> > > ends, I may still want to have my preloaded
> > > instruments exactly the way they are, so I can
> > > continue on to the next song and not have to
> > reselect
> > > all the instruments again.
> > > 
> > 
> > If MIDI files were played directly with FluidSynth,
> > then it would have a
> > concept of when a new one started and could reset
> > accordingly.  In the
> > case where the MIDI sequencer of FluidSynth isn't
> > being used, then it
> > could still listen for SYSEX messages requesting GM,
> > GS or other modes.
> > Not all MIDI files have them, but I have seen quite
> > a few of them that
> > do.
> 
> OK, right now I don't often play a midi file by
> fluidsynth directly.  I do use Kmid, PyKaraoke, or
> even some Timidity GUI as Jack client to FluidSynth. 
> Have a separate FluidSynth instance for praticing my
> keyboarding.  Recently found Stygmorgan as a software
> arranger (for accompaniment).  I don't know how well
> each of those apps filter out, or reset in between
> segments for the time being.  If they are troublesome,
> I may haev to track them down.
> 
> 
> > > If I misunderstand the purpose of that flag, my
> > bad. 
> > > Maybe we need a new/different variable/constant.
> > > 
> > 
> > No you were right.  The code was not correct.  It
> > shouldn't be used as a
> > flag at all though, but instead as a constant value
> > of 128.  From what I
> > can tell SoundFont isn't supposed to have any bank
> > #s above 128.
> 
> Good, I trust you to make the call on what to do
> there.  Though, it is a #define so any existing apps
> that uses it may have to be recompiled.
> 
> 
> > > I think the single midi file in my first post on
> > this
> > > list uses a program change on drum channel with
> > bank
> > > number less than 128 (I suppose GS instruments
> can
> > > accommodate drum channel offset of 128),
> that's
> > what
> > > led me to think the flag value should be 128. 
> > > Especially where it is being used, to check for a
> > > valid drum bank.  I think I might have seen drum,
> > or
> > > special effect bank number 129 before. 
> That's why
> > I
> > > think it is an offset, not an absolute number
> 128.
> > 
> > > Thus the use of "|" or "+"
> 128 in my code patch.
> > > 
> > 
> > I would be really curious to see a SoundFont that
> > has a bank # above 128
> > and what software created it.  The format itself can
> > do it, but the
> > standard says its not supposed to sound.  If you see
> > one, do let me
> > know!
> 
> I'll keep an eye out for that.
> 
> 
> > > So even if GS spec says to use instrument [0 0],
> > the
> > > keyboard/sound module maps the drum channel to
> the
> > > equivalent of [128 0].  The [128 0] is the same
> > thing
> > > if used in other channels.  That's how I
> interpret
> > the
> > > GS or any other specs, because drum channel
> should
> > > never use a bank below 128 - unless there is no
> > bank
> > > 128, of course.
> > > 
> > 
> > Agreed, in GM/GS mode FluidSynth should behave that
> > way.  I would like
> > to keep it general purpose though too, so that if
> > someone wants to do
> > something else with Channel #10 than percussion,
> > they can.
> 
> Gerald just mentioned he used channel #10 for
> non-drums and all 16 channels.  I mentioned that there
> could be more than 16 channels if he needs more
> channels to use, but you are right to keep it general
> purpose.  For breaking existing MIDIs and apps are not
> a good thing to do.
> 
> I see you will get pretty busy now at the start of the
> year with all these postings :-)  Saw your other
> posted messages, too.  I think I'll let you work with
> other issues on the list.
> 
> Thanks for all the good work.  Take care,
> 
> Jimmy
> 
> 
> 
>      
> ____________________________________________________________________________________
> Be a better friend, newshound, and 
> know-it-all with Yahoo! Mobile.  Try it now. 
> http://mobile.yahoo.com/;_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ


      




reply via email to

[Prev in Thread] Current Thread [Next in Thread]