sfz2pat(1)

πŸ“¦ version 0.4, in fedora 43, fedora 44

πŸ’– sfz2pat β€” like, the manual but make it make sense πŸ’–

okay bestie, so this is sfz2pat(1) from the General Commands Manual section, and I'm gonna walk you through it like we're texting at 2am, except every single fact is staying exactly where it is. no cap. 🫢


✨ NAME ✨

sz2pat β€” convert sample files into extended GUS patches

(yes, the manpage literally spells it sz2pat up there, I am not fixing that, I am simply reporting it, that's the vibe πŸ’…)


✨ SYNOPSIS ✨

sfz2pat filename.sfz

that's it. one job. she's serving simplicity. πŸ‘‘


✨ DESCRIPTION ✨

so this page is doing double duty β€” it documents both the conversion program sfz2pat and the sfz loader of the gt midi player. two for one, we love a multitasker.

here's the tea: you give it the name of one or more .wav files containing samples, plus a bunch of parameters describing the patch structure you want and how to play it, and all of that lives in a text file with the extension .sfz. run the sfz2pat utility on filename.sfz, and if everything goes well, the result is a GUS patch file named filename.pat. slay. πŸ’–

the same .sfz file can also be loaded and played directly by gt. just drop the name of the file into timidity.cfg, or into a file that timidity.cfg sources, exactly like you'd do with the name of a GUS .pat file. and here's the important part: some features of sfz patches can only be used when the patch is loaded directly, because they just don't fit into the GUS format. they simply cannot sit with us, the GUS format does not have the range. 😭

the format of .sfz files is described over at http://www.rgcaudio.com/sfzformat.htm. also check out http://www.drealm.org.uk/sfz/plj-sfz.html β€” that one's a more lucid, less authoritative, account, courtesy of PL Jones. an .sfz patch file is a text file describing a single instrument, as implemented here. (and okay, lowkey side note: even though a whole set of drums can be characterized in a single .sfz file for RGC Audio's player program, this implementation requires a separate patch file for each drum. one drum, one file. boundaries. ✨)

so typically, an instrument will have a bunch of different samples, and which sample sounds when you play a note on that instrument depends on various circumstances β€” the pitch of the note, how loud it is, and so on. a sample thought of in relation to whether it sounds when a note is played is referred to as a layer in the RGC documentation, but the author usually calls it a sample. each individual sample (layer) of an instrument is described in a region of the .sfz patch file β€” see the <region> opcode below. πŸ¦‹

ngl, only a very tiny, little, miniscule part of SFZ is currently interpreted. SFZ opcodes in the .sfz file that are not yet implemented are just ignored. and the ones that are interpreted may or may not work exactly as specified in the RGC Audio documentation (or as described here). so, like, it's giving experimental, and we respect that. πŸ™ˆ

the .pat files that get created are GUS extended patch files, so they can have velocity layers and they can be in stereo. if the source .wav file is in stereo, the extended GUS patch derived from it will also be in stereo. πŸŽ€ and in addition to .wav files, you can also use .aiff and .ogg files for samples. 24-bit .wav files are ok too β€” but for GUS patches they are down-converted to 16 bits, so that extra resolution is lost. 😭 when loading patches directly, though, all 24 bits are used. periodt.


✨ OPCODES ✨

here are the opcodes currently interpreted. πŸ‘‘

  • <group> β€” beginning of global opcodes that apply throughout following regions, until the next <group> or end of file.
  • <region> β€” beginning of local opcodes that apply only until the next <region>, or <group> or end of file.
  • sample=filename β€” gives path of a file containing sample data.
  • key=k β€” note to play. k is a number 0-127 or an IPN note name (letter A-G, optional # or b, then octave from -1 to 9), and likewise below for all values referred to as k.
  • hikey=k β€” highest key of range. default is 60.
  • lokey=k β€” lowest key of range. default is 60.
  • pitch_keycenter=k β€” middle key of range. default is 60.
  • hivel=v β€” highest velocity of range. v is a number 0-127. default is 127.
  • lovel=v β€” highest velocity of range. v is a number 0-127. default is 0.
  • offset=n β€” where patch starts in sample file, in samples from the beginning of the file. default is 0.
  • end=n β€” where patch ends in sample file, in samples. default is the end of the file.
  • loop_start=n β€” where the loop start point of patch is in sample file, in samples. default is the offset of the sample.
  • loop_end=n β€” where the loop end point of patch is in sample file, in samples. default is the end of the sample.
  • loop_mode=loop_sustain β€” makes the sample loop while note is held. default is no loop.
  • volume=f β€” how loud to play the sample, in decibels. default is 0 decibel change to what is found in the sample file.
  • amp_random=f β€” the sample is amplified by a randomly selected amount from 0 to f, given in decibels. (this has no effect when creating .pat files.)
  • ampeg_release=f β€” release time for the volume envelope, in seconds.
  • group=n β€” defines the group the sample belongs to.
  • off_by=n β€” the sample will stop playing when a note from group n is started.
  • trigger=first β€” the sample will be played only if no other note in the same group (and on the same channel) is playing. (this has no effect when creating .pat files.)
  • trigger=legato β€” the sample will be played only if another note in the same group (and on the same channel) is playing. (this has no effect when creating .pat files.)
  • hirand=f β€” the sample plays only when a randomly selected number between 0 and 1 is less than f. (this has no effect when creating .pat files.)
  • lorand=f β€” the sample plays only when a randomly selected number between 0 and 1 is greater or equal to f. (this has no effect when creating .pat files.)
  • sw_hikey=k β€” highest key in switch range.
  • sw_lokey=k β€” lowest key in switch range.
  • sw_down=k β€” the sample will play only if note k is playing (on the same channel), provided it falls within the switch range. (this has no effect when creating .pat files.)
  • sw_up=k β€” the sample will not play if note k is playing (on the same channel), provided it falls within the switch range. (this has no effect when creating .pat files.)

✨ BUGS ✨

probably, there are lots of bugs. this is an experiment. πŸ’€

like. she said it herself. respect the honesty, honestly iconic. πŸ™ˆ


✨ AUTHOR ✨

Greg Lee <greg@ling.lll.hawaii.edu>


and that's the whole page bestie!! πŸŒˆπŸ’œ this one's from the sfz2pat(1) era, dated 11 Oct 2004 β€” genuinely vintage, we stan a historical document. go convert some samples, you got this. πŸŽ€βœ¨πŸŒΈ

πŸ“¦ where this page comes from