Kara-Moon Forum
April 26, 2024, 06:04:04 PM *
Welcome, Guest. Please login or register.

Login with username, password and session length
News: You can go back to the main site here: Kara-Moon site
 
   Home   Help Search Login Register  
Pages: [1]
  Print  
Author Topic: Wrong MIDI instruments assignation  (Read 8290 times)
alexis
Jr. Member
*
Posts: 62


« on: July 11, 2011, 01:49:11 PM »

Hello all,

Please have a look at the sample in egs/solo/solo.mma
4 grooves are applied in turn : Folk, FolkBallad, Dixie, and DixieEnd.

When folk groove is applied, you should hear AcousticBass (Bass) and NylonGuitar (Chord).
But instead, you get Tuba (Bass) and Honky-Tonk Piano (Chord).

I think MMA is confused with following styles, which feature Tuba and Honky-Tonk.
The proof is, it works well when only Folk style is applied (file attached).

Bob, are you aware of this problem?

Alexis

* solo-folk.mma (0.62 KB - downloaded 371 times.)
Logged
bvdp
Kara-Moon Master
****
Posts: 1437


WWW
« Reply #1 on: July 11, 2011, 04:12:12 PM »

I know this helps little ... but it works fine from here.

I took your (my) file and ran it though mma. Next I looked at the generated midi and it appears to be fine.

The library file sets up the bass to acousticbass and the chord to nylonguitar.

If you examine the midi with mf2t and locate the instrument patches you get:

bob$ mf2t solo-folk.mid | grep PrCh
192 PrCh ch=9 p=32
192 PrCh ch=10 p=0
192 PrCh ch=15 p=24
192 PrCh ch=16 p=73

So, my questions are:

1. How are you determining that the wrong voices are being selected?

2. What version of mma and what operating system?

3. How are you playing the midi file (I'm wondering if the player is set to GM midi)?

Just to be sure, please attach your generated midi file as well so that I can compare.

Lets figure this one out! Seems to very odd.

Thanks.
Logged

My online life: http://www.mellowood.ca
alexis
Jr. Member
*
Posts: 62


« Reply #2 on: July 13, 2011, 10:31:30 AM »

Hello Bob,

Thanks for your quick answer.
Well, well, actually, the issue does not come from MMA.
I was wrong when I told that there was something wrong in MMA!
Sorry.

Let me explain:

Quote
2. What version of mma and what operating system?
I tried with the stable (1.7) and the dev version (1.7d) on Linux Ubuntu. No difference.

Quote
1. How are you determining that the wrong voices are being selected?
The subtlety is that several program changes are performed on the same channel and same track.
For example, with bass track:
Code:
META EVENT     @0.000s : tracknames = Bass
PROGRAM CHANGE @0.500s Ch=8 : 32 - 'Acoustic Bass' from 'Bass' group
PROGRAM CHANGE @13.300s Ch=8 : 24 - 'Acoustic Guitar (nylon)' from 'Guitar' group
PROGRAM CHANGE @30.900s Ch=8 : 58 - 'Tuba' from 'Brass' group


Quote
3. How are you playing the midi file (I'm wondering if the player is set to GM midi)?
Here is the point. Some sequencers only take the last Program Change in a track.
This is the case for LMMS when you import a MIDI file.
But Timidity MIDI player or MuseScore do a good job here.
End of story.

Anyway, I think MMA tracks should avoid to switch between instruments. It is confusing.
One track = one instrument (we can only have 15 channels, so two tracks could have the same channel)

Cheers

Alexis
Logged
bvdp
Kara-Moon Master
****
Posts: 1437


WWW
« Reply #3 on: July 13, 2011, 04:37:58 PM »

Thanks for letting us know that things are okay with MMA. I was starting to have nightmares Smiley


Quote
3. How are you playing the midi file (I'm wondering if the player is set to GM midi)?
Here is the point. Some sequencers only take the last Program Change in a track.
This is the case for LMMS when you import a MIDI file.
But Timidity MIDI player or MuseScore do a good job here.
End of story.

I would say that LMMS is broken. Switching voices is a pretty normal event in midi files. And MMA does do quite a bit for work to make sure that program changes are applied at the correct position in the file.

Quote

Anyway, I think MMA tracks should avoid to switch between instruments. It is confusing.
One track = one instrument (we can only have 15 channels, so two tracks could have the same channel)

Not sure that having a new track with the same channel would help. Would LMMS handle this correctly? Or would it combine the tracks? Easy for you to test:

   Create a chord track, set channel to 5 (or whatever)
   send chord data
   create a chord-1 track with a different voice and channel set to the same value
   send chord data

I suppose that we could do something which would rename all the existing MMA tracks with non-user names (if it exists CHORD track would become CHORD-xxxyyy) and then reading the new lib file would create a new CHORD. Also, we'd need to free all the existing track assigns. Certainly possible, but seems to be a lot of overkill.
 
This only becomes a problem when you deliberately reuse a MMA track by forcing a channel assignment OR when you change the voice of an existing track. If you use multiple lib files you are actually doing that. Remember, in MMA everything you do is cumulative. So, when you import a 2nd lib file you are ADDING to the previous settings. So, if we have stuff for the CHORD track set in "folk" and you then read "Folk-ballad" (which also has a CHORD track) you still only have one CHORD track ... the "folk-ballad" just modifies the existing CHORD track.

I think the problem is that the lib files really aren't designed to be run in multiple import cases. But, mostly they work fine.

Thanks for clearing up the problem!

Bob.
Logged

My online life: http://www.mellowood.ca
alexis
Jr. Member
*
Posts: 62


« Reply #4 on: July 15, 2011, 05:37:52 PM »

OK, I see.
It's much easier to fix the issue in LMMS and other buggy sequencers than to implement a whatever-we-do-clumsy solution into MMA!

Thanks a lot, Bob, for your answers and expert advices.

Alexis
Logged
bvdp
Kara-Moon Master
****
Posts: 1437


WWW
« Reply #5 on: July 16, 2011, 01:56:19 AM »

I was thinking a bit more about this issue and think I might have a solution idea.

1. New command, perhaps "flush" or something equally creative

2. the FLUSH command will do the following:

     - write the basic midi header (if it's not already there)
     - write the midi data for each track to the disk
     - zap out the midi data (ie, all tracks are now empty)
     - save the track count

3. Now, more data can be created reusing the now empty tracks.

4. Another FLUSH or EOF redoes (2). Now, the tracks are NEW midi tracks. So, we might have a CHORD track as midi channel 5 with events 0...xxx, another CHORD track with the same channel with events from xxx...yyy, etc.

5. At eof we need to update/set the track count in the midi header.

The nice part of this scheme is that we're not doing anything to mma tracks and names. Just dumping them out in segments.

Anyone know if there is a limit on the number of tracks one can have in a SMF? From memory the track count is a long so that's probably 32K tracks. Should be enough.

I think there might be other uses for this other than fixing buggy sequencers (in the back of my head I'm thinking this might be a step in doing some almost-realtime file creations).

A few minor problems I see right away are the way that UNIFY, FERMATA and some other command are processed since they rely on existing data in the MIDI track. But, if we're doing this to load multiple lib files it's probably not a concern. Even MIDIINC should world okay.

I'm going to copy this and stick it in my todo file ... no promises! But, comments are appreciated.
Logged

My online life: http://www.mellowood.ca
alexis
Jr. Member
*
Posts: 62


« Reply #6 on: July 18, 2011, 01:26:25 PM »

Well, Bob, the explanations you're giving here are a bit technical for me, as I'm not familiar with MMA's code.

Thanks anyway for your commitment to make MMA better!

I don't think track number limitation in a MIDI file could be an issue in practice for MMA.

Alexis
Logged
bvdp
Kara-Moon Master
****
Posts: 1437


WWW
« Reply #7 on: July 19, 2011, 12:21:21 AM »

Well, no code written as yet Smiley

And, no promises either Smiley

But, seriously, I've given this a bit of thought and it should be easy enough to do at my end. Useful in the field? Don't know, but I might do it just for fun. I'll be sure to announce it here!

Logged

My online life: http://www.mellowood.ca
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.21 | SMF © 2015, Simple Machines Valid XHTML 1.0! Valid CSS!
Page created in 0.059 seconds with 19 queries.