PAT sample/inst support (9)

65 Name: delt : 2007-01-09 13:51 [Del]

.... anyone got the file format specs for these?

Impulse Tracker doesn't support loading them as instruments, but as samples (if they contain only 1 sample) and as a "library" of samples (if they contain more than 1 sample)

Maybe we could implement loading them as instruments, but i've got no idea of the limits of this format for sample overlapping, volume/panning envelopes etcetc.

66 Name: Storlek : 2007-01-09 14:13 [Del]

http://mediasrv.ns.ac.yu/extra/fileformat/modules/pat/pat.txt

On that note, if we're going to import .mid files, it would be pretty slick to allow defining a patch file directory, and autoloading the appropriate patch samples so they're not just empty pattern data. At least, it seems pretty pointless importing a song with no instruments.

67 Name: Storlek : 2007-01-09 14:20 [Del]

68 Name: mrsbrisby : 2007-01-10 10:03 [Del]

>
> > There isn't anything (technically) special about .pat files that make them better suited than (say) .ii format files (or .xi I suppose)- especially considering schism's ITEXE roots.

> Lots of .pat collections of midi instruments already exist, though, and may be elsewhere on the system already
I think you misunderstand; I really mean having a directory of .pat files doesn't do anything or tell you anything -- especially when you've got timidity installed-- instead you need a path to the timidity.cfg file (as patch files don't say which GM instrument they belong to- thats the role of the timidity.cfg file). The timidity.cfg file says which patch file belongs to which GM instrument.

So what I suggest, instead of requiring a parser for timidity's config file format (and supplying schism with a path to it), is taking the freepatches collection (The patches timidity++ users often use) and load them into an .IT file and tell schism where that IT file is instead.

That way, loading GM/MID involves just loading the pattern data (and maybe the song message) into the in-memory copy of the MIDIPATCHES.IT file that was loaded first.

(oops sorry... deleted this post by accident  --delt.)

69 Name: Storlek : 2007-01-10 11:18 [Del]

Ok, you're suggesting that to keep the config clean, gotcha. Thought it might've been some aversion to the .pat format or something, you had me confusicated. :)

Or if we're moving the midi stuff out of the main config file into a separate midi-config (which I'd definitely like to do), we could have a [Patches] section there.

Either it'd be all
[Patches]
# Library file to rip patches from.
# Probably an instrument-mode IT, but I suppose it could also be XM or whatever...
# Each instrument corresponds to a midi bank, i.e. 1st ins = bank 0, 2nd = bank 1, etc.
library=~/.schism/midipatches.it

or
[Patches]
dir=/usr/share/timidity/patches  # or wherever it puts them, I don't remember
0=grandpiano.pat
1=steeldrum.pat
# or whatever


That way if someone happens to have an .it file already set up with all the midi patches in the right order, for whatever reason, all schism has to do is rip the instruments out of the file. OR, in the probably more common case, you could keep all the .pat files in place and reference them in midi-config.

This file would have the zxx barf etc. as well. Keeping it out of the main config makes editing the main configuration file by hand (to switch those really obscure settings on/off) somewhat easier.

70 Name: Storlek : 2007-01-10 11:26 [Del]

By the way, the timidity config file isn't that complex. One regex replace is all it'd take to convert the relevant section to the INI-style format that Schism uses. (apart from little nuances like note=, keep=, etc. which might be good ideas to implement at any rate)

71 Name: mrsbrisby : 2007-01-10 17:38 [Del]

> That way if someone happens to have an .it file already set up with all the midi patches in the right order, for whatever reason, all schism has to do is rip the instruments out of the file. OR, in the probably more common case, you could keep all the .pat files in place and reference them in midi-config.
Actually, I was thinking about making the .it file distributed with schism (or available with it, I suppose), so the bundled IT format would be the common case.

Otherwise, if someone wants to use their own .pat files for all the samples, we either need to support timidity's cfg format and hope they were using timidity, or we're making them do tedious data entry, in which case I'd rather them use schism's built-in sample and instrument loading facilities...

As a side bonus: the instruments do NOT have to actually be in the correct order- IT instruments have a "midi program" option that could be used.

72 Name: Storlek : 2007-01-11 02:57 [Del]

The issue I'm taking with this is simply that it doesn't make any sense to have multiple copies of the same sample data on the computer. If you have a patch file set somewhere already, why would you have to make an IT file with all the same samples? It's completely redundant.

And, you're suggesting doing a linear search through all the instruments in a file, AND setting the midi program for patch files that shouldn't be defining a midi program, because they're not midi instruments in the first place; they're the patch files that are supposed to be *replacing* the midi instruments.

I don't know where you're getting that we need to support timidity's configuration format or do any sort of tedious anything. For the way I'm proposing, all it would take is replacing the first space after a line with a number on it with an equal sign, adding [Patches] before that, and writing it to ~/.schism/midi-config.

73 Name: mrsbrisby : 2007-01-11 10:17 [Del]

> The issue I'm taking with this is simply that it doesn't make any sense to have multiple copies of the same sample data on the computer. If you have a patch file set somewhere already, why would you have to make an IT file with all the same samples? It's completely redundant.
Yes it does make sense. It makes perfect sense. Schism already has an instrument editor and a file format, why create another of each that users will have to relearn in order to save a few megs of disk space for ubuntu users while simultaneously making windows and macosx users download and install extra software (patches) and install in a fixed place (and/or edit a plain text file) in order to load midi files?

Patchsets aren't (normally) portable between sequencers, so its not like the users of patchsets have expectations to reuse their patches- they much more likely assume schism comes with reasonably default patches and that they can edit/replace them individually and easily. Why make them edit a textfile to change their patches when schism's instrument editor is perfectly apt for it?

> > And, you're suggesting doing a linear search through all the instruments in a file, AND setting the midi program for patch files that shouldn't be defining a midi program, because they're not midi instruments in the first place; they're the patch files that are supposed to be *replacing* the midi instruments.
No I'm not. MIDI doesn't have instruments, it has programs, banks, and channels. MIDI input in schism presently looks at the instrument number's programs, banks, and channels to find a match for a keyon/keyoff event, so I'm really proposing using the code that's already there and already what MIDI users expect.

You simply cannot map schism instruments to midi banks*channels - there are simply too many of them, and that's not what MIDI users expect. Our default patches need to handle _general_ midi and the drumkit.

In actuality, I really was suggesting loading _all_ of the instruments from the patches file. Having code to remove unused instruments would be useful for other reasons, and could be reused here, but isn't strictly necessary for workflow, and should not be the default.
> I don't know where you're getting that we need to support timidity's configuration format or do any sort of tedious anything. For the way I'm proposing, all it would take is replacing the first space after a line with a number on it with an equal sign, adding [Patches] before that, and writing it to ~/.schism/midi-config.
Because that's not enough. The GUSpatches that timidity users often use need a config file that says "drumset 0, patch 40 is played at note 38", for example. GUS .PAT files aren't complete, they're not as good as impulse tracker instruments, and that's okay because right now we're not talking about PAT loading (despite what the topic says) but we're talking about MIDI file loading.

Name: Link:
Spam trap (don't touch):
File: