-
Notifications
You must be signed in to change notification settings - Fork 48
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
37 changed files
with
182 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
{ | ||
"name": "wavefile", | ||
"version": "10.4.1", | ||
"version": "10.4.2", | ||
"description": "Create, read and write wav files according to the specs.", | ||
"homepage": "https://github.com/rochars/wavefile", | ||
"author": "Rafael da Silva Rocha <[email protected]>", | ||
|
@@ -73,7 +73,7 @@ | |
"test-sr-point": "node ./node_modules/mocha/bin/_mocha test/resampler-full/point.js -R dot --timeout=1600000", | ||
"test-sr-linear": "node ./node_modules/mocha/bin/_mocha test/resampler-full/linear.js -R dot --timeout=1600000", | ||
"test-sr-cubic": "node ./node_modules/mocha/bin/_mocha test/resampler-full/cubic.js -R dot --timeout=1600000", | ||
"test-sr-sinc": "node ./node_modules/mocha/bin/_mocha test/resampler-full/sinc.js test/resampler-full/sinc-IIR.js -R dot --timeout=1600000", | ||
"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", | ||
"test-umd": "node ./node_modules/mocha/bin/_mocha test/resampler test/dist test/src --umd --recursive -R dot --timeout=240000", | ||
"test-tsc": "tsc ./test/TypeScript/index.ts && node -r esm ./test/TypeScript/index.js", | ||
"test-cli": "wavefile ./test/files/M1F1-int12WE-AFsp.wav --tag=ICMT", | ||
|
Binary file modified
BIN
+0 Bytes
(100%)
test/files/out/to-sample-rate/sinc-16-bit-16001kHz-noBext-mono.wav
Binary file not shown.
Binary file modified
BIN
+0 Bytes
(100%)
test/files/out/to-sample-rate/sinc-16bit-16000Hz-mono-chirp-1-22050-linear.wav
Binary file not shown.
Binary file modified
BIN
+0 Bytes
(100%)
test/files/out/to-sample-rate/sinc-16bit-16000Hz-mono-chirp-1-22050-log.wav
Binary file not shown.
Binary file modified
BIN
+0 Bytes
(100%)
test/files/out/to-sample-rate/sinc-16bit-96000Hz-mono-chirp-1-22050-linear.wav
Binary file not shown.
Binary file modified
BIN
+0 Bytes
(100%)
test/files/out/to-sample-rate/sinc-16bit-96000Hz-mono-chirp-1-22050-log.wav
Binary file not shown.
Binary file modified
BIN
+0 Bytes
(100%)
test/files/out/to-sample-rate/sinc-32fp-16000Hz-mono-chirp-1-22050-linear.wav
Binary file not shown.
Binary file modified
BIN
+0 Bytes
(100%)
test/files/out/to-sample-rate/sinc-32fp-16000Hz-mono-chirp-1-22050-log.wav
Binary file not shown.
Binary file modified
BIN
+0 Bytes
(100%)
test/files/out/to-sample-rate/sinc-32fp-96000Hz-mono-chirp-1-22050-linear.wav
Binary file not shown.
Binary file modified
BIN
+0 Bytes
(100%)
test/files/out/to-sample-rate/sinc-32fp-96000Hz-mono-chirp-1-22050-log.wav
Binary file not shown.
Binary file modified
BIN
+0 Bytes
(100%)
test/files/out/to-sample-rate/sinc-IIR-16bit-16000Hz-mono-chirp-1-22050-linear.wav
Binary file not shown.
Binary file modified
BIN
+0 Bytes
(100%)
test/files/out/to-sample-rate/sinc-IIR-16bit-16000Hz-mono-chirp-1-22050-log.wav
Binary file not shown.
Binary file modified
BIN
+0 Bytes
(100%)
test/files/out/to-sample-rate/sinc-IIR-16bit-96000Hz-mono-chirp-1-22050-linear.wav
Binary file not shown.
Binary file modified
BIN
+0 Bytes
(100%)
test/files/out/to-sample-rate/sinc-IIR-16bit-96000Hz-mono-chirp-1-22050-log.wav
Binary file not shown.
Binary file modified
BIN
+0 Bytes
(100%)
test/files/out/to-sample-rate/sinc-IIR-32fp-16000Hz-mono-chirp-1-22050-linear.wav
Binary file not shown.
Binary file modified
BIN
+0 Bytes
(100%)
test/files/out/to-sample-rate/sinc-IIR-32fp-16000Hz-mono-chirp-1-22050-log.wav
Binary file not shown.
Binary file modified
BIN
+0 Bytes
(100%)
test/files/out/to-sample-rate/sinc-IIR-32fp-96000Hz-mono-chirp-1-22050-linear.wav
Binary file not shown.
Binary file modified
BIN
+0 Bytes
(100%)
test/files/out/to-sample-rate/sinc-IIR-32fp-96000Hz-mono-chirp-1-22050-log.wav
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added
BIN
+250 KB
test/files/out/to-sample-rate/sinc-no-LPF-16bit-16000Hz-mono-chirp-1-22050-linear.wav
Binary file not shown.
Binary file added
BIN
+250 KB
test/files/out/to-sample-rate/sinc-no-LPF-16bit-16000Hz-mono-chirp-1-22050-log.wav
Binary file not shown.
Binary file added
BIN
+1.46 MB
test/files/out/to-sample-rate/sinc-no-LPF-16bit-96000Hz-mono-chirp-1-22050-linear.wav
Binary file not shown.
Binary file added
BIN
+1.46 MB
test/files/out/to-sample-rate/sinc-no-LPF-16bit-96000Hz-mono-chirp-1-22050-log.wav
Binary file not shown.
Binary file added
BIN
+500 KB
test/files/out/to-sample-rate/sinc-no-LPF-32fp-16000Hz-mono-chirp-1-22050-linear.wav
Binary file not shown.
Binary file added
BIN
+500 KB
test/files/out/to-sample-rate/sinc-no-LPF-32fp-16000Hz-mono-chirp-1-22050-log.wav
Binary file not shown.
Binary file added
BIN
+2.93 MB
test/files/out/to-sample-rate/sinc-no-LPF-32fp-96000Hz-mono-chirp-1-22050-linear.wav
Binary file not shown.
Binary file added
BIN
+2.93 MB
test/files/out/to-sample-rate/sinc-no-LPF-32fp-96000Hz-mono-chirp-1-22050-log.wav
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,165 @@ | ||
/** | ||
* WaveFile: https://github.com/rochars/wavefile | ||
* Copyright (c) 2017-2018 Rafael da Silva Rocha. MIT License. | ||
* | ||
* Tests for sample rate conversion, sinc method. | ||
* | ||
*/ | ||
|
||
const assert = require('assert'); | ||
const fs = require("fs"); | ||
const WaveFile = require("../../test/loader.js"); | ||
const path = "./test/files/"; | ||
|
||
console.log('sinc, no LPF'); | ||
|
||
let hrstart = process.hrtime(); | ||
|
||
// Chirps, FP | ||
|
||
describe('Downsample a 32-bit 44.1kHz log sine sweep', function() { | ||
// Read a 8kHz wav | ||
let wav = new WaveFile( | ||
fs.readFileSync(path + "32fp-44100Hz-mono-chirp-1-22050-log.wav")); | ||
|
||
// Convert to another sample rate | ||
wav.toSampleRate(16000, {method: 'sinc', LPF: false}); | ||
|
||
// Write the file | ||
fs.writeFileSync( | ||
path + "/out/to-sample-rate/sinc-no-LPF-32fp-16000Hz-mono-chirp-1-22050-log.wav", | ||
wav.toBuffer()); | ||
}); | ||
|
||
describe('Upsample a 32-bit 44.1kHz log sine sweep', function() { | ||
// Read a 8kHz wav | ||
let wav = new WaveFile( | ||
fs.readFileSync(path + "32fp-44100Hz-mono-chirp-1-22050-log.wav")); | ||
|
||
// Convert to another sample rate | ||
wav.toSampleRate(96000, {method: 'sinc', LPF: false}); | ||
|
||
// Write the file | ||
fs.writeFileSync( | ||
path + "/out/to-sample-rate/sinc-no-LPF-32fp-96000Hz-mono-chirp-1-22050-log.wav", | ||
wav.toBuffer()); | ||
}); | ||
|
||
describe('Downsample a 32-bit 44.1kHz linear sine sweep', function() { | ||
// Read a 8kHz wav | ||
let wav = new WaveFile( | ||
fs.readFileSync(path + "32fp-44100Hz-mono-chirp-1-22050-linear.wav")); | ||
|
||
// Convert to another sample rate | ||
wav.toSampleRate(16000, {method: 'sinc', LPF: false}); | ||
|
||
// Write the file | ||
fs.writeFileSync( | ||
path + "/out/to-sample-rate/sinc-no-LPF-32fp-16000Hz-mono-chirp-1-22050-linear.wav", | ||
wav.toBuffer()); | ||
}); | ||
|
||
describe('Upsample a 32-bit 44.1kHz linear sine sweep', function() { | ||
// Read a 8kHz wav | ||
let wav = new WaveFile( | ||
fs.readFileSync(path + "32fp-44100Hz-mono-chirp-1-22050-linear.wav")); | ||
|
||
// Convert to another sample rate | ||
wav.toSampleRate(96000, {method: 'sinc', LPF: false}); | ||
|
||
// Write the file | ||
fs.writeFileSync( | ||
path + "/out/to-sample-rate/sinc-no-LPF-32fp-96000Hz-mono-chirp-1-22050-linear.wav", | ||
wav.toBuffer()); | ||
}); | ||
|
||
// Chirps, int | ||
|
||
describe('Downsample a 16-bit 44.1kHz log sine sweep', function() { | ||
// Read a 8kHz wav | ||
let wav = new WaveFile( | ||
fs.readFileSync(path + "16bit-44100Hz-mono-chirp-1-22050-log.wav")); | ||
|
||
// Convert to another sample rate | ||
wav.toSampleRate(16000, {method: 'sinc', LPF: false}); | ||
|
||
// Write the file | ||
fs.writeFileSync( | ||
path + "/out/to-sample-rate/sinc-no-LPF-16bit-16000Hz-mono-chirp-1-22050-log.wav", | ||
wav.toBuffer()); | ||
}); | ||
|
||
describe('Upsample a 16-bit 44.1kHz log sine sweep', function() { | ||
// Read a 8kHz wav | ||
let wav = new WaveFile( | ||
fs.readFileSync(path + "16bit-44100Hz-mono-chirp-1-22050-log.wav")); | ||
|
||
// Convert to another sample rate | ||
wav.toSampleRate(96000, {method: 'sinc', LPF: false}); | ||
|
||
// Write the file | ||
fs.writeFileSync( | ||
path + "/out/to-sample-rate/sinc-no-LPF-16bit-96000Hz-mono-chirp-1-22050-log.wav", | ||
wav.toBuffer()); | ||
}); | ||
|
||
describe('Downsample a 16-bit 44.1kHz linear sine sweep', function() { | ||
// Read a 8kHz wav | ||
let wav = new WaveFile( | ||
fs.readFileSync(path + "16bit-44100Hz-mono-chirp-1-22050-linear.wav")); | ||
|
||
// Convert to another sample rate | ||
wav.toSampleRate(16000, {method: 'sinc', LPF: false}); | ||
|
||
// Write the file | ||
fs.writeFileSync( | ||
path + "/out/to-sample-rate/sinc-no-LPF-16bit-16000Hz-mono-chirp-1-22050-linear.wav", | ||
wav.toBuffer()); | ||
}); | ||
|
||
describe('Upsample a 16-bit 44.1kHz linear sine sweep', function() { | ||
// Read a 8kHz wav | ||
let wav = new WaveFile( | ||
fs.readFileSync(path + "16bit-44100Hz-mono-chirp-1-22050-linear.wav")); | ||
|
||
// Convert to another sample rate | ||
wav.toSampleRate(96000, {method: 'sinc', LPF: false}); | ||
|
||
// Write the file | ||
fs.writeFileSync( | ||
path + "/out/to-sample-rate/sinc-no-LPF-16bit-96000Hz-mono-chirp-1-22050-linear.wav", | ||
wav.toBuffer()); | ||
}); | ||
|
||
// Songs | ||
|
||
describe('Downsample a 16bit 44.1kHz file', function() { | ||
// Read a 8kHz wav | ||
let wav = new WaveFile( | ||
fs.readFileSync(path + "song1.wav")); | ||
|
||
// Convert to another sample rate | ||
wav.toSampleRate(16000, {method: 'sinc', LPF: false}); | ||
|
||
// Write the file | ||
fs.writeFileSync( | ||
path + "/out/to-sample-rate/sinc-no-LPF-song1-16kHz.wav", | ||
wav.toBuffer()); | ||
}); | ||
|
||
describe('Upsample a 16bit 44.1kHz file', function() { | ||
// Read a 8kHz wav | ||
let wav = new WaveFile( | ||
fs.readFileSync(path + "song1.wav")); | ||
|
||
// Convert to another sample rate | ||
wav.toSampleRate(96000, {method: 'sinc', LPF: false}); | ||
|
||
// Write the file | ||
fs.writeFileSync( | ||
path + "/out/to-sample-rate/sinc-no-LPF-song1-96kHz.wav", | ||
wav.toBuffer()); | ||
}); | ||
|
||
hrend = process.hrtime(hrstart); | ||
console.info('%ds %dms', hrend[0], hrend[1] / 1000000); |