# $OpenBSD: audio,v 1.9 2007/04/08 06:11:39 sturm Exp $ #------------------------------------------------------------------------------ # audio: file(1) magic for sound formats (see also "iff") # # Jan Nicolai Langfeldt (janl@ifi.uio.no), Dan Quinlan (quinlan@yggdrasil.com), # and others # # Sun/NeXT audio data 0 string .snd Sun/NeXT audio data: >12 belong 1 8-bit ISDN u-law, >12 belong 2 8-bit linear PCM [REF-PCM], >12 belong 3 16-bit linear PCM, >12 belong 4 24-bit linear PCM, >12 belong 5 32-bit linear PCM, >12 belong 6 32-bit IEEE floating point, >12 belong 7 64-bit IEEE floating point, >12 belong 23 8-bit ISDN u-law compressed (CCITT G.721 ADPCM voice data encoding), >12 belong 24 compressed (8-bit G.722 ADPCM) >12 belong 25 compressed (3-bit G.723 ADPCM), >12 belong 26 compressed (5-bit G.723 ADPCM), >12 belong 27 8-bit A-law, >20 belong 1 mono, >20 belong 2 stereo, >20 belong 4 quad, >16 belong >0 %d Hz # DEC systems (e.g. DECstation 5000) use a variant of the Sun/NeXT format # that uses little-endian encoding and has a different magic number 0 lelong 0x0064732E DEC audio data: >12 lelong 1 8-bit ISDN u-law, >12 lelong 2 8-bit linear PCM [REF-PCM], >12 lelong 3 16-bit linear PCM, >12 lelong 4 24-bit linear PCM, >12 lelong 5 32-bit linear PCM, >12 lelong 6 32-bit IEEE floating point, >12 lelong 7 64-bit IEEE floating point, >12 lelong 23 8-bit ISDN u-law compressed (CCITT G.721 ADPCM voice data encoding), >20 lelong 1 mono, >20 lelong 2 stereo, >20 lelong 4 quad, >16 lelong >0 %d Hz # Creative Labs AUDIO stuff 0 string MThd Standard MIDI data >9 byte >0 (format %d) >11 byte >1 using %d channels 0 string CTMF Creative Music (CMF) data 0 string SBI SoundBlaster instrument data 0 string Creative\ Voice\ File Creative Labs voice data # is this next line right? it came this way... >19 byte 0x1A >23 byte >0 - version %d >22 byte >0 \b.%d # first entry is also the string "NTRK" 0 belong 0x4e54524b MultiTrack sound data >4 belong x - version %ld # Microsoft WAVE format (*.wav) 0 string RIFF Microsoft RIFF >8 string WAVE \b, WAVE audio data >>34 leshort >0 \b, %d bit >>22 leshort =1 \b, mono >>22 leshort =2 \b, stereo >>22 leshort >2 \b, %d channels >>24 lelong >0 %d Hz # AVI == Audio Video Interleave >8 string AVI\ \b, AVI data # Extended MOD format (*.emd) (Greg Roelofs, newt@uchicago.edu); NOT TESTED # [based on posting 940824 by "Dirk/Elastik", husberg@lehtori.cc.tut.fi] 0 string EMOD Extended MOD sound data, >4 byte&0xf0 x version %d >4 byte&0x0f x \b.%d, >45 byte x %d instruments >83 byte 0 (module) >83 byte 1 (song) # Real Audio (Magic .ra\0375) 0 belong 0x2e7261fd realaudio sound file # MTM/669/FAR/S3M/ULT/XM format checking [Aaron Eppert, aeppert@dialin.ind.net] # Oct 31, 1995 #0 string MTM MultiTracker Module sound file #0 string if Composer 669 Module sound data #0 string FAR Module sound data #0 string MAS_U ULT(imate) Module sound data #0x2c string SCRM ScreamTracker III Module sound data #0 string Extended Module Extended Module sound data #------------------------ # MPEG: file(1) magic for MPEG audio. # # From # Show MPEG level, layer, kbit/s, hz, stereo/mono for an MPG audio file. # This section is lengthy because the kbit/s rate depends on the # level and layer, and file(1) doesn't allow math on the values. # ####### MPEG begins with three hex 'f' nibbles. 0 beshort&0xfff0 0xfff0 MPEG ####### Level 2 >1 byte&0x08 0x00 2.0 >>1 byte&0x06 0x00 Layer Unknown, ####### Level 2, Layers I, II, and III >>1 byte&0x06 0x02 Layer III, >>>2 byte&0xf0 0x00 0 kbit/s, >>>2 byte&0xf0 0x10 8 kbit/s, >>>2 byte&0xf0 0x20 16 kbit/s, >>>2 byte&0xf0 0x30 24 kbit/s, >>>2 byte&0xf0 0x40 32 kbit/s, >>>2 byte&0xf0 0x50 40 kbit/s, >>>2 byte&0xf0 0x60 48 kbit/s, >>>2 byte&0xf0 0x70 56 kbit/s, >>>2 byte&0xf0 0x80 64 kbit/s, >>>2 byte&0xf0 0x90 80 kbit/s, >>>2 byte&0xf0 0xa0 96 kbit/s, >>>2 byte&0xf0 0xb0 112 kbit/s, >>>2 byte&0xf0 0xc0 128 kbit/s, >>>2 byte&0xf0 0xd0 144 kbit/s, >>>2 byte&0xf0 0xe0 160 kbit/s, >>>2 byte&0xf0 0xf0 ? kbit/s, >>1 byte&0x06 0x04 Layer II, >>>2 byte&0xf0 0x00 0 kbit/s, >>>2 byte&0xf0 0x10 8 kbit/s, >>>2 byte&0xf0 0x20 16 kbit/s, >>>2 byte&0xf0 0x30 24 kbit/s, >>>2 byte&0xf0 0x40 32 kbit/s, >>>2 byte&0xf0 0x50 40 kbit/s, >>>2 byte&0xf0 0x60 48 kbit/s, >>>2 byte&0xf0 0x70 56 kbit/s, >>>2 byte&0xf0 0x80 64 kbit/s, >>>2 byte&0xf0 0x90 80 kbit/s, >>>2 byte&0xf0 0xa0 96 kbit/s, >>>2 byte&0xf0 0xb0 112 kbit/s, >>>2 byte&0xf0 0xc0 128 kbit/s, >>>2 byte&0xf0 0xd0 144 kbit/s, >>>2 byte&0xf0 0xe0 160 kbit/s, >>>2 byte&0xf0 0xf0 ? kbit/s, >>1 byte&0x06 0x06 Layer I, >>>2 byte&0xf0 0x00 0 kbit/s, >>>2 byte&0xf0 0x10 32 kbit/s, >>>2 byte&0xf0 0x20 48 kbit/s, >>>2 byte&0xf0 0x30 56 kbit/s, >>>2 byte&0xf0 0x40 64 kbit/s, >>>2 byte&0xf0 0x50 80 kbit/s, >>>2 byte&0xf0 0x60 96 kbit/s, >>>2 byte&0xf0 0x70 112 kbit/s, >>>2 byte&0xf0 0x80 128 kbit/s, >>>2 byte&0xf0 0x90 144 kbit/s, >>>2 byte&0xf0 0xa0 160 kbit/s, >>>2 byte&0xf0 0xb0 176 kbit/s, >>>2 byte&0xf0 0xc0 192 kbit/s, >>>2 byte&0xf0 0xd0 224 kbit/s, >>>2 byte&0xf0 0xe0 256 kbit/s, >>>2 byte&0xf0 0xf0 ? kbit/s, ####### Level 2, Hz >>2 byte&0x0c 0x00 22050 Hz >>2 byte&0x0c 0x04 24000 Hz >>2 byte&0x0c 0x08 16000 Hz >>2 byte&0x0c 0x0c ? Hz ####### Level 1 decoding >1 byte&0x08 0x08 1.0 >>1 byte&0x06 0x00 Layer Unknown. ####### Level 1, Layers I, II, and III >>1 byte&0x06 0x02 Layer III, >>>2 byte&0xf0 0x00 0 kbit/s, >>>2 byte&0xf0 0x10 32 kbit/s, >>>2 byte&0xf0 0x20 40 kbit/s, >>>2 byte&0xf0 0x30 48 kbit/s, >>>2 byte&0xf0 0x40 56 kbit/s, >>>2 byte&0xf0 0x50 64 kbit/s, >>>2 byte&0xf0 0x60 80 kbit/s, >>>2 byte&0xf0 0x70 96 kbit/s, >>>2 byte&0xf0 0x80 112 kbit/s, >>>2 byte&0xf0 0x90 128 kbit/s, >>>2 byte&0xf0 0xa0 160 kbit/s, >>>2 byte&0xf0 0xb0 192 kbit/s, >>>2 byte&0xf0 0xc0 224 kbit/s, >>>2 byte&0xf0 0xd0 256 kbit/s, >>>2 byte&0xf0 0xe0 320 kbit/s, >>>2 byte&0xf0 0xf0 ? kbit/s, >>1 byte&0x06 0x04 Layer II, >>>2 byte&0xf0 0x00 0 kbit/s, >>>2 byte&0xf0 0x10 32 kbit/s, >>>2 byte&0xf0 0x20 48 kbit/s, >>>2 byte&0xf0 0x30 56 kbit/s, >>>2 byte&0xf0 0x40 64 kbit/s, >>>2 byte&0xf0 0x50 80 kbit/s, >>>2 byte&0xf0 0x60 96 kbit/s, >>>2 byte&0xf0 0x70 112 kbit/s, >>>2 byte&0xf0 0x80 128 kbit/s, >>>2 byte&0xf0 0x90 160 kbit/s, >>>2 byte&0xf0 0xa0 192 kbit/s, >>>2 byte&0xf0 0xb0 224 kbit/s, >>>2 byte&0xf0 0xc0 256 kbit/s, >>>2 byte&0xf0 0xd0 320 kbit/s, >>>2 byte&0xf0 0xe0 384 kbit/s, >>>2 byte&0xf0 0xf0 ? kbit/s, >>1 byte&0x06 0x06 Layer I, >>>2 byte&0xf0 0x00 0 kbit/s, >>>2 byte&0xf0 0x10 32 kbit/s, >>>2 byte&0xf0 0x20 64 kbit/s, >>>2 byte&0xf0 0x30 96 kbit/s, >>>2 byte&0xf0 0x40 128 kbit/s, >>>2 byte&0xf0 0x50 160 kbit/s, >>>2 byte&0xf0 0x60 192 kbit/s, >>>2 byte&0xf0 0x70 224 kbit/s, >>>2 byte&0xf0 0x80 256 kbit/s, >>>2 byte&0xf0 0x90 288 kbit/s, >>>2 byte&0xf0 0xa0 320 kbit/s, >>>2 byte&0xf0 0xb0 352 kbit/s, >>>2 byte&0xf0 0xc0 384 kbit/s, >>>2 byte&0xf0 0xd0 416 kbit/s, >>>2 byte&0xf0 0xe0 448 kbit/s, >>>2 byte&0xf0 0xf0 ? kbit/s, ####### Level 2, Hz >>2 byte&0x0c 0x00 44100 Hz >>2 byte&0x0c 0x04 48000 Hz >>2 byte&0x0c 0x08 32000 Hz >>2 byte&0x0c 0x0c ? Hz ####### Stereo or Mono >3 byte&0xc0 0x00 stereo >3 byte&0xc0 0x40 joint-stereo >3 byte&0xc0 0x80 dual-channel >3 byte&0xc0 0xc0 mono # Free lossless audio codec # From: Przemyslaw Augustyniak 0 string fLaC FLAC audio bitstream data >4 byte&0x7f >0 \b, unknown version >4 byte&0x7f 0 \b # some common bits/sample values >>20 beshort&0x1f0 0x030 \b, 4 bit >>20 beshort&0x1f0 0x050 \b, 6 bit >>20 beshort&0x1f0 0x070 \b, 8 bit >>20 beshort&0x1f0 0x0b0 \b, 12 bit >>20 beshort&0x1f0 0x0f0 \b, 16 bit >>20 beshort&0x1f0 0x170 \b, 24 bit >>20 byte&0xe 0x0 \b, mono >>20 byte&0xe 0x2 \b, stereo >>20 byte&0xe 0x4 \b, 3 channels >>20 byte&0xe 0x6 \b, 4 channels >>20 byte&0xe 0x8 \b, 5 channels >>20 byte&0xe 0xa \b, 6 channels >>20 byte&0xe 0xc \b, 7 channels >>20 byte&0xe 0xe \b, 8 channels # some common sample rates >>17 belong&0xfffff0 0x0ac440 \b, 44.1 kHz >>17 belong&0xfffff0 0x0bb800 \b, 48 kHz >>17 belong&0xfffff0 0x07d000 \b, 32 kHz >>17 belong&0xfffff0 0x056220 \b, 22.05 kHz >>17 belong&0xfffff0 0x05dc00 \b, 24 kHz >>17 belong&0xfffff0 0x03e800 \b, 16 kHz >>17 belong&0xfffff0 0x02b110 \b, 11.025 kHz >>17 belong&0xfffff0 0x02ee00 \b, 12 kHz >>17 belong&0xfffff0 0x01f400 \b, 8 kHz >>17 belong&0xfffff0 0x177000 \b, 96 kHz >>17 belong&0xfffff0 0x0fa000 \b, 64 kHz >>21 byte&0xf >0 \b, >4G samples >>21 byte&0xf 0 \b >>>22 belong >0 \b, %u samples >>>22 belong 0 \b, length unknown # ID3 version 2 tags 0 string ID3 MP3 file with ID3 version 2. >3 ubyte <0xff \b%d. >4 ubyte <0xff \b%d tag