Skip to content

Commit c3a30eb

Browse files
author
btd
committed
adds MP3 support
1 parent fef01ef commit c3a30eb

File tree

1 file changed

+36
-27
lines changed

1 file changed

+36
-27
lines changed

soundfile.py

Lines changed: 36 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -61,36 +61,44 @@
6161
'OGG': 0x200000, # Xiph OGG container
6262
'MPC2K': 0x210000, # Akai MPC 2000 sampler
6363
'RF64': 0x220000, # RF64 WAV file
64+
'MPEG': 0x230000, # MPEG-1/2 audio stream
6465
}
6566

6667
_subtypes = {
67-
'PCM_S8': 0x0001, # Signed 8 bit data
68-
'PCM_16': 0x0002, # Signed 16 bit data
69-
'PCM_24': 0x0003, # Signed 24 bit data
70-
'PCM_32': 0x0004, # Signed 32 bit data
71-
'PCM_U8': 0x0005, # Unsigned 8 bit data (WAV and RAW only)
72-
'FLOAT': 0x0006, # 32 bit float data
73-
'DOUBLE': 0x0007, # 64 bit float data
74-
'ULAW': 0x0010, # U-Law encoded.
75-
'ALAW': 0x0011, # A-Law encoded.
76-
'IMA_ADPCM': 0x0012, # IMA ADPCM.
77-
'MS_ADPCM': 0x0013, # Microsoft ADPCM.
78-
'GSM610': 0x0020, # GSM 6.10 encoding.
79-
'VOX_ADPCM': 0x0021, # OKI / Dialogix ADPCM
80-
'G721_32': 0x0030, # 32kbs G721 ADPCM encoding.
81-
'G723_24': 0x0031, # 24kbs G723 ADPCM encoding.
82-
'G723_40': 0x0032, # 40kbs G723 ADPCM encoding.
83-
'DWVW_12': 0x0040, # 12 bit Delta Width Variable Word encoding.
84-
'DWVW_16': 0x0041, # 16 bit Delta Width Variable Word encoding.
85-
'DWVW_24': 0x0042, # 24 bit Delta Width Variable Word encoding.
86-
'DWVW_N': 0x0043, # N bit Delta Width Variable Word encoding.
87-
'DPCM_8': 0x0050, # 8 bit differential PCM (XI only)
88-
'DPCM_16': 0x0051, # 16 bit differential PCM (XI only)
89-
'VORBIS': 0x0060, # Xiph Vorbis encoding.
90-
'ALAC_16': 0x0070, # Apple Lossless Audio Codec (16 bit).
91-
'ALAC_20': 0x0071, # Apple Lossless Audio Codec (20 bit).
92-
'ALAC_24': 0x0072, # Apple Lossless Audio Codec (24 bit).
93-
'ALAC_32': 0x0073, # Apple Lossless Audio Codec (32 bit).
68+
'PCM_S8': 0x0001, # Signed 8 bit data
69+
'PCM_16': 0x0002, # Signed 16 bit data
70+
'PCM_24': 0x0003, # Signed 24 bit data
71+
'PCM_32': 0x0004, # Signed 32 bit data
72+
'PCM_U8': 0x0005, # Unsigned 8 bit data (WAV and RAW only)
73+
'FLOAT': 0x0006, # 32 bit float data
74+
'DOUBLE': 0x0007, # 64 bit float data
75+
'ULAW': 0x0010, # U-Law encoded.
76+
'ALAW': 0x0011, # A-Law encoded.
77+
'IMA_ADPCM': 0x0012, # IMA ADPCM.
78+
'MS_ADPCM': 0x0013, # Microsoft ADPCM.
79+
'GSM610': 0x0020, # GSM 6.10 encoding.
80+
'VOX_ADPCM': 0x0021, # OKI / Dialogix ADPCM
81+
'NMS_ADPCM_16': 0x0022, # 16kbs NMS G721-variant encoding.
82+
'NMS_ADPCM_24': 0x0023, # 24kbs NMS G721-variant encoding.
83+
'NMS_ADPCM_32': 0x0024, # 32kbs NMS G721-variant encoding.
84+
'G721_32': 0x0030, # 32kbs G721 ADPCM encoding.
85+
'G723_24': 0x0031, # 24kbs G723 ADPCM encoding.
86+
'G723_40': 0x0032, # 40kbs G723 ADPCM encoding.
87+
'DWVW_12': 0x0040, # 12 bit Delta Width Variable Word encoding.
88+
'DWVW_16': 0x0041, # 16 bit Delta Width Variable Word encoding.
89+
'DWVW_24': 0x0042, # 24 bit Delta Width Variable Word encoding.
90+
'DWVW_N': 0x0043, # N bit Delta Width Variable Word encoding.
91+
'DPCM_8': 0x0050, # 8 bit differential PCM (XI only)
92+
'DPCM_16': 0x0051, # 16 bit differential PCM (XI only)
93+
'VORBIS': 0x0060, # Xiph Vorbis encoding.
94+
'OPUS': 0x0064, # Xiph/Skype Opus encoding.
95+
'ALAC_16': 0x0070, # Apple Lossless Audio Codec (16 bit).
96+
'ALAC_20': 0x0071, # Apple Lossless Audio Codec (20 bit).
97+
'ALAC_24': 0x0072, # Apple Lossless Audio Codec (24 bit).
98+
'ALAC_32': 0x0073, # Apple Lossless Audio Codec (32 bit).
99+
'MPEG_LAYER_I': 0x0080, # MPEG-1 Audio Layer I.
100+
'MPEG_LAYER_II': 0x0081, # MPEG-1 Audio Layer II.
101+
'MPEG_LAYER_III': 0x0082, # MPEG-2 Audio Layer III.
94102
}
95103

96104
_endians = {
@@ -127,6 +135,7 @@
127135
'OGG': 'VORBIS',
128136
'MPC2K': 'PCM_16',
129137
'RF64': 'PCM_16',
138+
'MPEG': 'MPEG_LAYER_III',
130139
}
131140

132141
_ffi_types = {

0 commit comments

Comments
 (0)