music-metadata 7.12.3 → 7.12.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE.txt +9 -9
- package/README.md +434 -434
- package/lib/ParserFactory.d.ts +48 -48
- package/lib/ParserFactory.js +252 -252
- package/lib/aiff/AiffParser.d.ts +14 -14
- package/lib/aiff/AiffParser.js +96 -84
- package/lib/aiff/AiffToken.d.ts +22 -22
- package/lib/aiff/AiffToken.js +48 -43
- package/lib/apev2/APEv2Parser.d.ts +30 -30
- package/lib/apev2/APEv2Parser.js +164 -164
- package/lib/apev2/APEv2TagMapper.d.ts +4 -4
- package/lib/apev2/APEv2TagMapper.js +86 -86
- package/lib/apev2/APEv2Token.d.ts +100 -100
- package/lib/apev2/APEv2Token.js +126 -126
- package/lib/asf/AsfObject.d.ts +319 -319
- package/lib/asf/AsfObject.js +381 -381
- package/lib/asf/AsfParser.d.ts +17 -17
- package/lib/asf/AsfParser.js +135 -135
- package/lib/asf/AsfTagMapper.d.ts +7 -7
- package/lib/asf/AsfTagMapper.js +95 -95
- package/lib/asf/AsfUtil.d.ts +13 -13
- package/lib/asf/AsfUtil.js +38 -38
- package/lib/asf/GUID.d.ts +84 -84
- package/lib/asf/GUID.js +121 -121
- package/lib/common/BasicParser.d.ts +17 -17
- package/lib/common/BasicParser.js +18 -18
- package/lib/common/CaseInsensitiveTagMap.d.ts +10 -10
- package/lib/common/CaseInsensitiveTagMap.js +21 -21
- package/lib/common/CombinedTagMapper.d.ts +19 -19
- package/lib/common/CombinedTagMapper.js +51 -51
- package/lib/common/FourCC.d.ts +6 -6
- package/lib/common/FourCC.js +28 -28
- package/lib/common/GenericTagMapper.d.ts +51 -51
- package/lib/common/GenericTagMapper.js +55 -55
- package/lib/common/GenericTagTypes.d.ts +33 -33
- package/lib/common/GenericTagTypes.js +131 -131
- package/lib/common/MetadataCollector.d.ts +76 -76
- package/lib/common/MetadataCollector.js +275 -275
- package/lib/common/RandomFileReader.d.ts +22 -22
- package/lib/common/RandomFileReader.js +34 -34
- package/lib/common/RandomUint8ArrayReader.d.ts +18 -18
- package/lib/common/RandomUint8ArrayReader.js +25 -25
- package/lib/common/Util.d.ts +57 -57
- package/lib/common/Util.js +157 -157
- package/lib/core.d.ts +48 -48
- package/lib/core.js +90 -90
- package/lib/dsdiff/DsdiffParser.d.ts +14 -14
- package/lib/dsdiff/DsdiffParser.js +143 -143
- package/lib/dsdiff/DsdiffToken.d.ts +9 -9
- package/lib/dsdiff/DsdiffToken.js +21 -21
- package/lib/dsf/DsfChunk.d.ts +86 -86
- package/lib/dsf/DsfChunk.js +54 -54
- package/lib/dsf/DsfParser.d.ts +9 -9
- package/lib/dsf/DsfParser.js +56 -56
- package/lib/flac/FlacParser.d.ts +28 -28
- package/lib/flac/FlacParser.js +175 -175
- package/lib/id3v1/ID3v1Parser.d.ts +13 -13
- package/lib/id3v1/ID3v1Parser.js +134 -134
- package/lib/id3v1/ID3v1TagMap.d.ts +4 -4
- package/lib/id3v1/ID3v1TagMap.js +22 -22
- package/lib/id3v2/AbstractID3Parser.d.ts +17 -17
- package/lib/id3v2/AbstractID3Parser.js +60 -60
- package/lib/id3v2/FrameParser.d.ts +31 -31
- package/lib/id3v2/FrameParser.js +329 -329
- package/lib/id3v2/ID3v22TagMapper.d.ts +9 -9
- package/lib/id3v2/ID3v22TagMapper.js +55 -55
- package/lib/id3v2/ID3v24TagMapper.d.ts +14 -14
- package/lib/id3v2/ID3v24TagMapper.js +193 -193
- package/lib/id3v2/ID3v2Parser.d.ts +28 -28
- package/lib/id3v2/ID3v2Parser.js +182 -182
- package/lib/id3v2/ID3v2Token.d.ts +73 -73
- package/lib/id3v2/ID3v2Token.js +106 -106
- package/lib/iff/index.d.ts +33 -33
- package/lib/iff/index.js +19 -19
- package/lib/index.d.ts +45 -45
- package/lib/index.js +74 -74
- package/lib/lyrics3/Lyrics3.d.ts +3 -3
- package/lib/lyrics3/Lyrics3.js +17 -17
- package/lib/matroska/MatroskaDtd.d.ts +8 -8
- package/lib/matroska/MatroskaDtd.js +279 -279
- package/lib/matroska/MatroskaParser.d.ts +37 -37
- package/lib/matroska/MatroskaParser.js +235 -235
- package/lib/matroska/MatroskaTagMapper.d.ts +4 -4
- package/lib/matroska/MatroskaTagMapper.js +35 -35
- package/lib/matroska/types.d.ts +175 -175
- package/lib/matroska/types.js +32 -32
- package/lib/mp4/Atom.d.ts +16 -16
- package/lib/mp4/Atom.js +70 -70
- package/lib/mp4/AtomToken.d.ts +395 -395
- package/lib/mp4/AtomToken.js +406 -406
- package/lib/mp4/MP4Parser.d.ts +30 -30
- package/lib/mp4/MP4Parser.js +511 -511
- package/lib/mp4/MP4TagMapper.d.ts +5 -5
- package/lib/mp4/MP4TagMapper.js +115 -115
- package/lib/mpeg/ExtendedLameHeader.d.ts +27 -27
- package/lib/mpeg/ExtendedLameHeader.js +31 -31
- package/lib/mpeg/MpegParser.d.ts +49 -49
- package/lib/mpeg/MpegParser.js +524 -524
- package/lib/mpeg/ReplayGainDataFormat.d.ts +55 -55
- package/lib/mpeg/ReplayGainDataFormat.js +69 -69
- package/lib/mpeg/XingTag.d.ts +45 -45
- package/lib/mpeg/XingTag.js +69 -69
- package/lib/musepack/index.d.ts +5 -5
- package/lib/musepack/index.js +32 -32
- package/lib/musepack/sv7/BitReader.d.ts +13 -13
- package/lib/musepack/sv7/BitReader.js +54 -54
- package/lib/musepack/sv7/MpcSv7Parser.d.ts +8 -8
- package/lib/musepack/sv7/MpcSv7Parser.js +46 -46
- package/lib/musepack/sv7/StreamVersion7.d.ts +28 -28
- package/lib/musepack/sv7/StreamVersion7.js +41 -41
- package/lib/musepack/sv8/MpcSv8Parser.d.ts +6 -6
- package/lib/musepack/sv8/MpcSv8Parser.js +55 -55
- package/lib/musepack/sv8/StreamVersion8.d.ts +40 -40
- package/lib/musepack/sv8/StreamVersion8.js +80 -80
- package/lib/ogg/Ogg.d.ts +72 -72
- package/lib/ogg/Ogg.js +2 -2
- package/lib/ogg/OggParser.d.ts +23 -23
- package/lib/ogg/OggParser.js +126 -126
- package/lib/ogg/opus/Opus.d.ts +48 -48
- package/lib/ogg/opus/Opus.js +28 -28
- package/lib/ogg/opus/OpusParser.d.ts +25 -25
- package/lib/ogg/opus/OpusParser.js +56 -56
- package/lib/ogg/speex/Speex.d.ts +36 -36
- package/lib/ogg/speex/Speex.js +31 -31
- package/lib/ogg/speex/SpeexParser.d.ts +22 -22
- package/lib/ogg/speex/SpeexParser.js +35 -35
- package/lib/ogg/theora/Theora.d.ts +20 -20
- package/lib/ogg/theora/Theora.js +23 -23
- package/lib/ogg/theora/TheoraParser.d.ts +28 -28
- package/lib/ogg/theora/TheoraParser.js +44 -44
- package/lib/ogg/vorbis/Vorbis.d.ts +69 -69
- package/lib/ogg/vorbis/Vorbis.js +78 -78
- package/lib/ogg/vorbis/VorbisDecoder.d.ts +12 -12
- package/lib/ogg/vorbis/VorbisDecoder.js +32 -32
- package/lib/ogg/vorbis/VorbisParser.d.ts +36 -36
- package/lib/ogg/vorbis/VorbisParser.js +128 -128
- package/lib/ogg/vorbis/VorbisTagMapper.d.ts +7 -7
- package/lib/ogg/vorbis/VorbisTagMapper.js +132 -132
- package/lib/riff/RiffChunk.d.ts +16 -16
- package/lib/riff/RiffChunk.js +32 -32
- package/lib/riff/RiffInfoTagMap.d.ts +10 -10
- package/lib/riff/RiffInfoTagMap.js +37 -37
- package/lib/type.d.ts +592 -592
- package/lib/type.js +5 -5
- package/lib/wav/BwfChunk.d.ts +17 -17
- package/lib/wav/BwfChunk.js +29 -28
- package/lib/wav/WaveChunk.d.ts +64 -64
- package/lib/wav/WaveChunk.js +65 -65
- package/lib/wav/WaveParser.d.ts +24 -24
- package/lib/wav/WaveParser.js +158 -156
- package/lib/wavpack/WavPackParser.d.ts +14 -14
- package/lib/wavpack/WavPackParser.js +99 -99
- package/lib/wavpack/WavPackToken.d.ts +64 -64
- package/lib/wavpack/WavPackToken.js +76 -76
- package/package.json +150 -150
package/lib/type.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.TrackType = void 0;
|
|
4
|
-
var types_1 = require("./matroska/types");
|
|
5
|
-
Object.defineProperty(exports, "TrackType", { enumerable: true, get: function () { return types_1.TrackType; } });
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.TrackType = void 0;
|
|
4
|
+
var types_1 = require("./matroska/types");
|
|
5
|
+
Object.defineProperty(exports, "TrackType", { enumerable: true, get: function () { return types_1.TrackType; } });
|
|
6
6
|
//# sourceMappingURL=type.js.map
|
package/lib/wav/BwfChunk.d.ts
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
import { IGetToken } from 'strtok3/lib/core';
|
|
2
|
-
export interface IBroadcastAudioExtensionChunk {
|
|
3
|
-
description: string;
|
|
4
|
-
originator: string;
|
|
5
|
-
originatorReference: string;
|
|
6
|
-
originationDate: string;
|
|
7
|
-
originationTime: string;
|
|
8
|
-
timeReferenceLow: number;
|
|
9
|
-
timeReferenceHigh: number;
|
|
10
|
-
version: number;
|
|
11
|
-
umid: Uint8Array;
|
|
12
|
-
}
|
|
13
|
-
/**
|
|
14
|
-
* Broadcast Audio Extension Chunk
|
|
15
|
-
* Ref: https://tech.ebu.ch/docs/tech/tech3285.pdf
|
|
16
|
-
*/
|
|
17
|
-
export declare const BroadcastAudioExtensionChunk: IGetToken<IBroadcastAudioExtensionChunk>;
|
|
1
|
+
import { IGetToken } from 'strtok3/lib/core';
|
|
2
|
+
export interface IBroadcastAudioExtensionChunk {
|
|
3
|
+
description: string;
|
|
4
|
+
originator: string;
|
|
5
|
+
originatorReference: string;
|
|
6
|
+
originationDate: string;
|
|
7
|
+
originationTime: string;
|
|
8
|
+
timeReferenceLow: number;
|
|
9
|
+
timeReferenceHigh: number;
|
|
10
|
+
version: number;
|
|
11
|
+
umid: Uint8Array;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Broadcast Audio Extension Chunk
|
|
15
|
+
* Ref: https://tech.ebu.ch/docs/tech/tech3285.pdf
|
|
16
|
+
*/
|
|
17
|
+
export declare const BroadcastAudioExtensionChunk: IGetToken<IBroadcastAudioExtensionChunk>;
|
package/lib/wav/BwfChunk.js
CHANGED
|
@@ -1,28 +1,29 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.BroadcastAudioExtensionChunk = void 0;
|
|
4
|
-
const Token = require("token-types");
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
*
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
}
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.BroadcastAudioExtensionChunk = void 0;
|
|
4
|
+
const Token = require("token-types");
|
|
5
|
+
const Util_1 = require("../common/Util");
|
|
6
|
+
/**
|
|
7
|
+
* Broadcast Audio Extension Chunk
|
|
8
|
+
* Ref: https://tech.ebu.ch/docs/tech/tech3285.pdf
|
|
9
|
+
*/
|
|
10
|
+
exports.BroadcastAudioExtensionChunk = {
|
|
11
|
+
len: 420,
|
|
12
|
+
get: (uint8array, off) => {
|
|
13
|
+
return {
|
|
14
|
+
description: (0, Util_1.stripNulls)(new Token.StringType(256, 'ascii').get(uint8array, off)).trim(),
|
|
15
|
+
originator: (0, Util_1.stripNulls)(new Token.StringType(32, 'ascii').get(uint8array, off + 256)).trim(),
|
|
16
|
+
originatorReference: (0, Util_1.stripNulls)(new Token.StringType(32, 'ascii').get(uint8array, off + 288)).trim(),
|
|
17
|
+
originationDate: (0, Util_1.stripNulls)(new Token.StringType(10, 'ascii').get(uint8array, off + 320)).trim(),
|
|
18
|
+
originationTime: (0, Util_1.stripNulls)(new Token.StringType(8, 'ascii').get(uint8array, off + 330)).trim(),
|
|
19
|
+
timeReferenceLow: Token.UINT32_LE.get(uint8array, off + 338),
|
|
20
|
+
timeReferenceHigh: Token.UINT32_LE.get(uint8array, off + 342),
|
|
21
|
+
version: Token.UINT16_LE.get(uint8array, off + 346),
|
|
22
|
+
umid: new Token.Uint8ArrayType(64).get(uint8array, off + 348),
|
|
23
|
+
loudnessValue: Token.UINT16_LE.get(uint8array, off + 412),
|
|
24
|
+
maxTruePeakLevel: Token.UINT16_LE.get(uint8array, off + 414),
|
|
25
|
+
maxMomentaryLoudness: Token.UINT16_LE.get(uint8array, off + 416),
|
|
26
|
+
maxShortTermLoudness: Token.UINT16_LE.get(uint8array, off + 418)
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
};
|
package/lib/wav/WaveChunk.d.ts
CHANGED
|
@@ -1,64 +1,64 @@
|
|
|
1
|
-
/// <reference types="node" />
|
|
2
|
-
import { IGetToken } from 'strtok3/lib/core';
|
|
3
|
-
import { IChunkHeader } from '../iff';
|
|
4
|
-
/**
|
|
5
|
-
* Ref: https://msdn.microsoft.com/en-us/library/windows/desktop/dd317599(v=vs.85).aspx
|
|
6
|
-
*/
|
|
7
|
-
export declare enum WaveFormat {
|
|
8
|
-
PCM = 1,
|
|
9
|
-
ADPCM = 2,
|
|
10
|
-
IEEE_FLOAT = 3,
|
|
11
|
-
MPEG_ADTS_AAC = 5632,
|
|
12
|
-
MPEG_LOAS = 5634,
|
|
13
|
-
RAW_AAC1 = 255,
|
|
14
|
-
DOLBY_AC3_SPDIF = 146,
|
|
15
|
-
DVM = 8192,
|
|
16
|
-
RAW_SPORT = 576,
|
|
17
|
-
ESST_AC3 = 577,
|
|
18
|
-
DRM = 9,
|
|
19
|
-
DTS2 = 8193,
|
|
20
|
-
MPEG = 80
|
|
21
|
-
}
|
|
22
|
-
/**
|
|
23
|
-
* "fmt" sub-chunk describes the sound data's format
|
|
24
|
-
* Ref: http://soundfile.sapp.org/doc/WaveFormat
|
|
25
|
-
*/
|
|
26
|
-
export interface IWaveFormat {
|
|
27
|
-
/**
|
|
28
|
-
* PCM = 1 (i.e. Linear quantization). Values other than 1 indicate some form of compression.
|
|
29
|
-
*/
|
|
30
|
-
wFormatTag: WaveFormat;
|
|
31
|
-
/**
|
|
32
|
-
* Mono = 1, Stereo = 2, etc.
|
|
33
|
-
*/
|
|
34
|
-
nChannels: number;
|
|
35
|
-
/**
|
|
36
|
-
* 8000, 44100, etc.
|
|
37
|
-
*/
|
|
38
|
-
nSamplesPerSec: number;
|
|
39
|
-
nAvgBytesPerSec: number;
|
|
40
|
-
nBlockAlign: number;
|
|
41
|
-
wBitsPerSample: number;
|
|
42
|
-
}
|
|
43
|
-
/**
|
|
44
|
-
* format chunk; chunk-id is "fmt "
|
|
45
|
-
* http://soundfile.sapp.org/doc/WaveFormat/
|
|
46
|
-
*/
|
|
47
|
-
export declare class Format implements IGetToken<IWaveFormat> {
|
|
48
|
-
len: number;
|
|
49
|
-
constructor(header: IChunkHeader);
|
|
50
|
-
get(buf: Buffer, off: number): IWaveFormat;
|
|
51
|
-
}
|
|
52
|
-
export interface IFactChunk {
|
|
53
|
-
dwSampleLength: number;
|
|
54
|
-
}
|
|
55
|
-
/**
|
|
56
|
-
* Fact chunk; chunk-id is "fact"
|
|
57
|
-
* http://www-mmsp.ece.mcgill.ca/Documents/AudioFormats/WAVE/WAVE.html
|
|
58
|
-
* http://www.recordingblogs.com/wiki/fact-chunk-of-a-wave-file
|
|
59
|
-
*/
|
|
60
|
-
export declare class FactChunk implements IGetToken<IFactChunk> {
|
|
61
|
-
len: number;
|
|
62
|
-
constructor(header: IChunkHeader);
|
|
63
|
-
get(buf: Buffer, off: number): IFactChunk;
|
|
64
|
-
}
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
import { IGetToken } from 'strtok3/lib/core';
|
|
3
|
+
import { IChunkHeader } from '../iff';
|
|
4
|
+
/**
|
|
5
|
+
* Ref: https://msdn.microsoft.com/en-us/library/windows/desktop/dd317599(v=vs.85).aspx
|
|
6
|
+
*/
|
|
7
|
+
export declare enum WaveFormat {
|
|
8
|
+
PCM = 1,
|
|
9
|
+
ADPCM = 2,
|
|
10
|
+
IEEE_FLOAT = 3,
|
|
11
|
+
MPEG_ADTS_AAC = 5632,
|
|
12
|
+
MPEG_LOAS = 5634,
|
|
13
|
+
RAW_AAC1 = 255,
|
|
14
|
+
DOLBY_AC3_SPDIF = 146,
|
|
15
|
+
DVM = 8192,
|
|
16
|
+
RAW_SPORT = 576,
|
|
17
|
+
ESST_AC3 = 577,
|
|
18
|
+
DRM = 9,
|
|
19
|
+
DTS2 = 8193,
|
|
20
|
+
MPEG = 80
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* "fmt" sub-chunk describes the sound data's format
|
|
24
|
+
* Ref: http://soundfile.sapp.org/doc/WaveFormat
|
|
25
|
+
*/
|
|
26
|
+
export interface IWaveFormat {
|
|
27
|
+
/**
|
|
28
|
+
* PCM = 1 (i.e. Linear quantization). Values other than 1 indicate some form of compression.
|
|
29
|
+
*/
|
|
30
|
+
wFormatTag: WaveFormat;
|
|
31
|
+
/**
|
|
32
|
+
* Mono = 1, Stereo = 2, etc.
|
|
33
|
+
*/
|
|
34
|
+
nChannels: number;
|
|
35
|
+
/**
|
|
36
|
+
* 8000, 44100, etc.
|
|
37
|
+
*/
|
|
38
|
+
nSamplesPerSec: number;
|
|
39
|
+
nAvgBytesPerSec: number;
|
|
40
|
+
nBlockAlign: number;
|
|
41
|
+
wBitsPerSample: number;
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* format chunk; chunk-id is "fmt "
|
|
45
|
+
* http://soundfile.sapp.org/doc/WaveFormat/
|
|
46
|
+
*/
|
|
47
|
+
export declare class Format implements IGetToken<IWaveFormat> {
|
|
48
|
+
len: number;
|
|
49
|
+
constructor(header: IChunkHeader);
|
|
50
|
+
get(buf: Buffer, off: number): IWaveFormat;
|
|
51
|
+
}
|
|
52
|
+
export interface IFactChunk {
|
|
53
|
+
dwSampleLength: number;
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Fact chunk; chunk-id is "fact"
|
|
57
|
+
* http://www-mmsp.ece.mcgill.ca/Documents/AudioFormats/WAVE/WAVE.html
|
|
58
|
+
* http://www.recordingblogs.com/wiki/fact-chunk-of-a-wave-file
|
|
59
|
+
*/
|
|
60
|
+
export declare class FactChunk implements IGetToken<IFactChunk> {
|
|
61
|
+
len: number;
|
|
62
|
+
constructor(header: IChunkHeader);
|
|
63
|
+
get(buf: Buffer, off: number): IFactChunk;
|
|
64
|
+
}
|
package/lib/wav/WaveChunk.js
CHANGED
|
@@ -1,65 +1,65 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.FactChunk = exports.Format = exports.WaveFormat = void 0;
|
|
4
|
-
/**
|
|
5
|
-
* Ref: https://msdn.microsoft.com/en-us/library/windows/desktop/dd317599(v=vs.85).aspx
|
|
6
|
-
*/
|
|
7
|
-
var WaveFormat;
|
|
8
|
-
(function (WaveFormat) {
|
|
9
|
-
WaveFormat[WaveFormat["PCM"] = 1] = "PCM";
|
|
10
|
-
// MPEG-4 and AAC Audio Types
|
|
11
|
-
WaveFormat[WaveFormat["ADPCM"] = 2] = "ADPCM";
|
|
12
|
-
WaveFormat[WaveFormat["IEEE_FLOAT"] = 3] = "IEEE_FLOAT";
|
|
13
|
-
WaveFormat[WaveFormat["MPEG_ADTS_AAC"] = 5632] = "MPEG_ADTS_AAC";
|
|
14
|
-
WaveFormat[WaveFormat["MPEG_LOAS"] = 5634] = "MPEG_LOAS";
|
|
15
|
-
WaveFormat[WaveFormat["RAW_AAC1"] = 255] = "RAW_AAC1";
|
|
16
|
-
// Dolby Audio Types
|
|
17
|
-
WaveFormat[WaveFormat["DOLBY_AC3_SPDIF"] = 146] = "DOLBY_AC3_SPDIF";
|
|
18
|
-
WaveFormat[WaveFormat["DVM"] = 8192] = "DVM";
|
|
19
|
-
WaveFormat[WaveFormat["RAW_SPORT"] = 576] = "RAW_SPORT";
|
|
20
|
-
WaveFormat[WaveFormat["ESST_AC3"] = 577] = "ESST_AC3";
|
|
21
|
-
WaveFormat[WaveFormat["DRM"] = 9] = "DRM";
|
|
22
|
-
WaveFormat[WaveFormat["DTS2"] = 8193] = "DTS2";
|
|
23
|
-
WaveFormat[WaveFormat["MPEG"] = 80] = "MPEG";
|
|
24
|
-
})(WaveFormat = exports.WaveFormat || (exports.WaveFormat = {}));
|
|
25
|
-
/**
|
|
26
|
-
* format chunk; chunk-id is "fmt "
|
|
27
|
-
* http://soundfile.sapp.org/doc/WaveFormat/
|
|
28
|
-
*/
|
|
29
|
-
class Format {
|
|
30
|
-
constructor(header) {
|
|
31
|
-
if (header.chunkSize < 16)
|
|
32
|
-
throw new Error('Invalid chunk size');
|
|
33
|
-
this.len = header.chunkSize;
|
|
34
|
-
}
|
|
35
|
-
get(buf, off) {
|
|
36
|
-
return {
|
|
37
|
-
wFormatTag: buf.readUInt16LE(off),
|
|
38
|
-
nChannels: buf.readUInt16LE(off + 2),
|
|
39
|
-
nSamplesPerSec: buf.readUInt32LE(off + 4),
|
|
40
|
-
nAvgBytesPerSec: buf.readUInt32LE(off + 8),
|
|
41
|
-
nBlockAlign: buf.readUInt16LE(off + 12),
|
|
42
|
-
wBitsPerSample: buf.readUInt16LE(off + 14)
|
|
43
|
-
};
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
exports.Format = Format;
|
|
47
|
-
/**
|
|
48
|
-
* Fact chunk; chunk-id is "fact"
|
|
49
|
-
* http://www-mmsp.ece.mcgill.ca/Documents/AudioFormats/WAVE/WAVE.html
|
|
50
|
-
* http://www.recordingblogs.com/wiki/fact-chunk-of-a-wave-file
|
|
51
|
-
*/
|
|
52
|
-
class FactChunk {
|
|
53
|
-
constructor(header) {
|
|
54
|
-
if (header.chunkSize < 4) {
|
|
55
|
-
throw new Error('Invalid fact chunk size.');
|
|
56
|
-
}
|
|
57
|
-
this.len = header.chunkSize;
|
|
58
|
-
}
|
|
59
|
-
get(buf, off) {
|
|
60
|
-
return {
|
|
61
|
-
dwSampleLength: buf.readUInt32LE(off)
|
|
62
|
-
};
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
exports.FactChunk = FactChunk;
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.FactChunk = exports.Format = exports.WaveFormat = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Ref: https://msdn.microsoft.com/en-us/library/windows/desktop/dd317599(v=vs.85).aspx
|
|
6
|
+
*/
|
|
7
|
+
var WaveFormat;
|
|
8
|
+
(function (WaveFormat) {
|
|
9
|
+
WaveFormat[WaveFormat["PCM"] = 1] = "PCM";
|
|
10
|
+
// MPEG-4 and AAC Audio Types
|
|
11
|
+
WaveFormat[WaveFormat["ADPCM"] = 2] = "ADPCM";
|
|
12
|
+
WaveFormat[WaveFormat["IEEE_FLOAT"] = 3] = "IEEE_FLOAT";
|
|
13
|
+
WaveFormat[WaveFormat["MPEG_ADTS_AAC"] = 5632] = "MPEG_ADTS_AAC";
|
|
14
|
+
WaveFormat[WaveFormat["MPEG_LOAS"] = 5634] = "MPEG_LOAS";
|
|
15
|
+
WaveFormat[WaveFormat["RAW_AAC1"] = 255] = "RAW_AAC1";
|
|
16
|
+
// Dolby Audio Types
|
|
17
|
+
WaveFormat[WaveFormat["DOLBY_AC3_SPDIF"] = 146] = "DOLBY_AC3_SPDIF";
|
|
18
|
+
WaveFormat[WaveFormat["DVM"] = 8192] = "DVM";
|
|
19
|
+
WaveFormat[WaveFormat["RAW_SPORT"] = 576] = "RAW_SPORT";
|
|
20
|
+
WaveFormat[WaveFormat["ESST_AC3"] = 577] = "ESST_AC3";
|
|
21
|
+
WaveFormat[WaveFormat["DRM"] = 9] = "DRM";
|
|
22
|
+
WaveFormat[WaveFormat["DTS2"] = 8193] = "DTS2";
|
|
23
|
+
WaveFormat[WaveFormat["MPEG"] = 80] = "MPEG";
|
|
24
|
+
})(WaveFormat = exports.WaveFormat || (exports.WaveFormat = {}));
|
|
25
|
+
/**
|
|
26
|
+
* format chunk; chunk-id is "fmt "
|
|
27
|
+
* http://soundfile.sapp.org/doc/WaveFormat/
|
|
28
|
+
*/
|
|
29
|
+
class Format {
|
|
30
|
+
constructor(header) {
|
|
31
|
+
if (header.chunkSize < 16)
|
|
32
|
+
throw new Error('Invalid chunk size');
|
|
33
|
+
this.len = header.chunkSize;
|
|
34
|
+
}
|
|
35
|
+
get(buf, off) {
|
|
36
|
+
return {
|
|
37
|
+
wFormatTag: buf.readUInt16LE(off),
|
|
38
|
+
nChannels: buf.readUInt16LE(off + 2),
|
|
39
|
+
nSamplesPerSec: buf.readUInt32LE(off + 4),
|
|
40
|
+
nAvgBytesPerSec: buf.readUInt32LE(off + 8),
|
|
41
|
+
nBlockAlign: buf.readUInt16LE(off + 12),
|
|
42
|
+
wBitsPerSample: buf.readUInt16LE(off + 14)
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
exports.Format = Format;
|
|
47
|
+
/**
|
|
48
|
+
* Fact chunk; chunk-id is "fact"
|
|
49
|
+
* http://www-mmsp.ece.mcgill.ca/Documents/AudioFormats/WAVE/WAVE.html
|
|
50
|
+
* http://www.recordingblogs.com/wiki/fact-chunk-of-a-wave-file
|
|
51
|
+
*/
|
|
52
|
+
class FactChunk {
|
|
53
|
+
constructor(header) {
|
|
54
|
+
if (header.chunkSize < 4) {
|
|
55
|
+
throw new Error('Invalid fact chunk size.');
|
|
56
|
+
}
|
|
57
|
+
this.len = header.chunkSize;
|
|
58
|
+
}
|
|
59
|
+
get(buf, off) {
|
|
60
|
+
return {
|
|
61
|
+
dwSampleLength: buf.readUInt32LE(off)
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
exports.FactChunk = FactChunk;
|
package/lib/wav/WaveParser.d.ts
CHANGED
|
@@ -1,24 +1,24 @@
|
|
|
1
|
-
import * as riff from '../riff/RiffChunk';
|
|
2
|
-
import { BasicParser } from '../common/BasicParser';
|
|
3
|
-
/**
|
|
4
|
-
* Resource Interchange File Format (RIFF) Parser
|
|
5
|
-
*
|
|
6
|
-
* WAVE PCM soundfile format
|
|
7
|
-
*
|
|
8
|
-
* Ref:
|
|
9
|
-
* - http://www.johnloomis.org/cpe102/asgn/asgn1/riff.html
|
|
10
|
-
* - http://soundfile.sapp.org/doc/WaveFormat
|
|
11
|
-
*
|
|
12
|
-
* ToDo: Split WAVE part from RIFF parser
|
|
13
|
-
*/
|
|
14
|
-
export declare class WaveParser extends BasicParser {
|
|
15
|
-
private fact;
|
|
16
|
-
private blockAlign;
|
|
17
|
-
private header;
|
|
18
|
-
parse(): Promise<void>;
|
|
19
|
-
parseRiffChunk(chunkSize: number): Promise<void>;
|
|
20
|
-
readWaveChunk(remaining: number): Promise<void>;
|
|
21
|
-
parseListTag(listHeader: riff.IChunkHeader): Promise<void>;
|
|
22
|
-
private parseRiffInfoTags;
|
|
23
|
-
private addTag;
|
|
24
|
-
}
|
|
1
|
+
import * as riff from '../riff/RiffChunk';
|
|
2
|
+
import { BasicParser } from '../common/BasicParser';
|
|
3
|
+
/**
|
|
4
|
+
* Resource Interchange File Format (RIFF) Parser
|
|
5
|
+
*
|
|
6
|
+
* WAVE PCM soundfile format
|
|
7
|
+
*
|
|
8
|
+
* Ref:
|
|
9
|
+
* - http://www.johnloomis.org/cpe102/asgn/asgn1/riff.html
|
|
10
|
+
* - http://soundfile.sapp.org/doc/WaveFormat
|
|
11
|
+
*
|
|
12
|
+
* ToDo: Split WAVE part from RIFF parser
|
|
13
|
+
*/
|
|
14
|
+
export declare class WaveParser extends BasicParser {
|
|
15
|
+
private fact;
|
|
16
|
+
private blockAlign;
|
|
17
|
+
private header;
|
|
18
|
+
parse(): Promise<void>;
|
|
19
|
+
parseRiffChunk(chunkSize: number): Promise<void>;
|
|
20
|
+
readWaveChunk(remaining: number): Promise<void>;
|
|
21
|
+
parseListTag(listHeader: riff.IChunkHeader): Promise<void>;
|
|
22
|
+
private parseRiffInfoTags;
|
|
23
|
+
private addTag;
|
|
24
|
+
}
|