summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristos Zoulas <christos@zoulas.com>2022-08-28 08:58:20 +0000
committerChristos Zoulas <christos@zoulas.com>2022-08-28 08:58:20 +0000
commit333eff469d463ff417a6f75bb9e32ce2207fa578 (patch)
tree4e4409a749ca3b3e7b4449eae2e2bf2c4581f4df
parentb926cd642add8c524df29c74799bf8545a718640 (diff)
downloadfile-git-333eff469d463ff417a6f75bb9e32ce2207fa578.tar.gz
New magic from Toni Ruottu
-rw-r--r--magic/Magdir/audio131
-rw-r--r--tests/Makefile.am4
-rw-r--r--tests/dsd64-dff.result1
-rw-r--r--tests/dsd64-dff.testfilebin0 -> 17922 bytes
-rw-r--r--tests/dsd64-dsf.result1
-rw-r--r--tests/dsd64-dsf.testfilebin0 -> 20707 bytes
6 files changed, 136 insertions, 1 deletions
diff --git a/magic/Magdir/audio b/magic/Magdir/audio
index be184859..0328f7ba 100644
--- a/magic/Magdir/audio
+++ b/magic/Magdir/audio
@@ -1,6 +1,6 @@
#------------------------------------------------------------------------------
-# $File: audio,v 1.123 2022/08/16 11:19:20 christos Exp $
+# $File: audio,v 1.124 2022/08/28 08:58:20 christos Exp $
# audio: file(1) magic for sound formats (see also "iff")
#
# Jan Nicolai Langfeldt (janl@ifi.uio.no), Dan Quinlan (quinlan@yggdrasil.com),
@@ -1145,3 +1145,132 @@
>>0 use nintendo-3ds-bcwav-fields
>4 beshort 0xFEFF
>>0 use \^nintendo-3ds-bcwav-fields
+
+# Philips DSDIFF audio format (Direct Stream Digital Interchange File Format)
+# Used for DSD audio recordings and Super Audio CD (SACD) mastering annotations
+# https://dsd-guide.com/sites/default/files/white-papers/DSDIFF_1.5_Spec.pdf
+# From: Toni Ruottu <toni.ruottu@iki.fi>
+0 string FRM8
+12 string DSD\x20 DSDIFF audio bitstream data
+!:mime audio/x-dff
+!:ext dff
+
+# format version chunk
+>&0 string FVER
+# version 1
+>>&8 byte 1
+
+# v1 / sampling resolution ( 1 bit PDM only )
+>>>&0 string x \b, 1 bit
+
+# v1 / sound property chunk
+>>>&0 search/0xff PROP
+>>>>&8 string SND
+
+# v1 / sound property chunk / channel configuration chunk
+>>>>>&0 search/0xff CHNL
+>>>>>>&8 ubeshort 1 \b, mono
+>>>>>>&8 ubeshort 2
+>>>>>>>&0 string SLFTSRGT \b, stereo
+>>>>>>>&0 default x \b, 2 channels
+>>>>>>&8 ubeshort 3
+>>>>>>>&0 string SLFTSRGTLFE\x20 \b, 2.1 stereo
+>>>>>>>&0 string SLFTSRGTC\x20\x20\x20 \b, 3.0 stereo
+>>>>>>>&0 default x \b, 3 channels
+>>>>>>&8 ubeshort 4
+>>>>>>>&0 string MLFTMRGTLS\x20\x20RS\x20\x20 \b, 4.0 surround
+>>>>>>>&0 string SLFTSRGTC\x20\x20\x20LFE\x20 \b, 3.1 stereo
+>>>>>>>&0 default x \b, 4 channels
+>>>>>>&8 ubeshort 5
+>>>>>>>&0 string MLFTMRGTC\x20\x20\x20LS\x20\x20RS\x20\x20 \b, 5.0 surround
+>>>>>>>&0 string MLFTMRGTLFE\x20LS\x20\x20RS\x20\x20 \b, 4.1 surround
+>>>>>>>&0 default x \b, 5 channels
+>>>>>>&8 ubeshort 6
+>>>>>>>&0 string MLFTMRGTC\x20\x20\x20LFE\x20LS\x20\x20RS\x20\x20 \b, 5.1 surround
+>>>>>>>&0 default x \b, 6 channels
+>>>>>>&8 ubeshort >6 \b, %u channels
+
+# v1 / sound property chunk / sample rate chunk
+>>>>>&0 search/0xff FS\x20\x20
+>>>>>>&0 string x \b,
+>>>>>>&8 ubelong%44100 0
+>>>>>>>&-4 ubelong/44100 x "DSD %u"
+>>>>>>>&-4 ubelong x %u Hz
+
+# v1 / sound property chunk / compression type chunk
+>>>>>&0 search/0xff CMPR
+>>>>>>&8 string DSD\x20 \b, no compression
+>>>>>>&8 string DST\x20 \b, DST compression
+>>>>>>&8 default x \b, unknown compression
+
+# v1 / quest for metadata
+>>>&0 string x
+
+# v1 / quest for metadata / edited master information chunk
+>>>>&0 search DIIN
+>>>>>&0 ubequad >0 \b, "edited master" metadata
+
+# v1 / quest for metadata / ID3 chunk ( defacto standard )
+>>>>&0 search ID3\x20
+>>>>>&8 string ID3 \b, ID3 version 2
+>>>>>&0 byte x \b.%u
+>>>>>&1 byte x \b.%u
+
+# v1 / quest for metadata / failure ( possibly due to -P bytes=... being too low )
+>>>>&0 default x \b, ID3 missing (or unreachable)
+
+# version > 1 or 0
+>>&0 default x \b, unknown version
+
+# Sony DSF audio format (Direct Stream Digital Stream File)
+# Used for lossless digital storage of songs produced as DSD audio
+# Portable analog of a track stored on a Super Audio CD (SACD)
+# https://dsd-guide.com/sites/default/files/white-papers/DSFFileFormatSpec_E.pdf
+# From: Toni Ruottu <toni.ruottu@iki.fi>
+0 string DSD\x20 DSF audio bitstream data
+!:mime audio/x-dsf
+!:ext dsf
+
+# format chunk
+>28 string fmt\x20
+# version 1
+>>&8 ulelong 1
+
+# v1 / sampling resolution ( 1 bit PDM only )
+# NOTE: the spec incorrectly uses "bits per sample" instead of "bits per byte"
+>>>&0 string x \b, 1 bit
+
+# v1 / channel configuration
+>>>>&4 ulelong 1 \b, mono
+>>>>&4 ulelong 2 \b, stereo
+>>>>&4 ulelong 3 \b, 3.0 stereo
+>>>>&4 ulelong 4 \b, 4.0 surround
+>>>>&4 ulelong 5 \b, 3.1 stereo
+>>>>&4 ulelong 6 \b, 5.0 surround
+>>>>&4 ulelong 7 \b, 5.1 surround
+>>>>&0 default x
+>>>>>&4 ulelong x \b, %u channels
+
+# v1 / sample rate chunk
+>>>>&0 string x \b,
+>>>>&12 ulelong%44100 0
+>>>>>&-4 ulelong/44100 x "DSD %u"
+>>>>&12 ulelong x %u Hz
+
+# v1 / compression
+>>>>&0 string x
+>>>>>&0 ulelong 0 \b, no compression
+>>>>>&0 default x \b, unknown compression
+
+# v1 / embedded ID3v2 metadata
+>>>0 string x \b, ID3
+>>>>20 ulequad !0
+>>>>>(20.q) string ID3 version 2
+>>>>>>&0 byte x \b.%u
+>>>>>>&1 byte x \b.%u
+# unable to verify ID3 ( possibly due to -P bytes=... being too low )
+>>>>>&0 default x unreachable
+>>>>&0 default x missing
+
+# version > 1 or 0
+>>&0 default x \b, unknown version
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 2ae91d75..22120a8b 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -17,6 +17,10 @@ bcachefs.result \
bcachefs.testfile \
cl8m8ocofedso.result \
cl8m8ocofedso.testfile \
+dsd64-dff.result \
+dsd64-dff.testfile \
+dsd64-dsf.result \
+dsd64-dsf.testfile \
escapevel.result \
escapevel.testfile \
ext4.result \
diff --git a/tests/dsd64-dff.result b/tests/dsd64-dff.result
new file mode 100644
index 00000000..bf609678
--- /dev/null
+++ b/tests/dsd64-dff.result
@@ -0,0 +1 @@
+DSDIFF audio bitstream data, 1 bit, mono, "DSD 64" 2822400 Hz, no compression, ID3 version 2.0.0
diff --git a/tests/dsd64-dff.testfile b/tests/dsd64-dff.testfile
new file mode 100644
index 00000000..b5aba620
--- /dev/null
+++ b/tests/dsd64-dff.testfile
Binary files differ
diff --git a/tests/dsd64-dsf.result b/tests/dsd64-dsf.result
new file mode 100644
index 00000000..a0d5f759
--- /dev/null
+++ b/tests/dsd64-dsf.result
@@ -0,0 +1 @@
+DSF audio bitstream data, 1 bit, mono, "DSD 64" 2822400 Hz, no compression, ID3 version 2.3.0
diff --git a/tests/dsd64-dsf.testfile b/tests/dsd64-dsf.testfile
new file mode 100644
index 00000000..a1d106d8
--- /dev/null
+++ b/tests/dsd64-dsf.testfile
Binary files differ