Skip to content

Commit 11b55a8

Browse files
authored
Merge pull request #2 from PRX/fix/mext_soundinfo_math
Fix mext soundinfo math
2 parents a0626f5 + 806bccb commit 11b55a8

File tree

10 files changed

+581
-394
lines changed

10 files changed

+581
-394
lines changed

dist/wavefile.js

Lines changed: 102 additions & 98 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/index.html

Lines changed: 368 additions & 192 deletions
Large diffs are not rendered by default.

docs/lib_wavefile-creator.js.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,7 @@ <h1 class="page-title">lib/wavefile-creator.js</h1>
226226
}
227227
if (
228228
(info.sampleRate == 44100 || info.sampleRate == 22050) &amp;&amp;
229-
info.padding
229+
!info.padding
230230
) {
231231
soundInformation += 4;
232232
}

lib/wavefile-creator.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,7 @@ export class WaveFileCreator extends WaveFileParser {
182182
}
183183
if (
184184
(info.sampleRate == 44100 || info.sampleRate == 22050) &&
185-
info.padding
185+
!info.padding
186186
) {
187187
soundInformation += 4;
188188
}

package-lock.json

Lines changed: 95 additions & 88 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
{
22
"name": "prx-wavefile",
3-
"version": "11.0.0-prx.1",
3+
"version": "11.0.0-prx.3",
44
"description": "Create, read and write wav files according to the specs.",
5-
"homepage": "https://github.com/rochars/wavefile",
5+
"homepage": "https://github.com/PRX/prx-wavefile",
66
"author": "Rafael da Silva Rocha <rocha.rafaelsilva@gmail.com>",
77
"license": "MIT",
88
"main": "./dist/wavefile.js",
@@ -41,10 +41,10 @@
4141
],
4242
"repository": {
4343
"type": "git",
44-
"url": "git://github.com/rochars/wavefile.git"
44+
"url": "git://github.com/PRX/prx-wavefile.git"
4545
},
4646
"bugs": {
47-
"url": "https://github.com/rochars/wavefile/issues"
47+
"url": "https://github.com/PRX/prx-wavefile/issues"
4848
},
4949
"directories": {
5050
"bin": "bin",
@@ -76,15 +76,15 @@
7676
"test-sr-sinc": "node ./node_modules/mocha/bin/_mocha test/resampler-full/sinc.js test/resampler-full/sinc-IIR.js test/resampler-full/sinc-no-lpf.js -R dot --timeout=1600000",
7777
"test-umd": "node ./node_modules/mocha/bin/_mocha test/resampler test/dist test/src --umd --recursive -R dot --timeout=240000",
7878
"test-tsc": "tsc ./test/TypeScript/index.ts && node -r esm ./test/TypeScript/index.js",
79-
"test-cli": "wavefile ./test/files/M1F1-int12WE-AFsp.wav --tag=ICMT && wavefile ./test/files/M1F1-int12WE-AFsp.wav --resample=16000 --method=point ./test/files/out/to-sample-rate/M1F1-int12WE-AFsp-CLI.wav",
79+
"test-cli": "prx-wavefile ./test/files/M1F1-int12WE-AFsp.wav --tag=ICMT && prx-wavefile ./test/files/M1F1-int12WE-AFsp.wav --resample=16000 --method=point ./test/files/out/to-sample-rate/M1F1-int12WE-AFsp-CLI.wav",
8080
"test-dist": "npm run test-umd && npm run test-tsc && npm run test-cli",
8181
"rollup-bundle": "rollup -c && npm run test-dist",
8282
"doc": "./node_modules/.bin/jsdoc -c .jsdocrc -d docs -r README.md -t node_modules/docdash",
8383
"build": "npm run lint && npm test && npm run rollup-bundle && npm run doc",
8484
"coverage": "nyc report --reporter=lcov > coverage.lcov && codecov"
8585
},
8686
"devDependencies": {
87-
"@ampproject/rollup-plugin-closure-compiler": "^0.13.0",
87+
"@ampproject/rollup-plugin-closure-compiler": "^0.27.0",
8888
"@rollup/plugin-commonjs": "^11.0.0",
8989
"@rollup/plugin-node-resolve": "^6.0.0",
9090
"byte-data": "^19.0.1",

test/dist/cart/cart-rw.js

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -145,31 +145,31 @@ describe("Create an bwf mpeg cart file from info and an mp2 file", function() {
145145
);
146146

147147
assert.equal(wav.mext.frameSize, 768);
148-
assert.equal(wav.mext.soundInformation, 12);
148+
assert.equal(wav.mext.soundInformation, 8);
149149
});
150150

151151
describe("Create a bwf mpeg cart file from an mp2 file", function() {
152152
let wav = new WaveFile();
153153

154-
wav.fromMpeg(fs.readFileSync(path + "test.mp2"));
154+
wav.fromMpeg(fs.readFileSync(path + "44100_test.mp2"));
155155
fs.writeFileSync(path + "out/test-mp2.wav", wav.toBuffer());
156156
wav = new WaveFile(fs.readFileSync(path + "out/test-mp2.wav"));
157157

158-
assert.equal(wav.fmt.sampleRate, 48000);
158+
assert.equal(wav.fmt.sampleRate, 44100);
159159
assert.equal(wav.fmt.byteRate, 32000);
160160
assert.equal(wav.fmt.numChannels, 2);
161-
assert.equal(wav.fmt.blockAlign, 768);
161+
assert.equal(wav.fmt.blockAlign, 835);
162162
assert.equal(wav.fmt.numChannels, 2);
163163
assert.equal(wav.fmt.headBitRate, 256000);
164164
assert.equal(wav.fmt.headLayer, 2);
165165

166-
assert.equal(wav.fact.dwSampleLength, 269568);
166+
assert.equal(wav.fact.dwSampleLength, 1323648);
167167

168168
assert.equal(
169169
wav.bext.codingHistory,
170-
"A=MPEG1L2,F=48000,B=256,M=stereo,T=wavefile\r\n\u0000\u0000"
170+
"A=MPEG1L2,F=44100,B=256,M=stereo,T=wavefile\r\n\u0000\u0000"
171171
);
172172

173-
assert.equal(wav.mext.frameSize, 768);
174-
assert.equal(wav.mext.soundInformation, 3);
173+
assert.equal(wav.mext.frameSize, 835);
174+
assert.equal(wav.mext.soundInformation, 7);
175175
});

test/files/44100_test.mp2

937 KB
Binary file not shown.

test/files/out/test-mp2-i.wav

0 Bytes
Binary file not shown.

test/files/out/test-mp2.wav

761 KB
Binary file not shown.

0 commit comments

Comments
 (0)