music-metadata 7.12.5 → 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/lib/aiff/AiffParser.js +13 -1
- package/lib/aiff/AiffToken.js +9 -4
- package/package.json +7 -9
package/lib/aiff/AiffParser.js
CHANGED
|
@@ -10,6 +10,17 @@ const BasicParser_1 = require("../common/BasicParser");
|
|
|
10
10
|
const AiffToken = require("./AiffToken");
|
|
11
11
|
const iff = require("../iff");
|
|
12
12
|
const debug = (0, debug_1.default)('music-metadata:parser:aiff');
|
|
13
|
+
const compressionTypes = {
|
|
14
|
+
NONE: 'not compressed PCM Apple Computer',
|
|
15
|
+
sowt: 'PCM (byte swapped)',
|
|
16
|
+
fl32: '32-bit floating point IEEE 32-bit float',
|
|
17
|
+
fl64: '64-bit floating point IEEE 64-bit float Apple Computer',
|
|
18
|
+
alaw: 'ALaw 2:1 8-bit ITU-T G.711 A-law',
|
|
19
|
+
ulaw: 'µLaw 2:1 8-bit ITU-T G.711 µ-law Apple Computer',
|
|
20
|
+
ULAW: 'CCITT G.711 u-law 8-bit ITU-T G.711 µ-law',
|
|
21
|
+
ALAW: 'CCITT G.711 A-law 8-bit ITU-T G.711 A-law',
|
|
22
|
+
FL32: 'Float 32 IEEE 32-bit float '
|
|
23
|
+
};
|
|
13
24
|
/**
|
|
14
25
|
* AIFF - Audio Interchange File Format
|
|
15
26
|
*
|
|
@@ -56,6 +67,7 @@ class AIFFParser extends BasicParser_1.BasicParser {
|
|
|
56
67
|
}
|
|
57
68
|
}
|
|
58
69
|
async readData(header) {
|
|
70
|
+
var _a;
|
|
59
71
|
switch (header.chunkID) {
|
|
60
72
|
case 'COMM': // The Common Chunk
|
|
61
73
|
const common = await this.tokenizer.readToken(new AiffToken.Common(header, this.isCompressed));
|
|
@@ -64,7 +76,7 @@ class AIFFParser extends BasicParser_1.BasicParser {
|
|
|
64
76
|
this.metadata.setFormat('numberOfChannels', common.numChannels);
|
|
65
77
|
this.metadata.setFormat('numberOfSamples', common.numSampleFrames);
|
|
66
78
|
this.metadata.setFormat('duration', common.numSampleFrames / common.sampleRate);
|
|
67
|
-
this.metadata.setFormat('codec', common.compressionName);
|
|
79
|
+
this.metadata.setFormat('codec', (_a = common.compressionName) !== null && _a !== void 0 ? _a : compressionTypes[common.compressionType]);
|
|
68
80
|
return header.chunkSize;
|
|
69
81
|
case 'ID3 ': // ID3-meta-data
|
|
70
82
|
const id3_data = await this.tokenizer.readToken(new Token.Uint8ArrayType(header.chunkSize));
|
package/lib/aiff/AiffToken.js
CHANGED
|
@@ -25,12 +25,17 @@ class Common {
|
|
|
25
25
|
res.compressionType = FourCC_1.FourCcToken.get(buf, off + 18);
|
|
26
26
|
if (this.len > 22) {
|
|
27
27
|
const strLen = buf.readInt8(off + 22);
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
28
|
+
if (strLen > 0) {
|
|
29
|
+
const padding = (strLen + 1) % 2;
|
|
30
|
+
if (23 + strLen + padding === this.len) {
|
|
31
|
+
res.compressionName = new Token.StringType(strLen, 'binary').get(buf, off + 23);
|
|
32
|
+
}
|
|
33
|
+
else {
|
|
34
|
+
throw new Error('Illegal pstring length');
|
|
35
|
+
}
|
|
31
36
|
}
|
|
32
37
|
else {
|
|
33
|
-
|
|
38
|
+
res.compressionName = undefined;
|
|
34
39
|
}
|
|
35
40
|
}
|
|
36
41
|
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "music-metadata",
|
|
3
3
|
"description": "Music metadata parser for Node.js, supporting virtual any audio and tag format.",
|
|
4
|
-
"version": "7.12.
|
|
4
|
+
"version": "7.12.6",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "Borewit",
|
|
7
7
|
"url": "https://github.com/Borewit"
|
|
@@ -79,7 +79,6 @@
|
|
|
79
79
|
"build": "npm run clean && npm run compile && npm run doc-gen",
|
|
80
80
|
"start": "npm-run-all compile lint cover-test",
|
|
81
81
|
"test-coverage": "nyc npm run test",
|
|
82
|
-
"send-coveralls": "nyc report --reporter=text-lcov | coveralls",
|
|
83
82
|
"send-codacy": "nyc report --reporter=text-lcov | codacy-coverage",
|
|
84
83
|
"doc-gen": "node doc-gen/gen.js"
|
|
85
84
|
},
|
|
@@ -98,18 +97,17 @@
|
|
|
98
97
|
"@types/debug": "^4.1.7",
|
|
99
98
|
"@types/file-type": "^10.9.1",
|
|
100
99
|
"@types/mocha": "^9.1.0",
|
|
101
|
-
"@types/node": "^18.
|
|
102
|
-
"@typescript-eslint/eslint-plugin": "^5.
|
|
103
|
-
"@typescript-eslint/parser": "^5.
|
|
100
|
+
"@types/node": "^18.6.3",
|
|
101
|
+
"@typescript-eslint/eslint-plugin": "^5.32.0",
|
|
102
|
+
"@typescript-eslint/parser": "^5.32.0",
|
|
104
103
|
"chai": "^4.3.6",
|
|
105
104
|
"chai-as-promised": "^7.1.1",
|
|
106
|
-
"coveralls": "^3.1.1",
|
|
107
105
|
"del-cli": "5.0.0",
|
|
108
|
-
"eslint": "^8.
|
|
106
|
+
"eslint": "^8.21.0",
|
|
109
107
|
"eslint-config-prettier": "^8.5.0",
|
|
110
|
-
"eslint-import-resolver-typescript": "^3.
|
|
108
|
+
"eslint-import-resolver-typescript": "^3.4.0",
|
|
111
109
|
"eslint-plugin-import": "^2.26.0",
|
|
112
|
-
"eslint-plugin-jsdoc": "^39.3.
|
|
110
|
+
"eslint-plugin-jsdoc": "^39.3.4",
|
|
113
111
|
"eslint-plugin-node": "^11.1.0",
|
|
114
112
|
"eslint-plugin-unicorn": "^43.0.2",
|
|
115
113
|
"mime": "^3.0.0",
|