bugDenemo - Bugs: bug #40911, MIDI instrument list is not correct

 
 

bug #40911: MIDI instrument list is not correct

Submitted by:  None
Submitted on:  Mon 16 Dec 2013 12:11:59 PM UTC  
 
Category: NoneSeverity: 3 - Normal
Item Group: NoneStatus: Fixed
Privacy: PublicAssigned to: None
Open/Closed: Closed

Add a New Comment(Rich Markup)
   

You are not logged in

Please log in, so followups can be emailed to you.

 

(Jump to the original submission Jump to the original submission)

Sun 22 Dec 2013 09:09:18 PM UTC, comment #10:

Ok I think this is ok now. Thank you very much.

Richard Shann <rshann>
Project Administrator
Sun 22 Dec 2013 06:36:42 PM UTC, comment #9:

cool - I had just started an attempt leading to just a strange segfault i cannot make sense of, sigh, i'm pretty out of energy right now... though i'm getting curious what the solution will look like :)

Anonymous
Sun 22 Dec 2013 06:20:39 PM UTC, comment #8:

sorry - I didn't mean to suggest you should actually do it, more a memo to myself... I'm just fixing another bug right now and will get to this next. It looks like you have the right approach (I tried and failed to make sense of it all). As I say, I think it needs an array to be filled in and then the list constructed from that.

Richard Shann <rshann>
Project Administrator
Sun 22 Dec 2013 06:08:09 PM UTC, comment #7:

As I said I'm not an experienced coder but i somehow suspected tat this wouldn't work, in fact I was surprised that I ended up with a filled list at all after attempting this... so what would be the correct approach, first fill the list with pseudo values so that it exists before inserting, or add another string array for sorting before transferring to this list? I feel a bit lost, first of all I just wanted to point out how to obtain the correct preset ordering, and now I realize I cannot translate that into working code.

Anonymous
Sun 22 Dec 2013 06:06:53 PM UTC, comment #6:

Sorry I didn't notice you had replied, but what I wrote will be the answer to what you are seeing - the GList is being built in some indeterminate order.
Instead put the elements into an array of size npresets, and then traverse the array putting them into the list.

Richard Shann <rshann>
Project Administrator
Sun 22 Dec 2013 06:00:38 PM UTC, comment #5:

Having said that, I don't think this code can be right:

instrument_list = g_list_insert (instrument_list, g_strdup ((gchar *) name), preset);

g_list_insert inserts at a place in a list. But for random values of preset that place will not exist, so it will default to inserting somewhere else.

Richard Shann <rshann>
Project Administrator
Sun 22 Dec 2013 05:59:23 PM UTC, comment #4:

Well I'm not sure... if I open the sf2 with swami I get a different preset list, one that conforms to the GM specs (1-10 pianos, 11-10 other keyed nstruments etc.)

Also the current form of the patch omits all presets other than from bank 0. But that is probably ok as there doesn't seem to be any bank management in denemo, and (IIUC) the list corrsponds to the 127 possible MIDI program changes, and those are all present now?

Anonymous
Sun 22 Dec 2013 05:46:47 PM UTC, comment #3:

I have just tried your patch and can't see any problem with it - what problem are you seeing? (I just set a couple of midi instruments and they seemed to be correct, and the list was in the right order - I am testing my own soundfont here not the standard one).

Richard Shann <rshann>
Project Administrator
Sun 22 Dec 2013 01:01:43 PM UTC, comment #2:

I'm sorry, there was a superfluous closing paranthesis in the second hunk of the diff I appended; here's the corrected (but still unfinished) diff. I'll continue investigating it this afternoon...

Edgar

(file #30064)

Anonymous
Sun 22 Dec 2013 10:52:52 AM UTC, comment #1:

I have looked into this, and found that the problem seems to be that the sf2 presets are stored in arbitrary order, not sequentially. Each preset header carries the preset name, preset number(this is what you want to sort by) and bank number.

I've tried to come up with a patch for this but it's a bit over my head, and my C skills seem to have become rusty. I extended the ParseSoundfont function to also return the bank number, and currently sort only those presets that are on bank 0, by looking at the preset number and using g_list_insert() instead of g_list_append(), and throw away everything else. For some reason I fail to understand currently, the sorting still doesn't work as it should, I hope someone can investigate. I'm not sure about the code in set_properties (struct callbackdata *cbdata), which also calls ParseSoundfont(), I haven't seen it running in gdb during my tests but I may have missed something.

I append a git diff with my changes against current master.

Edgar

(file #30063)

Anonymous
Mon 16 Dec 2013 12:11:59 PM UTC, original submission:

The instrument list that Denemo finds for the installed sound font is garbled.

Anonymous

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach File(s):
   
   
Comment:
   

Attached Files
file #30064:  denemo-sf2_presetlist.diff added by None (3KiB - text/x-patch)
file #30063:  denemo-sf2_presetlist.diff added by None (3KiB - text/x-patch)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -unavailable- added by rshann (Posted a comment)
  •  

    Do you think this task is very important?
    If so, you can click here to add your encouragement to it.
    This task has 0 encouragements so far.

    Only logged-in users can vote.

     

    Please enter the title of George Orwell's famous dystopian book (it's a date):

     

     

    Follow 4 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Sun 22 Dec 2013 09:09:18 PM UTCrshannStatusNone=>Fixed
      Open/ClosedOpen=>Closed
    Sun 22 Dec 2013 01:01:42 PM UTCNoneAttached File-=>Added denemo-sf2_presetlist.diff, #30064
    Sun 22 Dec 2013 10:52:52 AM UTCNoneAttached File-=>Added denemo-sf2_presetlist.diff, #30063

    Back to the top


    Powered by Savane 3.1-cleanup1