Comparing version 0.0.1 to 0.0.2
16
index.js
@@ -147,9 +147,17 @@ /* -*- Mode: Java; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ | ||
function decode(buffer) { | ||
// typed arrays and Buffer both have an array buffer as .buffer property | ||
if (buffer.buffer) | ||
let pos = 0, end = 0; | ||
if (buffer.buffer) { | ||
// If we are handed a typed array or a buffer, then we have to consider the | ||
// offset and length into the underlying array buffer. | ||
pos = buffer.byteOffset; | ||
end = buffer.length; | ||
buffer = buffer.buffer; | ||
} else { | ||
// If we are handed a straight up array buffer, start at offset 0 and use | ||
// the full length of the buffer. | ||
pos = 0; | ||
end = buffer.byteLength; | ||
} | ||
let end = buffer.byteLength; | ||
let v = new DataView(buffer); | ||
let pos = 0; | ||
@@ -156,0 +164,0 @@ function u8() { |
{ | ||
"name": "node-wav", | ||
"version": "0.0.1", | ||
"version": "0.0.2", | ||
"description": "High performance WAV file decoder and encoder", | ||
"main": "./index.js", | ||
"scripts": { | ||
"test": "./node_modules/nodeunit/bin/nodeunit ./test.js" | ||
"test": "./node_modules/nodeunit/bin/nodeunit ./tests/test.js" | ||
}, | ||
@@ -9,0 +9,0 @@ "repository": { |
15
x.js
@@ -1,11 +0,12 @@ | ||
'use strict'; | ||
let fs = require('fs'); | ||
let wav = require('./index'); | ||
let buffer = fs.readFileSync('file.wav'); | ||
let result = wav.decode(buffer); | ||
console.log(result.sampleRate); | ||
console.log(result.channelData); // array of Float32Arrays | ||
//let files = JSON.parse(fs.readFileSync('x.json')); | ||
wav.encode(result.channelData, { sampleRate: result.sampleRate, float: true, bitDepth: 32 }); | ||
let files = ["../train/data//other/0005932e-db17-4a21-b99f-5e10f84a9e74.wav"]; | ||
files.forEach(file => { | ||
console.log(file); | ||
let buffer = fs.readFileSync(file); | ||
let w = wav.decode(buffer); | ||
}); |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
7529646
1337
2
1