xref: /freebsd/contrib/file/magic/Magdir/audio (revision b1879975794772ee51f0b4865753364c7d7626c3)
1
2#------------------------------------------------------------------------------
3# $File: audio,v 1.133 2024/09/04 19:07:20 christos Exp $
4# audio:  file(1) magic for sound formats (see also "iff")
5#
6# Jan Nicolai Langfeldt (janl@ifi.uio.no), Dan Quinlan (quinlan@yggdrasil.com),
7# and others
8#
9
10# Sun/NeXT audio data
110	string		.snd		Sun/NeXT audio data:
12>12	belong		1		8-bit ISDN mu-law,
13!:mime	audio/basic
14>12	belong		2		8-bit linear PCM [REF-PCM],
15!:mime	audio/basic
16>12	belong		3		16-bit linear PCM,
17!:mime	audio/basic
18>12	belong		4		24-bit linear PCM,
19!:mime	audio/basic
20>12	belong		5		32-bit linear PCM,
21!:mime	audio/basic
22>12	belong		6		32-bit IEEE floating point,
23!:mime	audio/basic
24>12	belong		7		64-bit IEEE floating point,
25!:mime	audio/basic
26>12	belong		8		Fragmented sample data,
27>12	belong		10		DSP program,
28>12	belong		11		8-bit fixed point,
29>12	belong		12		16-bit fixed point,
30>12	belong		13		24-bit fixed point,
31>12	belong		14		32-bit fixed point,
32>12	belong		18		16-bit linear with emphasis,
33>12	belong		19		16-bit linear compressed,
34>12	belong		20		16-bit linear with emphasis and compression,
35>12	belong		21		Music kit DSP commands,
36>12	belong		23		8-bit ISDN mu-law compressed (CCITT G.721 ADPCM voice enc.),
37!:mime  audio/x-adpcm
38>12	belong		24		compressed (8-bit CCITT G.722 ADPCM)
39>12	belong		25		compressed (3-bit CCITT G.723.3 ADPCM),
40>12	belong		26		compressed (5-bit CCITT G.723.5 ADPCM),
41>12	belong		27		8-bit A-law (CCITT G.711),
42>20	belong		1		mono,
43>20	belong		2		stereo,
44>20	belong		4		quad,
45>16	belong		>0		%d Hz
46
47# DEC systems (e.g. DECstation 5000) use a variant of the Sun/NeXT format
48# that uses little-endian encoding and has a different magic number
490	lelong		0x0064732E	DEC audio data:
50>12	lelong		1		8-bit ISDN mu-law,
51!:mime	audio/x-dec-basic
52>12	lelong		2		8-bit linear PCM [REF-PCM],
53!:mime	audio/x-dec-basic
54>12	lelong		3		16-bit linear PCM,
55!:mime	audio/x-dec-basic
56>12	lelong		4		24-bit linear PCM,
57!:mime	audio/x-dec-basic
58>12	lelong		5		32-bit linear PCM,
59!:mime	audio/x-dec-basic
60>12	lelong		6		32-bit IEEE floating point,
61!:mime	audio/x-dec-basic
62>12	lelong		7		64-bit IEEE floating point,
63!:mime	audio/x-dec-basic
64>12	belong		8		Fragmented sample data,
65>12	belong		10		DSP program,
66>12	belong		11		8-bit fixed point,
67>12	belong		12		16-bit fixed point,
68>12	belong		13		24-bit fixed point,
69>12	belong		14		32-bit fixed point,
70>12	belong		18		16-bit linear with emphasis,
71>12	belong		19		16-bit linear compressed,
72>12	belong		20		16-bit linear with emphasis and compression,
73>12	belong		21		Music kit DSP commands,
74>12	lelong		23		8-bit ISDN mu-law compressed (CCITT G.721 ADPCM voice enc.),
75!:mime	audio/x-dec-basic
76>12	belong		24		compressed (8-bit CCITT G.722 ADPCM)
77>12	belong		25		compressed (3-bit CCITT G.723.3 ADPCM),
78>12	belong		26		compressed (5-bit CCITT G.723.5 ADPCM),
79>12	belong		27		8-bit A-law (CCITT G.711),
80>20	lelong		1		mono,
81>20	lelong		2		stereo,
82>20	lelong		4		quad,
83>16	lelong		>0		%d Hz
84
85# Creative Labs AUDIO stuff
860	string	MThd			Standard MIDI data
87!:mime	audio/midi
88>8 	beshort	x			(format %d)
89>10	beshort	x			using %d track
90>10	beshort		>1		\bs
91>12	beshort&0x7fff	x		at 1/%d
92>12	beshort&0x8000	>0		SMPTE
93
940	string	CTMF			Creative Music (CMF) data
95!:mime	audio/x-unknown
960	string	SBI			SoundBlaster instrument data
97!:mime	audio/x-unknown
980	string	Creative\ Voice\ File	Creative Labs voice data
99!:mime	audio/x-unknown
100# is this next line right?  it came this way...
101>19	byte	0x1A
102>>23	byte	>0			- version %d
103>>22	byte	>0			\b.%d
104
105# first entry is also the string "NTRK"
1060	belong		0x4e54524b	MultiTrack sound data
107>4	belong		x		- version %d
108
109# Extended MOD format (*.emd) (Greg Roelofs, newt@uchicago.edu); NOT TESTED
110# [based on posting 940824 by "Dirk/Elastik", husberg@lehtori.cc.tut.fi]
1110	string		EMOD		Extended MOD sound data,
112>4	byte&0xf0	x		version %d
113>4	byte&0x0f	x		\b.%d,
114>45	byte		x		%d instruments
115>83	byte		0		(module)
116>83	byte		1		(song)
117
118# Real Audio (Magic .ra\0375)
1190	belong		0x2e7261fd	RealAudio sound file
120!:mime	audio/x-pn-realaudio
1210	string		.RMF\0\0\0	RealMedia file
122!:mime	application/vnd.rn-realmedia
123#video/x-pn-realvideo
124#video/vnd.rn-realvideo
125#application/vnd.rn-realmedia
126#	sigh, there are many mimes for that but the above are the most common.
127
128# MTM/669/FAR/S3M/ULT/XM format checking [Aaron Eppert, aeppert@dialin.ind.net]
129# Oct 31, 1995
130# fixed by <doj@cubic.org> 2003-06-24
131# Too short...
132#0	string		MTM		MultiTracker Module sound file
133#0	string		if		Composer 669 Module sound data
134#0	string		JN		Composer 669 Module sound data (extended format)
1350	string		MAS_U		ULT(imate) Module sound data
136
137#0	string		FAR		Module sound data
138#>4	string		>\15		Title: "%s"
139
1400x2c	string		SCRM		ScreamTracker III Module sound data
141>0	string		>\0		Title: "%s"
142!:mime	audio/x-s3m
143
144# .stm before it got above .s3m extension
1450x16	string		\!Scream\!	ScreamTracker Module sound data
146>0	string		>\0		Title: "%s"
147
148# Gravis UltraSound patches
149# From <ache@nagual.ru>
150
1510	string		GF1PATCH110\0ID#000002\0	GUS patch
1520	string		GF1PATCH100\0ID#000002\0	Old GUS	patch
153
154# mime types according to http://www.geocities.com/nevilo/mod.htm:
155#	audio/it	.it
156#	audio/x-zipped-it	.itz
157#	audio/xm	fasttracker modules
158#	audio/x-s3m	screamtracker modules
159#	audio/s3m	screamtracker modules
160#	audio/x-zipped-mod	mdz
161#	audio/mod	mod
162#	audio/x-mod	All modules (mod, s3m, 669, mtm, med, xm, it, mdz, stm, itz, xmz, s3z)
163
164#
165# Taken from loader code from mikmod version 2.14
166# by Steve McIntyre (stevem@chiark.greenend.org.uk)
167# <doj@cubic.org> added title printing on 2003-06-24
1680	string	MAS_UTrack_V00
169>14	string	>/0		ultratracker V1.%.1s module sound data
170!:mime	audio/x-mod
171#audio/x-tracker-module
172
1730	string	UN05		MikMod UNI format module sound data
174
1750	string	Extended\ Module: Fasttracker II module sound data
176!:mime	audio/x-mod
177#audio/x-tracker-module
178>17	string	>\0		Title: "%s"
179
18021	string/c	=!SCREAM!	Screamtracker 2 module sound data
181!:mime	audio/x-mod
182#audio/x-screamtracker-module
18321	string	BMOD2STM	Screamtracker 2 module sound data
184!:mime	audio/x-mod
185#audio/x-screamtracker-module
186
1871080	string	\!PM!		4-channel Protracker module sound data
188!:mime	audio/x-mod
189#audio/x-protracker-module
190>0	string	>\0		Title: "%s"
191
1921080	string	M.K.		4-channel Protracker module sound data
193!:mime	audio/x-mod
194#audio/x-protracker-module
195>0	string	>\0		Title: "%s"
196
1971080	string	M!K!		4-channel Protracker module sound data
198!:mime	audio/x-mod
199#audio/x-protracker-module
200>0	string	>\0		Title: "%s"
201
2021080	string	FLT4		4-channel Startracker module sound data
203!:mime	audio/x-mod
204#audio/x-startracker-module
205>0	string	>\0		Title: "%s"
206
2071080	string	FLT8		8-channel Startracker module sound data
208!:mime	audio/x-mod
209#audio/x-startracker-module
210>0	string	>\0		Title: "%s"
211
2121080	string	4CHN		4-channel Fasttracker module sound data
213!:mime	audio/x-mod
214#audio/x-fasttracker-module
215>0	string	>\0		Title: "%s"
216
2171080	string	6CHN		6-channel Fasttracker module sound data
218!:mime	audio/x-mod
219#audio/x-fasttracker-module
220>0	string	>\0		Title: "%s"
221
2221080	string	8CHN		8-channel Fasttracker module sound data
223!:mime	audio/x-mod
224#audio/x-fasttracker-module
225>0	string	>\0		Title: "%s"
226
2271080	string	CD81		8-channel Octalyser module sound data
228!:mime	audio/x-mod
229#audio/x-octalysertracker-module
230>0	string	>\0		Title: "%s"
231
2321080	string	OKTA		8-channel Octalyzer module sound data
233!:mime	audio/x-mod
234#audio/x-octalysertracker-module
235>0	string	>\0		Title: "%s"
236
237# Not good enough.
238#1082	string	CH
239#>1080	string	>/0		%.2s-channel Fasttracker "oktalyzer" module sound data
2401080	string	16CN		16-channel Taketracker module sound data
241!:mime	audio/x-mod
242#audio/x-taketracker-module
243>0	string	>\0		Title: "%s"
2441080	string	32CN		32-channel Taketracker module sound data
245!:mime	audio/x-mod
246#audio/x-taketracker-module
247>0	string	>\0		Title: "%s"
248
249# TOC sound files -Trevor Johnson <trevor@jpj.net>
250#
2510       string          TOC             TOC sound file
252
253# sidfiles <pooka@iki.fi>
254# added name,author,(c) and new RSID type by <doj@cubic.org> 2003-06-24
2550	string		SIDPLAY\ INFOFILE	Sidplay info file
256
2570	string		PSID			PlaySID v2.2+ (AMIGA) sidtune
258>4	beshort		>0			w/ header v%d,
259>14	beshort		=1			single song,
260>14	beshort		>1			%d songs,
261>16	beshort		>0			default song: %d
262>0x16	string		>\0			name: "%s"
263>0x36	string		>\0			author: "%s"
264>0x56	string		>\0			copyright: "%s"
265
2660	string		RSID			RSID sidtune PlaySID compatible
267>4	beshort		>0			w/ header v%d,
268>14	beshort		=1			single song,
269>14	beshort		>1			%d songs,
270>16	beshort		>0			default song: %d
271>0x16	string		>\0			name: "%s"
272>0x36	string		>\0			author: "%s"
273>0x56	string		>\0			copyright: "%s"
274
275# IRCAM sound files - Michael Pruett <michael@68k.org>
276# http://www-mmsp.ece.mcgill.ca/documents/AudioFormats/IRCAM/IRCAM.html
2770	belong		0x64a30100		IRCAM file (VAX little-endian)
2780	belong		0x0001a364		IRCAM file (VAX big-endian)
2790	belong		0x0002a364		IRCAM file (Sun little-endian)
2800	belong		0x64a30200		IRCAM file (Sun big-endian)
2810	belong		0x64a30300		IRCAM file (MIPS little-endian)
2820	belong		0x0003a364		IRCAM file (MIPS big-endian)
2830	belong		0x0004a364		IRCAM file (NeXT little-endian)
2840	belong		0x64a30400		IRCAM file (NeXT big-endian)
285
286# NIST SPHERE <mpruett@sgi.com>
2870	string		NIST_1A\n\ \ \ 1024\n	NIST SPHERE file
288
289# Sample Vision <mpruett@sgi.com>
2900	string		SOUND\ SAMPLE\ DATA\ 	Sample Vision file
291
292# Audio Visual Research <tonigonenstein@users.sourceforge.net>
2930	string		2BIT			Audio Visual Research file,
294>12	beshort		=0			mono,
295>12	beshort		=-1			stereo,
296>14	beshort		x			%d bits
297>16	beshort		=0			unsigned,
298>16	beshort		=-1			signed,
299>22	belong&0x00ffffff	x		%d Hz,
300>18	beshort		=0			no loop,
301>18	beshort		=-1			loop,
302>21	ubyte		<128			note %d,
303>22	byte		=0			replay 5.485 KHz
304>22	byte		=1			replay 8.084 KHz
305>22	byte		=2			replay 10.971 KHz
306>22	byte		=3			replay 16.168 KHz
307>22	byte		=4			replay 21.942 KHz
308>22	byte		=5			replay 32.336 KHz
309>22	byte		=6			replay 43.885 KHz
310>22	byte		=7			replay 47.261 KHz
311
312# SGI SoundTrack <mpruett@sgi.com>
3130	string		_SGI_SoundTrack		SGI SoundTrack project file
314# ID3 version 2 tags <waschk@informatik.uni-rostock.de>
3150	string		ID3	Audio file with ID3 version 2
316>3	byte		x	\b.%d
317>4	byte		x	\b.%d
318>>5	byte		&0x80	\b, unsynchronized frames
319>>5	byte		&0x40	\b, extended header
320>>5	byte		&0x20	\b, experimental
321>>5	byte		&0x10	\b, footer present
322>(6.I+10)	indirect	x	\b, contains:
323
324# NSF (NES sound file) magic
3250	string		NESM\x1a	NES Sound File
326>14	string		>\0		("%s" by
327>46	string		>\0		%s, copyright
328>78	string		>\0		%s),
329>5	byte		x		version %d,
330>6	byte		x		%d tracks,
331>122	byte&0x2	=1		dual PAL/NTSC
332>122	byte&0x1	=1		PAL
333>122	byte&0x1	=0		NTSC
334
335# NSFE (Extended NES sound file) magic
336# http://slickproductions.org/docs/NSF/nsfespec.txt
337# From: David Pflug <david@pflug.email>
3380	string		NSFE		Extended NES Sound File
339>48	search/0x1000	auth
340>>&0	string		>\0		("%s"
341>>>&1	string		>\0		by %s
342>>>>&1	string		>\0		\b, copyright %s
343>>>>>&1	string		>\0		\b, ripped by %s
344>20	byte		x		\b), %d tracks,
345>18	byte&0x2	=1		dual PAL/NTSC
346>18     byte&0x2	=0
347>>18	byte&0x1	=1		PAL
348>>18	byte&0x1	=0		NTSC
349
350# Type: SNES SPC700 sound files
351# From: Josh Triplett <josh@freedesktop.org>
3520	string	SNES-SPC700\ Sound\ File\ Data\ v	SNES SPC700 sound file
353>&0	string	0.30					\b, version %s
354>>0x23	byte	0x1B					\b, without ID666 tag
355>>0x23	byte	0x1A					\b, with ID666 tag
356>>>0x2E	string	>\0					\b, song "%.32s"
357>>>0x4E	string	>\0					\b, game "%.32s"
358
359# Impulse tracker module (audio/x-it)
3600	string		IMPM		Impulse Tracker module sound data -
361!:mime	audio/x-mod
362>4	string		>\0		"%s"
363>40	leshort		!0		compatible w/ITv%x
364>42	leshort		!0		created w/ITv%x
365
366# Imago Orpheus module (audio/x-imf)
36760	string		IM10		Imago Orpheus module sound data -
368>0	string		>\0		"%s"
369
370# From <collver1@attbi.com>
371# These are the /etc/magic entries to decode modules, instruments, and
372# samples in Impulse Tracker's native format.
373
3740	string		IMPS		Impulse Tracker Sample
375>18	byte		&2		16 bit
376>18	byte		^2		8 bit
377>18	byte		&4		stereo
378>18	byte		^4		mono
3790	string		IMPI		Impulse Tracker Instrument
380>28	leshort		!0		ITv%x
381>30	byte		!0		%d samples
382
383# Yamaha TX Wave:  file(1) magic for Yamaha TX Wave audio files
384# From <collver1@attbi.com>
3850	string		LM8953		Yamaha TX Wave
386>22	byte		0x49		looped
387>22	byte		0xC9		non-looped
388>23	byte		1		33kHz
389>23	byte		2		50kHz
390>23	byte		3		16kHz
391
392# scream tracker:  file(1) magic for Scream Tracker sample files
393#
394# From <collver1@attbi.com>
39576	string		SCRS		Scream Tracker Sample
396>0	byte		1		sample
397>0	byte		2		adlib melody
398>0	byte		>2		adlib drum
399>31	byte		&2		stereo
400>31	byte		^2		mono
401>31	byte		&4		16bit little endian
402>31	byte		^4		8bit
403>30	byte		0		unpacked
404>30	byte		1		packed
405
406# audio
407# From: Cory Dikkers <cdikkers@swbell.net>
4080	string		MMD0		MED music file, version 0
4090	string		MMD1		OctaMED Pro music file, version 1
4100	string		MMD3		OctaMED Soundstudio music file, version 3
4110	string		OctaMEDCmpr	OctaMED Soundstudio compressed file
4120	string		MED		MED_Song
4130	string		SymM		Symphonie SymMOD music file
414#
415# Track Length (TRL), Tracks (TRK), Samples (SMP), Subsongs (SS)
416# http://lclevy.free.fr/exotica/ahx/ahxformat.txt
4170	string		THX		AHX version
418>3	byte		=0		1 module data
419>3	byte		=1		2 module data
420>11	ubyte		x		TRK: %u
421>10	ubyte		x		TRL: %u
422>12	ubyte		x		SMP: %u
423>13	ubyte		x		SS: %u
424>(4.H)		string		x		Title: "%.128s"
425
426# header is mostly AHX format
4270		string		HVL
428>3		byte		<2	Hively Tracker Song
429>3		byte		=0		v1 module data
430>3		byte		=1		v2 module data
431>11		ubyte		x		TRK: %u
432>10		ubyte		x		TRL: %u
433>12		ubyte		x		SMP: %u
434>13		ubyte		x		SS: %u
435>8		ubyte/4		=0		CHN: 4
436>8		ubyte/4		>0		CHN: 4+%u
437#>-0		offset		<0xffff
438>(4.H)		string		x		Title: "%.128s"
439
440#
4410	string		OKTASONG	Oktalyzer module data
442#
4430	string		DIGI\ Booster\ module\0	%s
444>20	byte		>0		%c
445>>21	byte		>0		\b%c
446>>>22	byte		>0		\b%c
447>>>>23	byte		>0		\b%c
448>610	string		>\0		\b, "%s"
449#
4500	string		DBM0	   	DIGI Booster Pro Module
451>4	byte		>0		V%X.
452>>5	byte		x		\b%02X
453>16	string		>\0		\b, "%s"
454#
4550	string		FTMN		FaceTheMusic module
456>16	string		>\0d		\b, "%s"
457
458# From: <doj@cubic.org> 2003-06-24
4590	string		AMShdr\32	Velvet Studio AMS Module v2.2
4600	string		Extreme		Extreme Tracker AMS Module v1.3
4610	string		DDMF		Xtracker DMF Module
462>4	byte		x		v%i
463>0xD	string		>\0		Title: "%s"
464>0x2B	string		>\0		Composer: "%s"
4650	string		DSM\32		Dynamic Studio Module DSM
4660	string		SONG		DigiTrekker DTM Module
4670	string		DMDL		DigiTrakker MDL Module
4680	string		PSM\32		Protracker Studio PSM Module
46944	string		PTMF		Poly Tracker PTM Module
470>0	string		>\32		Title: "%s"
4710	string		MT20		MadTracker 2.0 Module MT2
4720	string		RAD\40by\40REALiTY!! RAD Adlib Tracker Module RAD
4730	string		RTMM		RTM Module
4740x426	string		MaDoKaN96	XMS Adlib Module
475>0	string		>\0		Composer: "%s"
4760	string		AMF		AMF Module
477>4	string		>\0		Title: "%s"
4780	string		MODINFO1	Open Cubic Player Module Information MDZ
4790	string		Extended\40Instrument: Fast Tracker II Instrument
480
481# From: Takeshi Hamasaki <hma@syd.odn.ne.jp>
482# NOA Nancy Codec file
4830	string		\210NOA\015\012\032	NOA Nancy Codec Movie file
484# Yamaha SMAF format
4850	string		MMMD		Yamaha SMAF file
486# Sharp Jisaku Melody format for PDC
4870	string		\001Sharp\040JisakuMelody	SHARP Cell-Phone ringing Melody
488>20	string		Ver01.00	Ver. 1.00
489>>32	byte		x		\b, %d tracks
490
491# Free lossless audio codec <http://flac.sourceforge.net>
492# From: Przemyslaw Augustyniak <silvathraec@rpg.pl>
4930	string			fLaC		FLAC audio bitstream data
494!:mime	audio/flac
495>4	byte&0x7f		>0		\b, unknown version
496>4	byte&0x7f		0		\b
497# some common bits/sample values
498>>20	beshort&0x1f0		0x030		\b, 4 bit
499>>20	beshort&0x1f0		0x050		\b, 6 bit
500>>20	beshort&0x1f0		0x070		\b, 8 bit
501>>20	beshort&0x1f0		0x0b0		\b, 12 bit
502>>20	beshort&0x1f0		0x0f0		\b, 16 bit
503>>20	beshort&0x1f0		0x170		\b, 24 bit
504>>20	byte&0xe		0x0		\b, mono
505>>20	byte&0xe		0x2		\b, stereo
506>>20	byte&0xe		0x4		\b, 3 channels
507>>20	byte&0xe		0x6		\b, 4 channels
508>>20	byte&0xe		0x8		\b, 5 channels
509>>20	byte&0xe		0xa		\b, 6 channels
510>>20	byte&0xe		0xc		\b, 7 channels
511>>20	byte&0xe		0xe		\b, 8 channels
512# sample rates derived from known oscillator frequencies;
513# 24.576 MHz (video/fs=48kHz), 22.5792 (audio/fs=44.1kHz) and
514# 16.384 (other/fs=32kHz).
515>>17	belong&0xfffff0       	0x02b110	\b, 11.025 kHz
516>>17	belong&0xfffff0       	0x03e800	\b, 16 kHz
517>>17	belong&0xfffff0       	0x056220	\b, 22.05 kHz
518>>17	belong&0xfffff0       	0x05dc00	\b, 24 kHz
519>>17	belong&0xfffff0       	0x07d000	\b, 32 kHz
520>>17	belong&0xfffff0       	0x0ac440	\b, 44.1 kHz
521>>17	belong&0xfffff0       	0x0bb800	\b, 48 kHz
522>>17	belong&0xfffff0       	0x0fa000	\b, 64 kHz
523>>17	belong&0xfffff0       	0x158880	\b, 88.2 kHz
524>>17	belong&0xfffff0       	0x177000	\b, 96 kHz
525>>17	belong&0xfffff0       	0x1f4000	\b, 128 kHz
526>>17	belong&0xfffff0       	0x2b1100	\b, 176.4 kHz
527>>17	belong&0xfffff0       	0x2ee000	\b, 192 kHz
528>>17	belong&0xfffff0       	0x3e8000	\b, 256 kHz
529>>17	belong&0xfffff0       	0x562200	\b, 352.8 kHz
530>>17	belong&0xfffff0       	0x5dc000	\b, 384 kHz
531>>21	byte&0xf		>0		\b, >4G samples
532>>21	byte&0xf		0		\b
533>>>22	belong			>0		\b, %u samples
534>>>22	belong			0		\b, length unknown
535
536# (ISDN) VBOX voice message file (Wolfram Kleff)
5370       string          VBOX            VBOX voice message data
538
539# ReBorn Song Files (.rbs)
540# David J. Singer <doc@deadvirgins.org.uk>
5418       string          RB40             RBS Song file
542>29     string          ReBorn           created by ReBorn
543>37     string          Propellerhead    created by ReBirth
544
545# Synthesizer Generator and Kimwitu share their file format
5460	string		A#S#C#S#S#L#V#3	    Synthesizer Generator or Kimwitu data
547# Kimwitu++ uses a slightly different magic
5480	string		A#S#C#S#S#L#HUB	    Kimwitu++ data
549
550# From "Simon Hosie
5510       string  TFMX-SONG       TFMX module sound data
552
553# Monkey's Audio compressed audio format (.ape)
554# From danny.milo@gmx.net (Danny Milosavljevic)
555# New version from Abel Cheung <abel (@) oaka.org>
5560		string		MAC\040		Monkey's Audio compressed format
557!:mime audio/x-ape
558>4		uleshort	>0x0F8B		version %d
559>>(0x08.l)	uleshort	=1000		with fast compression
560>>(0x08.l)	uleshort	=2000		with normal compression
561>>(0x08.l)	uleshort	=3000		with high compression
562>>(0x08.l)	uleshort	=4000		with extra high compression
563>>(0x08.l)	uleshort	=5000		with insane compression
564>>(0x08.l+18)	uleshort	=1		\b, mono
565>>(0x08.l+18)	uleshort	=2		\b, stereo
566>>(0x08.l+20)	ulelong		x		\b, sample rate %d
567>4		uleshort	<0x0F8C		version %d
568>>6		uleshort	=1000		with fast compression
569>>6		uleshort	=2000		with normal compression
570>>6		uleshort	=3000		with high compression
571>>6		uleshort	=4000		with extra high compression
572>>6		uleshort	=5000		with insane compression
573>>10		uleshort	=1		\b, mono
574>>10		uleshort	=2		\b, stereo
575>>12		ulelong		x		\b, sample rate %d
576
577# adlib sound files
578# From: Alex Myczko <alex@aiei.ch>
579
580# https://github.com/rerrahkr/BambooTracker
5810	string	BambooTracker	BambooTracker
582>13	string	Mod		Module
583>13	string	Ist		Instrument
584>13	string	Bnk		Bank
585>22	byte	x		\b, version %u
586>21	byte	x		\b.%u
587>20	byte	x		\b.%u
588
5890	string		CC2x		CheeseCutter 2 song
590
5910    	string		RAWADATA	RdosPlay RAW
592
5931068	string		RoR		AMUSIC Adlib Tracker
594
5950	string		JCH		EdLib
596
5970	string		mpu401tr	MPU-401 Trakker
598
5990	string		SAdT		Surprise! Adlib Tracker
600>4	byte		x		Version %d
601
6020	string		XAD!		eXotic ADlib
603
6040	string		ofTAZ!		eXtra Simple Music
605
6060	string		FMK!		FM Kingtracker Song
607
6080	string		DFM		DFM Song
609
6100	string		\<CUD-FM-File\>	CFF Song
611
6120	string		_A2module	A2M Song
613
614# Spectrum 128 tunes (.ay files).
615# From: Emanuel Haupt <ehaupt@critical.ch>
6160	string		ZXAYEMUL	Spectrum 128 tune
617
6180	string		\0BONK		BONK,
619#>5	byte		x		version %d
620>14	byte		x		%d channel(s),
621>15	byte		=1		lossless,
622>15	byte		=0		lossy,
623>16	byte		x		mid-side
624
625384	string		LockStream	LockStream Embedded file (mostly MP3 on old Nokia phones)
626
627# format VQF (proprietary codec for sound)
628# some infos on the header file available at :
629# http://www.twinvq.org/english/technology_format.html
6300	string		TWIN97012000	VQF data
631>27	short		0		\b, Mono
632>27	short		1		\b, Stereo
633>31	short 		>0		\b, %d kbit/s
634>35	short 		>0		\b, %d kHz
635
636# Nelson A. de Oliveira (naoliv@gmail.com)
637# .eqf
6380	string	Winamp\ EQ\ library\ file	%s
639# it will match only versions like v<digit>.<digit>
640# Since I saw only eqf files with version v1.1 I think that it's OK
641>23	string	x	\b%.4s
642# .preset
6430	string	[Equalizer\ preset]	XMMS equalizer preset
644# .m3u
6450	search/1	#EXTM3U 	M3U playlist text
646!:mime  audio/x-mpegurl
647# .pls
6480	search/1	[playlist]	PLS playlist text
649# licq.conf
6501	string	[licq]			LICQ configuration file
651
652# Atari ST audio files by Dirk Jagdmann <doj@cubic.org>
653# NOTE: Most SNDH music is packed using ICE, which has
654# magic numbers "ICE!" and "Ice!". Some SNDH music is
655# not packed, so we check for both packed and unpacked.
65612	string			SNDH	SNDH Atari ST music
6570	belong&0xFFDFDFFF	0x49434521
658>14	search/40		NDH	SNDH Atari ST music
659>14	search/40		TITL	SNDH Atari ST music
6600	string		SC68\ Music-file\ /\ (c)\ (BeN)jami	sc68 Atari ST music
661
662# musepak support From: "Jiri Pejchal" <jiri.pejchal@gmail.com>
6630       string          MP+     Musepack audio (MP+)
664!:mime	audio/x-musepack
665>3      byte            255     \b, SV pre8
666>3      byte&0xF        0x6     \b, SV 6
667>3      byte&0xF        0x8     \b, SV 8
668>3      byte&0xF        0x7     \b, SV 7
669>>3     byte&0xF0       0x0     \b.0
670>>3     byte&0xF0       0x10    \b.1
671>>3     byte&0xF0       240     \b.15
672>>10    byte&0xF0       0x0     \b, no profile
673>>10    byte&0xF0       0x10    \b, profile 'Unstable/Experimental'
674>>10    byte&0xF0       0x50    \b, quality 0
675>>10    byte&0xF0       0x60    \b, quality 1
676>>10    byte&0xF0       0x70    \b, quality 2 (Telephone)
677>>10    byte&0xF0       0x80    \b, quality 3 (Thumb)
678>>10    byte&0xF0       0x90    \b, quality 4 (Radio)
679>>10    byte&0xF0       0xA0    \b, quality 5 (Standard)
680>>10    byte&0xF0       0xB0    \b, quality 6 (Xtreme)
681>>10    byte&0xF0       0xC0    \b, quality 7 (Insane)
682>>10    byte&0xF0       0xD0    \b, quality 8 (BrainDead)
683>>10    byte&0xF0       0xE0    \b, quality 9
684>>10    byte&0xF0       0xF0    \b, quality 10
685>>27    byte            0x0     \b, Buschmann 1.7.0-9, Klemm 0.90-1.05
686>>27    byte            102     \b, Beta 1.02
687>>27    byte            104     \b, Beta 1.04
688>>27    byte            105     \b, Alpha 1.05
689>>27    byte            106     \b, Beta 1.06
690>>27    byte            110     \b, Release 1.1
691>>27    byte            111     \b, Alpha 1.11
692>>27    byte            112     \b, Beta 1.12
693>>27    byte            113     \b, Alpha 1.13
694>>27    byte            114     \b, Beta 1.14
695>>27    byte            115     \b, Alpha 1.15
696
6970       string          MPCK    Musepack audio (MPCK)
698!:mime	audio/x-musepack
699
700# IMY
701# from http://filext.com/detaillist.php?extdetail=IMY
702# https://cellphones.about.com/od/cellularfaqs/f/rf_imelody.htm
703# http://download.ncl.ie/doc/api/ie/ncl/media/music/IMelody.html
704# http://www.wx800.com/msg/download/irda/iMelody.pdf
7050	string	BEGIN:IMELODY	iMelody Ringtone Format
706
707# From: "Mateus Caruccio" <mateus@caruccio.com>
708# guitar pro v3,4,5 from http://filext.com/file-extension/gp3
7090	string	\030FICHIER\ GUITAR\ PRO\ v3.	Guitar Pro Ver. 3 Tablature
710
711# From: "Leslie P. Polzer" <leslie.polzer@gmx.net>
71260	string	SONG		SoundFX Module sound file
713
714# Type: Adaptive Multi-Rate Codec
715# URL:  http://filext.com/detaillist.php?extdetail=AMR
716#		http://fileformats.archiveteam.org/wiki/Adaptive_Multi-Rate_Audio
717# Reference:	https://datatracker.ietf.org/doc/html/rfc4867
718#		http://mark0.net/download/triddefs_xml.7z/defs/a/audio-amr.trid.xml
719# Update:	Joerg Jenderek
720# From: Russell Coker <russell@coker.com.au>
721# Note:		called "AMR (Adaptive Multi Rate) encoded audio" by TrID and
722#		"Adaptive Multi-Rate Audio" by DROID via PUID fmt/356 and
723#		"AMR" "AMR audio" or "Adaptive Multi-Rate" by shared MIME-info database from freedesktop.org
7240	string	#!AMR		Adaptive Multi-Rate Codec
725# Adaptive Multi-Rate Codec (strength=80) before wrong "a AMR script executable (binary data)" (strength=20=60/3) by ./varied.script
726#!:strength +0
727# Reference:	http://mark0.net/download/triddefs_xml.7z/defs/a/audio-awb.trid.xml
728# Note:		called "Adaptive Multi-Rate Wideband ACELP codec" by TrID and
729#		"Adaptive Multi-Rate Wideband Audio" bY DROID via PUID fmt/954 and
730#		"AMR-WB" "AMR-WB audio" or "Adaptive Multi-Rate Wideband" by shared MIME-info database from freedesktop.org
731>5	string	-WB		(Wideband)
732# https://www.iana.org/assignments/media-types/audio/AMR-WB
733!:mime	audio/AMR-WB
734#!:mime	audio/amr-wb-encrypted
735!:apple	????amrw
736!:ext	awb
737# variant without Wideband
738>5	default	x		(GSM telephony)
739# https://www.iana.org/assignments/media-types/audio/AMR
740!:mime	audio/AMR
741# last character in type code is space
742!:apple	????amr
743!:ext  amr
744# GRR: maybe also 3ga suffix?		https://telparia.com/fileFormatSamples/audio/amr/example.3ga
745#!:ext  amr/3ga
746
747# Type: SuperCollider 3 Synth Definition File Format
748# From: Mario Lang <mlang@debian.org>
7490	string	SCgf	SuperCollider3 Synth Definition file,
750>4	belong	x	version %d
751
752# Type: True Audio Lossless Audio
753# URL:  https://wiki.multimedia.cx/index.php?title=True_Audio
754# From: Mike Melanson <mike@multimedia.cx>
7550	string	TTA1	True Audio Lossless Audio
756
757# Type: WavPack Lossless Audio
758# URL:  https://wiki.multimedia.cx/index.php?title=WavPack
759# From: Mike Melanson <mike@multimedia.cx>
7600	string	wvpk	WavPack Lossless Audio
761
762# From Fabio R. Schmidlin <frs@pop.com.br>
763# VGM music file
7640	string		Vgm\040
765>9	ubyte		>0	VGM Video Game Music dump v
766!:mime	audio/x-vgm
767!:ext	vgm
768>>9	ubyte/16	>0	\b%d
769>>9	ubyte&0x0F	x	\b%d
770>>8	ubyte/16	x	\b.%d
771>>8	ubyte&0x0F	>0	\b%d
772#Get soundchips
773>>8	ubyte		x	\b, soundchip(s)=
774>>0x0C	ulelong		>0	SN76489 (PSG),
775>>0x10	ulelong		>0	YM2413 (OPLL),
776>>0x2C	ulelong		>0	YM2612 (OPN2),
777>>0x30	ulelong		>0	YM2151 (OPM),
778>>0x38	ulelong		>0	Sega PCM,
779>>0x34	ulelong		>0xC
780>>>0x40	ulelong		>0	RF5C68 (PCM),
781>>0x34	ulelong		>0x10
782>>>0x44	ulelong		>0	YM2203 (OPN),
783>>0x34	ulelong		>0x14
784>>>0x48	ulelong		>0	YM2608 (OPNA),
785>>0x34	ulelong		>0x18
786>>>0x4C	lelong		>0	YM2610 (OPNB),
787>>>0x4C	lelong		<0	YM2610B (OPNB+2FM),
788>>0x34	ulelong		>0x1C
789>>>0x50	ulelong		>0	YM3812 (OPL2),
790>>0x34	ulelong		>0x20
791>>>0x54	ulelong		>0	YM3526 (OPL),
792>>0x34	ulelong		>0x24
793>>>0x58	ulelong		>0	Y8950 (MSX-Audio),
794>>0x34	ulelong		>0x28
795>>>0x5C	ulelong		>0	YMF262 (OPL3),
796>>0x34	ulelong		>0x2C
797>>>0x60	ulelong		>0	YMF278B (OPL4),
798>>0x34	ulelong		>0x30
799>>>0x64	ulelong		>0	YMF271 (OPX),
800>>0x34	ulelong		>0x34
801>>>0x68	ulelong		>0	YMZ280B (PCMD8),
802>>0x34	ulelong		>0x38
803>>>0x6C	ulelong		>0	RF5C164 (PCM),
804>>0x34	ulelong		>0x3C
805>>>0x70	ulelong		>0	PWM,
806>>0x34	ulelong		>0x40
807>>>0x74	ulelong		>0
808>>>>0x78 ubyte		0x00	AY-3-8910,
809>>>>0x78 ubyte		0x01	AY-3-8912,
810>>>>0x78 ubyte		0x02	AY-3-8913,
811>>>>0x78 ubyte		0x03	AY-3-8930,
812>>>>0x78 ubyte		0x10	YM2149,
813>>>>0x78 ubyte		0x11	YM3439,
814>>>>0x78 ubyte		0x12	YMZ284,
815>>>>0x78 ubyte		0x13	YMZ294,
816# VGM 1.61
817>>0x34	ulelong		>0x4C
818>>>0x80	ulelong		>0	DMG,
819>>0x34	ulelong		>0x50
820>>>0x84	lelong		>0	NES APU,
821>>>0x84	lelong		<0	NES APU with FDS,
822>>0x34	ulelong		>0x54
823>>>0x88	ulelong		>0	MultiPCM,
824>>0x34	ulelong		>0x58
825>>>0x8C	ulelong		>0	uPD7759 (ADPCM Speech),
826>>0x34	ulelong		>0x5C
827>>>0x90	ulelong		>0	OKIM6258 (ADPCM Speech),
828>>0x34	ulelong		>0x64
829>>>0x98	ulelong		>0	OKIM6295 (ADPCM),
830>>0x34	ulelong		>0x68
831>>>0x9C	ulelong		>0	K051649,
832>>0x34	ulelong		>0x6C
833>>>0xA0	ulelong		>0	K054539,
834>>0x34	ulelong		>0x70
835>>>0xA4	ulelong		>0	HuC6280,
836>>0x34	ulelong		>0x74
837>>>0xA8	ulelong		>0	C140,
838>>0x34	ulelong		>0x78
839>>>0xAC	ulelong		>0	K053260,
840>>0x34	ulelong		>0x7C
841>>>0xB0	ulelong		>0	Pokey,
842>>0x34	ulelong		>0x80
843>>>0xB4	ulelong		>0	QSound,
844# VGM 1.71
845>>0x34	ulelong		>0x84
846>>>0xB8	ulelong		>0	SCSP,
847>>0x34	ulelong		>0x8C
848>>>0xC0	ulelong		>0	WonderSwan,
849>>0x34	ulelong		>0x90
850>>>0xC4	ulelong		>0	VSU,
851>>0x34	ulelong		>0x94
852>>>0xC8	ulelong		>0	SAA1099,
853>>0x34	ulelong		>0x98
854>>>0xCC	ulelong		>0	ES5503 (DOC),
855>>0x34	ulelong		>0x9C
856>>>0xD0	lelong		>0	ES5505 (OTIS),
857>>>0xD0	lelong		<0	ES5506 (OTTO),
858>>0x34	ulelong		>0xA4
859>>>0xD8	ulelong		>0	X1-010,
860>>0x34	ulelong		>0xA8
861>>>0xDC	ulelong		>0	C352,
862>>0x34	ulelong		>0xAC
863>>>0xE0	ulelong		>0	GA20,
864
865# GVOX Encore file format
866# Since this is a proprietary file format and there is no publicly available
867# format specification, this is just based on induction
868#
8690	string	SCOW
870>4	byte	0xc4	GVOX Encore music, version 5.0 or above
871>4	byte	0xc2	GVOX Encore music, version < 5.0
872
8730	string	ZBOT
874>4	byte	0xc5	GVOX Encore music, version < 5.0
875
876# Summary:	Garmin Voice Processing Module (WAVE audios)
877# From:		Joerg Jenderek
878# URL:		https://www.garmin.com/
879# Reference:	http://www.poi-factory.com/node/19580
880# NOTE:		there exist 2 other Garmin VPM formats
8810		string	AUDIMG
882# skip text files starting with string "AUDIMG"
883>13		ubyte		<13	Garmin Voice Processing Module
884!:mime	audio/x-vpm-wav-garmin
885!:ext	vpm
886# 3 bytes indicating the voice version (200,220)
887>>6		string		x	\b, version %3.3s
888# day of release (01-31)
889>>12		ubyte		x	\b, %.2d
890# month of release (01-12)
891>>13		ubyte		x	\b.%.2d
892# year of release (like 2006, 2007, 2008)
893>>14		uleshort	x	\b.%.4d
894# hour of release (0-23)
895>>11		ubyte		x	%.2d
896# minute of release (0-59)
897>>10		ubyte		x	\b:%.2d
898# second of release (0-59)
899>>9		ubyte		x	\b:%.2d
900# if you select a language like german on your garmin device
901# you can only select voice modules with corresponding language byte ID like 1
902>>18		ubyte		x	\b, language ID %d
903# structure for phrases/sentences?
904# number of voice sample in the 1st phrase?
905#>>19		uleshort		x	\b, %#x samples
906#>>>21		uleshort		>0	\b, at %#4.4x
907#>>>(21.s)	ubequad			x	%#llx
908# 2nd phrase?
909#>>23		uleshort		x	\b, %#x samples
910#>>>25		uleshort		>0	\b, at %#4.4x
911#>>>(25.s)	ubequad			x	%#llx
912# pointer to 1st audio WAV sample
913>>16		uleshort	>0
914>>>(16.s)	ulelong		>0	\b, at %#x
915# WAV length
916# 1 space char after "bytes" to get phrase "bytes RIFF"
917>>>>(16.s+4)	ulelong		>0	%u bytes
918# look for magic
919>>>>>(&-8.l)	string		RIFF
920# determine type by ./riff
921>>>>>>&-4	indirect	x
922# 2 - ~ 131 WAV samples following same way
923#
924# Summary:	encrypted Garmin Voice Processing Module
925# From:		Joerg Jenderek
926# URL:		https://www.garmin.com/us/products/ontheroad/voicestudio
927# NOTE:		Encrypted variant used in voices like DrNightmare, Elfred, Yeti.
928#		There exist 2 other Garmin VPM formats
9290	ubequad		0xa141190fecc8ced6	Garmin Voice Processing Module (encrypted)
930!:mime	audio/x-vpm-garmin
931!:ext	vpm
932
933# From Martin Mueller Skarbiniks Pedersen
9340		string		GDM
935>0x3		byte		0xFE	General Digital Music.
936>>0x4		string		>\0	title: "%s"
937>>0x24		string		>\0	musician: "%s"
938>>>0x44		beshort		0x0D0A
939>>>>0x46	byte		0x1A
940>>>>>0x47	string		GMFS	Version
941>>>>>0x4B	byte		x	%d.
942>>>>>0x4C	byte		x	\b%02d
943>>>>>0x4D	beshort		0x000	(2GDM v
944>>>>>0x4F	byte		x	\b%d.
945>>>>>>0x50	byte		x	\b%d)
946
9470		string		MTM	Multitracker
948>0x3		byte/16		x	Version %d.
949>0x3		byte&0x0F	x	\b%02d
950>>0x4		string		>\0	title: "%s"
951
9520		string		MO3
953>3		ubyte		<6	MOdule with MP3
954>>3		byte		0	Version	0	(With MP3 and lossless)
955>>3		byte		1	Version	1	(With ogg and lossless)
956>>3		byte		3	Version 2.2
957>>3		byte		4	(With no LAME header)
958>>3		byte		5	Version 2.4
959
9600		string		ADRVPACK	AProSys	module
961
962# ftp://ftp.modland.com/pub/documents/format_documentation/\
963# Art%20Of%20Noise%20(.aon).txt
9640		string		AON
965>4		string		"ArtOfNoise by Bastian Spiegel(twice/lego)"
966>0x2e		string		NAME	Art of Noise Tracker Song
967>3		string		<9
968>>3		string		4	(4 voices)
969>>3		string		8	(8 voices)
970>>0x36		string		>\0	Title: "%s"
971
9720		string		FAR
973>0x2c		byte		0x0d
974>>0x2d		byte		0x0a
975>>>0x2e		byte		0x1a
976>>>>0x3		byte		0xFE	Farandole Tracker Song
977>>>>>0x31		byte/16		x	Version %d.
978>>>>>0x31		byte&0x0F	x	\b%02d
979>>>>>0x4		string		>\0	\b, title: "%s"
980
981# magic for Klystrack, https://kometbomb.github.io/klystrack/
982# from Alex Myczko <alex@aiei.ch>
9830	string	cyd!song	Klystrack song
984>8	byte	>0		\b, version %u
985>8	byte	>26
986#>>9	byte	x		\b, channels %u
987#>>10	leshort	x		\b, time signature %u
988#>>12	leshort	x		\b, sequence step %u
989#>>14	byte	x		\b, instruments %u
990#>>15	leshort	x		\b, patterns %u
991#>>17	leshort	x		\b, sequences %u
992#>>19	leshort	x		\b, length %u
993#>>21	leshort	x		\b, loop point %u
994#>>23	byte	x		\b, master volume %u
995#>>24	byte	x		\b, song speed %u
996#>>25	byte	x		\b, song speed2 %u
997#>>26	byte	x		\b, song rate %u
998#>>27	belong	x		\b, flags %#x
999#>>31	byte	x		\b, multiplex period %u
1000#>>32	byte	x		\b, pitch inaccuracy %u
1001>>149	pstring	x		\b, title %s
1002
10030	string	cyd!inst	Klystrack instrument
1004
1005# magic for WOPL instrument files, https://github.com/Wohlstand/OPL3BankEditor
1006# see Specifications/WOPL-and-OPLI-Specification.txt
1007
10080	string	WOPL3-INST\0	WOPL instrument
1009>11	leshort	x	\b, version %u
10100	string	WOPL3-BANK\0	WOPL instrument bank
1011>11	leshort	x	\b, version %u
1012
1013# AdLib/OPL instrument files. Format specifications on
1014#  http://www.shikadi.net/moddingwiki
10150	string	Junglevision\ Patch\ File	Junglevision instrument data
10160	string	#OPL_II#	DMX OP2 instrument data
10170	string	IBK\x1a		IBK instrument data
10180	string	2OP\x1a		IBK instrument data, 2 operators
10190	string	4OP\x1a		IBK instrument data, 4 operators
10202	string	ADLIB-		AdLib instrument data
1021>0	byte	x		\b, version %u
1022>1	byte	x		\b.%u
1023
1024# CRI ADX ADPCM audio
1025# Used by various Sega games.
1026# https://en.wikipedia.org/wiki/ADX_(file_format)
1027# https://wiki.multimedia.cx/index.php/CRI_ADX_file
1028# Added by David Korth <gerbilsoft@gerbilsoft.com>
10290x00		beshort		0x8000
1030>(2.S-2)	string		(c)CRI		CRI ADX ADPCM audio
1031!:ext adx
1032!:mime audio/x-adx
1033!:strength +50
1034>>0x12		byte		x		v%u
1035>>0x04		byte		0x02		\b, pre-set prediction coefficients
1036>>0x04		byte		0x03		\b, standard ADX
1037>>0x04		byte		0x04		\b, exponential scale
1038>>0x04		byte		0x10		\b, AHX (Dreamcast)
1039>>0x04		byte		0x11		\b, AHX
1040>>0x08		belong		x		\b, %u Hz
1041>>0x12		byte		0x03
1042>>>0x02		beshort		>0x2B
1043>>>>0x18	belong		!0		\b, looping
1044>>0x12		byte		0x04
1045>>>0x02		beshort		>0x37
1046>>>>0x24	belong		!0		\b, looping
1047>>0x13		byte&0x08	0x08		\b, encrypted
1048
1049# Lossless audio (.la) (http://www.lossless-audio.com/)
10500	string	LA
1051>2	string	03	Lossless audio version 0.3
1052>2	string	04	Lossless audio version 0.4
1053
1054# Sony PlayStation Audio (.xa)
10550	leshort 0x4158	Sony PlayStation Audio
1056
1057# Portable Sound Format
1058# Used for audio rips for various consoles.
1059# http://fileformats.archiveteam.org/wiki/Portable_Sound_Format
1060# Added by David Korth <gerbilsoft@gerbilsoft.com>
10610	string	PSF
1062>3	byte	0x01
1063>>0	use	portable_sound_format
1064>3	byte	0x02
1065>>0	use	portable_sound_format
1066>3	byte	0x11
1067>>0	use	portable_sound_format
1068>3	byte	0x12
1069>>0	use	portable_sound_format
1070>3	byte	0x13
1071>>0	use	portable_sound_format
1072>3	byte	0x21
1073>>0	use	portable_sound_format
1074>3	byte	0x22
1075>>0	use	portable_sound_format
1076>3	byte	0x23
1077>>0	use	portable_sound_format
1078>3	byte	0x41
1079>>0	use	portable_sound_format
1080
1081
10820	name	portable_sound_format
1083>0	string	PSF	Portable Sound Format
1084!:mime	audio/x-psf
1085>>3	byte	0x01	(Sony PlayStation)
1086>>3	byte	0x02	(Sony PlayStation 2)
1087>>3	byte	0x11	(Sega Saturn)
1088>>3	byte	0x12	(Sega Dreamcast)
1089>>3	byte	0x13	(Sega Mega Drive)
1090>>3	byte	0x21	(Nintendo 64)
1091>>3	byte	0x22	(Game Boy Advance)
1092>>3	byte	0x23	(Super NES)
1093>>3	byte	0x41	(Capcom QSound)
1094
1095# Atari 8-bit SAP audio format
1096# http://asap.sourceforge.net/sap-format.html
1097# Added by David Korth <gerbilsoft@gerbilsoft.com>
10980	string		SAP\r\n	Atari 8-bit SAP audio file
1099!:mime	audio/x-sap
1100!:ext	sap
1101>5	search/1024	NAME
1102>>&1	string		x	\b: %s
1103>>5	search/1024	AUTHOR
1104>>>&1	string		x	by %s
1105
1106# Nintendo Wii BRSTM audio format (fields)
1107# NOTE: Assuming HEAD starts at 0x40.
1108# FIXME: Replace 0x48 with HEAD offset plus 8.
11090	name	nintendo-wii-brstm-fields
1110>(0x10.L)	string	HEAD	\b:
1111>>(0x10.L+0x0C)	belong	x
1112>>>(&-4.L+0x48)	belong	x
1113>>>>&-4		byte	0	PCM, signed 8-bit,
1114>>>>&-4		byte	1	PCM, signed 16-bit,
1115>>>>&-4		byte	2	THP ADPCM,
1116>>>>&-3		byte	!0	looping,
1117>>>>&-2		byte	1	mono
1118>>>>&-2		byte	2	stereo
1119>>>>&-2		byte	3	3 channels
1120>>>>&-2		byte	4	quad
1121>>>>&-2		byte	>4	%u channels
1122>>>>&0		beshort	!0	%u Hz
1123
1124# Nintendo Wii BRSTM audio format
1125# https://wiibrew.org/wiki/BRSTM_file
1126# Added by David Korth <gerbilsoft@gerbilsoft.com>
11270	string		RSTM	Nintendo Wii BRSTM audio file
1128!:mime	audio/x-brstm
1129!:ext	brstm
1130# Wii is big-endian, so default to BE.
1131>4	beshort		0xFEFF
1132>>0	use		nintendo-wii-brstm-fields
1133>4	leshort		0xFEFF
1134>>0	use		\^nintendo-wii-brstm-fields
1135
1136# Nintendo 3DS BCSTM audio format (fields)
11370	name	nintendo-3ds-bcstm-fields
1138>(0x18.l)	string	INFO	\b:
1139# INFO block: Stream information starts at 0x20 (minus 4 for the 'INFO' magic)
1140>>&0x1C		byte	0	PCM, signed 8-bit,
1141>>&0x1C		byte	1	PCM, signed 16-bit,
1142>>&0x1C		byte	2	DSP ADPCM,
1143>>&0x1C		byte	3	IMA ADPCM,
1144>>&0x1D		byte	!0	looping,
1145>>&0x1E		byte	1	mono
1146>>&0x1E		byte	2	stereo
1147>>&0x1E		byte	3	3 channels
1148>>&0x1E		byte	4	quad
1149>>&0x1E		byte	>4	%u channels
1150>>&0x20		lelong	!0	%u Hz
1151
1152# Nintendo 3DS BCSTM audio format
1153# https://www.3dbrew.org/wiki/BCSTM
1154# Added by David Korth <gerbilsoft@gerbilsoft.com>
11550	string		CSTM	Nintendo 3DS BCSTM audio file
1156!:mime	audio/x-bcstm
1157!:ext	bcstm
1158# 3DS is little-endian, so default to LE.
1159>4	leshort		0xFEFF
1160>>0	use		nintendo-3ds-bcstm-fields
1161>4	beshort		0xFEFF
1162>>0	use		\^nintendo-3ds-bcstm-fields
1163
1164# Nintendo Wii U BFSTM audio format
1165# http://mk8.tockdom.com/wiki/BFSTM_(File_Format)
1166# NOTE: This format is very similar to BCSTM.
1167# Added by David Korth <gerbilsoft@gerbilsoft.com>
11680	string		FSTM	Nintendo Wii U BFSTM audio file
1169!:mime	audio/x-bfstm
1170!:ext	bfstm
1171# BFSTM is used on both Wii U (BE) and Switch (LE),
1172# so default to LE.
1173>4	leshort		0xFEFF
1174>>0	use		nintendo-3ds-bcstm-fields
1175>4	beshort		0xFEFF
1176>>0	use		\^nintendo-3ds-bcstm-fields
1177
1178# Nintendo 3DS BCSTM audio format (fields)
11790	name	nintendo-3ds-bcwav-fields
1180>(0x18.l)	string	INFO	\b:
1181# INFO block (minus 4 for INFO magic)
1182>>&0x4		byte	0	PCM, signed 8-bit,
1183>>&0x4		byte	1	PCM, signed 16-bit,
1184>>&0x4		byte	2	DSP ADPCM,
1185>>&0x4		byte	3	IMA ADPCM,
1186>>&0x5		byte	!0	looping,
1187>>&0x8		lelong	x	stereo
1188>>&0x8		lelong	!0	%u Hz
1189
1190# Nintendo 3DS BCWAV audio format
1191# https://www.3dbrew.org/wiki/BCWAV
1192# Added by David Korth <gerbilsoft@gerbilsoft.com>
11930	string		CWAV	Nintendo 3DS BCWAV audio file
1194!:mime	audio/x-bcwav
1195!:ext	bcwav
1196# 3DS is little-endian, so default to LE.
1197>4	leshort		0xFEFF
1198>>0	use		nintendo-3ds-bcwav-fields
1199>4	beshort		0xFEFF
1200>>0	use		\^nintendo-3ds-bcwav-fields
1201
1202# Philips DSDIFF audio format (Direct Stream Digital Interchange File Format)
1203# Used for DSD audio recordings and Super Audio CD (SACD) mastering annotations
1204# https://dsd-guide.com/sites/default/files/white-papers/DSDIFF_1.5_Spec.pdf
1205# From: Toni Ruottu <toni.ruottu@iki.fi>
12060		string		FRM8
120712		string		DSD\x20		DSDIFF audio bitstream data
1208!:mime		audio/x-dff
1209!:ext		dff
1210
1211# format version chunk
1212>&0		string		FVER
1213# version 1
1214>>&8		byte		1
1215
1216# v1 / sampling resolution ( 1 bit PDM only )
1217>>>&0		string		x		\b, 1 bit
1218
1219# v1 / sound property chunk
1220>>>&0		search/0xff	PROP
1221>>>>&8		string		SND
1222
1223# v1 / sound property chunk / channel configuration chunk
1224>>>>>&0		search/0xff	CHNL
1225>>>>>>&8	ubeshort	1							\b, mono
1226>>>>>>&8	ubeshort	2
1227>>>>>>>&0	string		SLFTSRGT						\b, stereo
1228>>>>>>>&0	default		x							\b, 2 channels
1229>>>>>>&8	ubeshort	3
1230>>>>>>>&0	string		SLFTSRGTLFE\x20						\b, 2.1 stereo
1231>>>>>>>&0	string		SLFTSRGTC\x20\x20\x20					\b, 3.0 stereo
1232>>>>>>>&0	default		x							\b, 3 channels
1233>>>>>>&8	ubeshort	4
1234>>>>>>>&0	string		MLFTMRGTLS\x20\x20RS\x20\x20				\b, 4.0 surround
1235>>>>>>>&0	string		SLFTSRGTC\x20\x20\x20LFE\x20				\b, 3.1 stereo
1236>>>>>>>&0	default		x							\b, 4 channels
1237>>>>>>&8	ubeshort	5
1238>>>>>>>&0	string		MLFTMRGTC\x20\x20\x20LS\x20\x20RS\x20\x20		\b, 5.0 surround
1239>>>>>>>&0	string		MLFTMRGTLFE\x20LS\x20\x20RS\x20\x20			\b, 4.1 surround
1240>>>>>>>&0	default		x							\b, 5 channels
1241>>>>>>&8	ubeshort	6
1242>>>>>>>&0	string		MLFTMRGTC\x20\x20\x20LFE\x20LS\x20\x20RS\x20\x20	\b, 5.1 surround
1243>>>>>>>&0	default		x							\b, 6 channels
1244>>>>>>&8	ubeshort	>6							\b, %u channels
1245
1246# v1 / sound property chunk / sample rate chunk
1247>>>>>&0		search/0xff	FS\x20\x20
1248>>>>>>&0	string		x		\b,
1249>>>>>>&8	ubelong%44100	0
1250>>>>>>>&-4	ubelong/44100	x		"DSD %u"
1251>>>>>>>&-4	ubelong		x		%u Hz
1252
1253# v1 / sound property chunk / compression type chunk
1254>>>>>&0		search/0xff	CMPR
1255>>>>>>&8	string		DSD\x20		\b, no compression
1256>>>>>>&8	string		DST\x20		\b, DST compression
1257>>>>>>&8	default		x		\b, unknown compression
1258
1259# v1 / quest for metadata
1260>>>&0		string		x
1261
1262# v1 / quest for metadata / edited master information chunk
1263>>>>&0		search		DIIN
1264>>>>>&0		ubequad		>0		\b, "edited master" metadata
1265
1266# v1 / quest for metadata / ID3 chunk ( defacto standard )
1267>>>>&0		search		ID3\x20
1268>>>>>&8		string		ID3		\b, ID3 version 2
1269>>>>>&0		byte		x		\b.%u
1270>>>>>&1		byte		x		\b.%u
1271
1272# v1 / quest for metadata / failure ( possibly due to -P bytes=... being too low )
1273>>>>&0		default		x		\b, ID3 missing (or unreachable)
1274
1275# version > 1 or 0
1276>>&0		default		x		\b, unknown version
1277
1278# Sony DSF audio format (Direct Stream Digital Stream File)
1279# Used for lossless digital storage of songs produced as DSD audio
1280# Portable analog of a track stored on a Super Audio CD (SACD)
1281# https://dsd-guide.com/sites/default/files/white-papers/DSFFileFormatSpec_E.pdf
1282# From: Toni Ruottu <toni.ruottu@iki.fi>
12830		string		DSD\x20		DSF audio bitstream data
1284!:mime		audio/x-dsf
1285!:ext		dsf
1286
1287# format chunk
1288>28		string		fmt\x20
1289# version 1
1290>>&8		ulelong		1
1291
1292# v1 / sampling resolution ( 1 bit PDM only )
1293# NOTE: the spec incorrectly uses "bits per sample" instead of "bits per byte"
1294>>>&0		string		x		\b, 1 bit
1295
1296# v1 / channel configuration
1297>>>>&4		ulelong		1		\b, mono
1298>>>>&4		ulelong		2		\b, stereo
1299>>>>&4		ulelong		3		\b, 3.0 stereo
1300>>>>&4		ulelong		4		\b, 4.0 surround
1301>>>>&4		ulelong		5		\b, 3.1 stereo
1302>>>>&4		ulelong		6		\b, 5.0 surround
1303>>>>&4		ulelong		7		\b, 5.1 surround
1304>>>>&0		default		x
1305>>>>>&4		ulelong		x		\b, %u channels
1306
1307# v1 / sample rate chunk
1308>>>>&0		string		x		\b,
1309>>>>&12		ulelong%44100	0
1310>>>>>&-4	ulelong/44100	x		"DSD %u"
1311>>>>&12		ulelong		x		%u Hz
1312
1313# v1 / compression
1314>>>>&0		string		x
1315>>>>>&0		ulelong		0		\b, no compression
1316>>>>>&0		default		x		\b, unknown compression
1317
1318# v1 / embedded ID3v2 metadata
1319>>>0		string		x 		\b, ID3
1320>>>>20		ulequad		!0
1321>>>>>(20.q)	string		ID3		version 2
1322>>>>>>&0	byte		x		\b.%u
1323>>>>>>&1	byte		x		\b.%u
1324# unable to verify ID3 ( possibly due to -P bytes=... being too low )
1325>>>>>&0		default		x		unreachable
1326>>>>&0		default		x		missing
1327
1328# version > 1 or 0
1329>>&0		default		x		\b, unknown version
1330
1331# https://moddingwiki.shikadi.net/wiki/ROL_Format
13324	string	\\roll\\default	AdLib Visual Composer ROL file
1333>0	leshort	x		\b, version %d.
1334>2	leshort	x		\b%d
1335>44	leshort	x		\b, tickBeat %d
1336>46	leshort	x		\b, beatMeasure %d
1337>48	leshort	x		\b, scaleY %d
1338>50	leshort	x		\b, scaleX %d
1339>52	byte	0		\b, percussive
1340>52	byte	1		\b, melodic
1341