You are here

Why is a track forced to use a single channel?

First, thank you for Qtractor. I have in the past tried to use MusE and Rosegarden, and both were quite frustrating. Qtractor, on the other hand, gives me hope I can actually make MIDI music on Linux.

However, I wonder why Qtractor has chosen to force each track to emit events on a fixed, single channel?
MusE and Rosegarden do the same thing.

Years ago, I made a lot of sequences using some other, now obsolete, software. However, it worked quite well for my needs. That software would allow you to mix events for different channels on a track, and in some cases I did.

There is no inherent reason I can see why a track should ignore the channel numbers in the event and force all of them to some externally-specified channel.

But I think there must be some reason why MusE, Rosegarden, and Qtractor all do this. Can you explain the reason?

I have read what you wrote here,
https://www.rncbc.org/drupal/node/1788
which states that a Qtractor "track" is not the same thing as a SMF "track". However it doesn't quite explain "what is a Qtractor track, then", and I can't figure out the answer to my question.

Forums: 
rncbc's picture

because i say so? ;)

on qtractor (and in many other MIDI sequencers out there, regardless of being Linux or not), MIDI tracks (should) convey only one sounding instrument, program, patch, whatever, and only one; a MIDI track maps 1-to-1 to a MIDI channel address, although you may have several on the same channel.

this has been one fundamental model/design rule and nothing you say or argue will change that, sorry--there's no why's, only how's--in fact it's all rather conventional, like keeping each thing onto its own business.

hth.
cheers

I'm not trying to argue anything about your design decision to make track correspond to single channel, I was just wondering what is the reason for it.

I want to import my old sequences into Qtractor. To do this, I have reverse engineered the file format of the old sequences, and I have written a tool which can parse those files and create SMF format 1 file. Right now, there are two little problems with this process:

1. As I said, some of my old sequences have events for different channels on the same track. I usually only did this on a track which was used just to hold initial program changes and volume controllers. SMF doesn't have the "only one channel per track" restriction, so my convertor tool currently just creates a Mtrk containing the exact same events for each track in the old sequencer file format. Meaning, the SMF might have a Mtrk with events for multiple channels.

I will change my tool to detect this and split such a multi-channel track into separate Mtrk instances, one Mtrk per channel observed in the original file "track", so they will appear in Qtractor on different tracks. So this problem will be solved soon.

2. When I import one of these SMF1 files into Qtractor, all the track names in the Mtrk chunks are ignored, and all the Qtractor track names are just the basename of the .mid file. The MIDI clips on the tracks (there's only one per track) also have their names as the basename of the .mid file. This makes for a lot of extra work for me to manually rename all the the resulting Qtractor tracks.

I would really like to have the Qtractor track name be taken from the SMF Mtrk TRACKNAME. Or at least, the MIDI clip name be taken from the SMF Mtrk TRACKNAME.

I built and am running Qtractor from git HEAD. I want to change Qtractor so when importing from a SMF, the Mtrk TRACKNAME is used for either the clip name, or the track name. I have looked in the Qtractor source to try and figure out where/how to make this change, but being a large codebase, it would help and I would appreciate if you could give me a pointer to where to look to make such a change. I am doing this for myself, I'm not asking you to make such a change to Qtractor, although I do think it would be a good idea.

I have a couple of hundred old sequences, and having to manually rename every track in every one of them just seems crazy, when the information is already there in the SMF, but just being ignored.

When importing a standard MIDI file, the clip name is first set from the Mtrk TRACKNAME. But later it is unconditionally overwritten with the SMF filename basename.
This one line patch changes the behavior so if the clip name is already set (presumably from Mtrk TRACKNAME), then it is not changed to filename.

diff --git a/src/qtractorMidiClip.cpp b/src/qtractorMidiClip.cpp
index e2b3a78..077bbd4 100644
--- a/src/qtractorMidiClip.cpp
+++ b/src/qtractorMidiClip.cpp
@@ -475,11 +475,12 @@ bool qtractorMidiClip::openMidiFile (
                }
                // We should have events, otherwise this clip is of no use...
                //if (m_pSeq->events().count() < 1)
                //      return false;
                // And initial clip name...
-               pSeq->setName(shortClipName(QFileInfo(m_pFile->filename()).baseName()));
+               if (pSeq->name().isEmpty()) // if not already set from SMF TRACKNAME meta-event
+                       pSeq->setName(shortClipName(QFileInfo(m_pFile->filename()).baseName()));
        }
 
        // Actual track-channel is set by now...
        setTrackChannel(iTrackChannel);
 
rncbc's picture

done in git head master commit ae124c3.

next time you may ask for a pull-request, on github if you like.

thanks && cheers

Add new comment