wavefile
+prx-wavefile
Copyright (c) 2017-2019 Rafael da Silva Rocha.
https://github.com/rochars/wavefile
MOVING AWAY FROM GITHUB (2020-03-08)
-Microsoft, owner of GitHub, was one of the main backers of the current fascist regime in Brazil and also of the coup d'etat that led to the present situation of my country.
-It paid well: The brazilian government was required to run all its systems on open-source software. After the coup d'etat this changed, the goverment began purchasing Microsoft licenses and migrating all their systems to Windows.
-It is not just a case of business malpractice - there is a genocide going on in Brazil and many people, including myself, have lived under constant death threats for the past couple years bacause of our positions against the current fascist regime. Many have been murdered or incarcerated. Poverty and violence skyrocketed.
-This software will keep being released in NPM as always - only the repository will be moved. Projects depending on this software will not be affected.
-For Microsoft owners and collaborators: you have a lot of blood in your hands. I will not share my work with people of your kind.
--
wavefile
+prx-wavefile
Create, read and write wav files according to the specs.
- MIT licensed @@ -79,7 +72,13 @@
- Handle files up to 2GB
- Zero dependencies
wavefile
With wavefile you can:
+prx-wavefile
is a fork of the excellent wavefile project created by @rochars.
This fork also supports these additional features:
+-
+
- Broadcast Wave Format for MPEG audio described in EBU Tech 3285-s1 - Specification of the Broadcast Wave Format (BWF) - Supplement 1, MPEG Audio - first edition (1997). +
- CartChunk metadata for broadcast automation described in AES46-2002 (s2008): AES standard for network and file transfer of audio Audio-file transfer and exchange Radio traffic audio delivery extension to the broadcast-WAVE-file forma +
With prx-wavefile you can:
- Create wav files
- Read wav files @@ -91,6 +90,8 @@
- Encode/decode files as ADPCM, A-Law and μ-Law
- Turn RIFF files to RIFX and RIFX to RIFF
- Create or edit BWF metadata ("bext" chunk) +
- Create wav files from MPEG audio +
- Create or edit Cart Chunk metadata ("cart" chunk)
wavefile
And more.
Install
@@ -101,15 +102,15 @@Install
Use
Node
-const wavefile = require('wavefile');
+const wavefile = require("prx-wavefile");
let wav = new wavefile.WaveFile();
or
-const WaveFile = require('wavefile').WaveFile;
+const WaveFile = require("prx-wavefile").WaveFile;
let wav = new WaveFile();
or
-import { WaveFile } from 'wavefile';
+import { WaveFile } from "prx-wavefile";
let wav = new WaveFile();
Browser
@@ -119,11 +120,11 @@ Browser
var wav = new wavefile.WaveFile();
</script>
-Or load it from the jsDelivr CDN:
-<script src="https://cdn.jsdelivr.net/npm/wavefile"></script>
+Or load it from the jsDelivr CDN:
+<script src="https://cdn.jsdelivr.net/npm/prx-wavefile"></script>
-Or load it from unpkg:
-<script src="https://unpkg.com/wavefile"></script>
+Or load it from unpkg:
+<script src="https://unpkg.com/prx-wavefile"></script>
Browser compatibility
IE10+. Should work in all modern browsers.
@@ -134,7 +135,7 @@ Command line use
wavefile --help
Node.js Example
-const WaveFile = require('wavefile').WaveFile;
+const WaveFile = require("prx-wavefile").WaveFile;
// Load a wav file buffer as a WaveFile object
let wav = new WaveFile(buffer);
@@ -169,6 +170,8 @@ Table of Contents
Change the bit depth
Change the sample rate
Add BWF metadata
+Create BWF from MPEG
+Cart Chunk
RF64
XML Chunks
The samples
@@ -198,16 +201,16 @@ Mono:
let wav = new WaveFile();
// Create a mono wave file, 44.1 kHz, 32-bit and 4 samples
-wav.fromScratch(1, 44100, '32', [0, -2147483, 2147483, 4]);
+wav.fromScratch(1, 44100, "32", [0, -2147483, 2147483, 4]);
fs.writeFileSync(path, wav.toBuffer());
Stereo:
Samples can be informed interleaved or de-interleaved. If they are de-interleaved, WaveFile will interleave them. In this example they are de-interleaved.
// Stereo, 48 kHz, 8-bit, de-interleaved samples
// WaveFile interleave the samples automatically
-wav.fromScratch(2, 48000, '8', [
- [0, 2, 4, 3],
- [0, 1, 4, 3]
+wav.fromScratch(2, 48000, "8", [
+ [0, 2, 4, 3],
+ [0, 1, 4, 3]
]);
fs.writeFileSync(path, wav.toBuffer());
@@ -225,7 +228,7 @@ Stereo:
A word on bit depth
Resolutions other than 4-bit, 8-bit, 16-bit, 24-bit, 32-bit (integer), 32-bit (fp) and 64-bit (fp) are implemented as WAVE_FORMAT_EXTENSIBLE and may not be supported by some players.
Read wave files
-const WaveFile = require('wavefile').WaveFile;
+const WaveFile = require("prx-wavefile").WaveFile;
wav = new WaveFile();
// Read a wav file from a buffer
wav.fromBuffer(buffer);
@@ -249,11 +252,11 @@ Add RIFF tags to files
Add cue points to files
You can create cue points using the WaveFile.setCuePoint() method. The method takes a object with the cue point data and creates a cue point in the corresponding position of the file. The only required attribute of the object is position, a number representing the position of the point in milliseconds:
// to create a cue point
-wav.setCuePoint({position: 1500});
+wav.setCuePoint({ position: 1500 });
You can also create cue points with labels by defining a label attribute:
// to create a cue point with a label
-wav.setCuePoint({position: 1500, label: 'some label'});
+wav.setCuePoint({ position: 1500, label: "some label" });
To delete a cue point use WaveFile.deleteCuePoint() informing the index of the point. Points are ordered according to their position. The first point is indexed as 1.
wav.deleteCuePoint(1);
@@ -266,11 +269,11 @@ Add cue points to files
[
{
position: 500, // the position in milliseconds
- label: 'cue marker 1',
+ label: "cue marker 1",
end: 1500, // the end position in milliseconds
dwName: 1,
dwPosition: 0,
- fccChunk: 'data',
+ fccChunk: "data",
dwChunkStart: 0,
dwBlockStart: 0,
dwSampleOffset: 22050, // the position as a sample offset
@@ -279,8 +282,8 @@ Add cue points to files
dwCountry: 0,
dwLanguage: 0,
dwDialect: 0,
- dwCodePage: 0,
- },
+ dwCodePage: 0
+ }
//...
];
@@ -288,7 +291,7 @@ Create regions in files
You can create regions using the WaveFile.setCuePoint() method. Regions are cue points with extra data.
If you define a not null end attribute in the object describing the cue point, the point will be created as a region. The end attribute should be the end of the region, in milliseconds, counting from the start of the file, and always greater than the position of the point:
// to create a region with a label:
-wav.setCuePoint({position: 1500, end: 2500, label: 'some label'});
+wav.setCuePoint({ position: 1500, end: 2500, label: "some label" });
You can also define the following optional properties when creating a region:
@@ -299,8 +302,8 @@ Create regions in files
- dwCodePage
RIFX
-wavefile can handle existing RIFX files and create RIFX files from scratch. Files created from scratch will default to RIFF; to create a file as RIFX you must define the container:
-wav.fromScratch(1, 48000, '16', [0, 1, -3278, 327], {"container": "RIFX"});
+WaveFile can handle existing RIFX files and create RIFX files from scratch. Files created from scratch will default to RIFF; to create a file as RIFX you must define the container:
+wav.fromScratch(1, 48000, "16", [0, 1, -3278, 327], { container: "RIFX" });
RIFX to RIFF and RIFF to RIFX:
// Turn a RIFF file to a RIFX file
@@ -314,7 +317,7 @@ IMA-ADPCM
// Encode a 16-bit wave file as 4-bit IMA-ADPCM:
wav.toIMAADPCM();
-IMA-ADPCM files compressed with wavefile will have a block align of 256 bytes.
+IMA-ADPCM files compressed with WaveFile will have a block align of 256 bytes.
If the audio is not 16-bit it will be converted to 16-bit before compressing. Compressing audio with sample rate different from 8000 Hz or more than one channel is not supported and will throw errors.
To decode 4-bit IMA-ADPCM as 16-bit linear PCM:
// Decode 4-bit IMA-ADPCM as 16-bit:
@@ -379,7 +382,7 @@ Change the sample rate
To use another method:
// Change the sample rate to 44.1kHz using sinc
-wav.toSampleRate(44100, {method: "sinc"});
+wav.toSampleRate(44100, { method: "sinc" });
Resampling methods
@@ -390,17 +393,17 @@ Resampling methods
You can turn the LPF on and off for any resampling method:
// Will use 'sinc' method with no LPF
-wav.toSampleRate(44100, {method: "sinc", LPF: false});
+wav.toSampleRate(44100, { method: "sinc", LPF: false });
// Will use 'linear' method with LPF
-wav.toSampleRate(44100, {method: "linear", LPF: true});
+wav.toSampleRate(44100, { method: "linear", LPF: true });
The default LPF is a IIR LPF. You may define what type of LPF will be used by changing the LPFType attribute on the toSampleRate() param. You can use IIR or FIR:
// Will use 'linear' method with a FIR LPF
-wav.toSampleRate(44100, {method: "linear", LPF: true, LPFType: 'FIR'});
+wav.toSampleRate(44100, { method: "linear", LPF: true, LPFType: "FIR" });
// Will use 'linear' method with a IIR LPF, the default
-wav.toSampleRate(44100, {method: "linear", LPF: true});
+wav.toSampleRate(44100, { method: "linear", LPF: true });
Changing the sample rate of ADPCM, mu-Law or A-Law
You need to convert compressed files to standard PCM before resampling:
@@ -408,7 +411,7 @@ Changing the sample rate of ADPCM, mu-Law or A-Law
// convert the file to PCM
wav.fromMuLaw();
// resample
-wav.toSampleRate(44100, {method: "sinc"});
+wav.toSampleRate(44100, { method: "sinc" });
// back to mu-Law
wav.toMuLaw();
@@ -423,11 +426,55 @@ Add BWF metadata
// Write the new BWF file
fs.writeFileSync("32bit-file-with-bext.wav", wav.toBuffer());
-By default wavefile will not insert a "bext" chunk in new files or in files that do not already have a "bext" chunk unless a property of WaveFile.bext is changed from it's default value. See below the full list of properties in WaveFile.bext.
+By default WaveFile will not insert a "bext" chunk in new files or in files that do not already have a "bext" chunk unless a property of WaveFile.bext is changed from it's default value. See below the full list of properties in WaveFile.bext.
+Create From MPEG
+Make a wav file from an mpeg audio file, with optional metadata, using WaveFile.fromMpeg().
+There is now an MPEG reader in prx-wavefile
that is used to
+read metadata from the MPEG and automatically set that in "fact", "fmt", "bext", and "mext" chunks.
+The MPEG specific "mext" chunk is specified below in WaveFile.mext.
+The optional info is specified below in WaveFile.mpegInfo.
+// You can create a wav from just an MPEG audio buffer/stream.
+let wav = new WaveFile();
+wav.fromMpeg(fs.readFileSync("test.mp2"));
+
+// You can also pass in the mpeg metadata info if you prefer
+// This is specified by WaveFile.mpegInfo
+let info = {
+ version: 1,
+ layer: 2,
+ sampleRate: 44100,
+ bitRate: 128,
+ channelMode: "stereo",
+ padding: 1,
+ modeExtension: 0,
+ emphasis: 0,
+ privateBit: 1,
+ copyright: true,
+ original: true,
+ errorProtection: true,
+ numChannels: 2,
+ frameSize: 768,
+ sampleLength: 269568,
+ freeForm: true
+};
+let wav2 = new WaveFile();
+wav2.fromMpeg(fs.readFileSync("test.mp2"), info);
+
+Add Cart Chunk
+By default WaveFile will not insert a "cart" chunk in new files or in files that do not already have a "cart" chunk unless a property of WaveFile.cart is changed from it's default value. See below the full list of properties in WaveFile.cart.
+let wav = new WaveFile();
+wav.fromMpeg(fs.readFileSync("test.mp2"));
+
+// Use the wav.cart to set the values
+wav.cart.chunkId = "cart";
+wav.cart.cutId = "30000";
+wav.cart.title = "Title";
+wav.cart.artist = "Artist";
+
RF64
-wavefile have limited support of RF64 files. It possible to read (at least some) RF64 files, but changing the bit depth or applying compression to the samples will result in a RIFF file.
+WaveFile have limited support of RF64 files. It possible to read (at least some) RF64 files, but changing the bit depth or applying compression to the samples will result in a RIFF file.
XML Chunks
-wavefile support reading and writing iXML and _PMX chunks.
+Wavefile support reading and writing iXML and _PMX chunks.
To get the value of iXML or _PMX chunks:
/** @type {string} */
let iXMLValue = wav.getiXML();
@@ -567,6 +614,14 @@ The WaveFile methods
*/
WaveFile.fromScratch(numChannels, sampleRate, bitDepth, samples, options) {}
+/**
+ * Set up the WaveFileCreator object from an mpeg buffer and metadata info.
+ * @param {!Uint8Array} mpegBuffer The buffer.
+ * @param {Object=} info Mpeg info such as version, layer, bitRate, etc.
+ * @throws {Error} If any argument does not meet the criteria.
+ */
+WaveFile.fromMpeg(mpegBuffer, info=null) {};
+
/**
* Set up the WaveFileParser object from a byte buffer.
* @param {!Uint8Array} wavBuffer The buffer.
@@ -730,7 +785,7 @@ The WaveFile methods
* pointData.dwLanguage
* pointData.dwDialect
* pointData.dwCodePage
- *
+ *
* # This is what a complete pointData object look like:
* {
* position: number,
@@ -842,11 +897,11 @@ WaveFile.listCuePoints()
[
{
position: 500, // the position in milliseconds
- label: 'cue marker 1',
+ label: "cue marker 1",
end: 1500, // the end position in milliseconds
dwName: 1,
dwPosition: 0,
- fccChunk: 'data',
+ fccChunk: "data",
dwChunkStart: 0,
dwBlockStart: 0,
dwSampleOffset: 22050, // the position as a sample offset
@@ -856,9 +911,9 @@ WaveFile.listCuePoints()
dwLanguage: 0,
dwDialect: 0,
dwCodePage: 0
- },
+ }
// ...
-]
+];
The list order reflects the order of the points in the file.
The WaveFile properties
@@ -867,7 +922,7 @@ The WaveFile properties
* "RIFF", "RIFX" and "RF64" are supported.
* @type {string}
*/
-WaveFile.container = '';
+WaveFile.container = "";
/**
* @type {number}
*/
@@ -877,138 +932,246 @@ The WaveFile properties
* Always 'WAVE'.
* @type {string}
*/
-WaveFile.format = '';
+WaveFile.format = "";
/**
* The data of the "fmt" chunk.
* @type {!Object<string, *>}
*/
WaveFile.fmt = {
- /** @type {string} */
- chunkId: '',
- /** @type {number} */
- chunkSize: 0,
- /** @type {number} */
- audioFormat: 0,
- /** @type {number} */
- numChannels: 0,
- /** @type {number} */
- sampleRate: 0,
- /** @type {number} */
- byteRate: 0,
- /** @type {number} */
- blockAlign: 0,
- /** @type {number} */
- bitsPerSample: 0,
- /** @type {number} */
- cbSize: 0,
- /** @type {number} */
- validBitsPerSample: 0,
- /** @type {number} */
- dwChannelMask: 0,
- /**
- * 4 32-bit values representing a 128-bit ID
- * @type {!Array<number>}
- */
- subformat: []
+ /** @type {string} */
+ chunkId: "",
+ /** @type {number} */
+ chunkSize: 0,
+ /** @type {number} */
+ audioFormat: 0,
+ /** @type {number} */
+ numChannels: 0,
+ /** @type {number} */
+ sampleRate: 0,
+ /** @type {number} */
+ byteRate: 0,
+ /** @type {number} */
+ blockAlign: 0,
+ /** @type {number} */
+ bitsPerSample: 0,
+ /** @type {number} */
+ cbSize: 0,
+ /** @type {number} */
+ validBitsPerSample: 0,
+ /** @type {number} */
+ dwChannelMask: 0,
+ /**
+ * 4 32-bit values representing a 128-bit ID
+ * @type {!Array<number>}
+ */
+ subformat: []
};
/**
* The data of the "fact" chunk.
* @type {!Object<string, *>}
*/
WaveFile.fact = {
- /** @type {string} */
- chunkId: '',
- /** @type {number} */
- chunkSize: 0,
- /** @type {number} */
- dwSampleLength: 0
+ /** @type {string} */
+ chunkId: "",
+ /** @type {number} */
+ chunkSize: 0,
+ /** @type {number} */
+ dwSampleLength: 0
};
/**
* The data of the "cue " chunk.
* @type {!Object<string, *>}
*/
WaveFile.cue = {
- /** @type {string} */
- chunkId: '',
- /** @type {number} */
- chunkSize: 0,
- /** @type {number} */
- dwCuePoints: 0,
- /** @type {!Array<!Object>} */
- points: [],
+ /** @type {string} */
+ chunkId: "",
+ /** @type {number} */
+ chunkSize: 0,
+ /** @type {number} */
+ dwCuePoints: 0,
+ /** @type {!Array<!Object>} */
+ points: []
};
/**
* The data of the "smpl" chunk.
* @type {!Object<string, *>}
*/
WaveFile.smpl = {
- /** @type {string} */
- chunkId: '',
- /** @type {number} */
- chunkSize: 0,
- /** @type {number} */
- dwManufacturer: 0,
- /** @type {number} */
- dwProduct: 0,
- /** @type {number} */
- dwSamplePeriod: 0,
- /** @type {number} */
- dwMIDIUnityNote: 0,
- /** @type {number} */
- dwMIDIPitchFraction: 0,
- /** @type {number} */
- dwSMPTEFormat: 0,
- /** @type {number} */
- dwSMPTEOffset: 0,
- /** @type {number} */
- dwNumSampleLoops: 0,
- /** @type {number} */
- dwSamplerData: 0,
- /** @type {!Array<!Object>} */
- loops: [],
+ /** @type {string} */
+ chunkId: "",
+ /** @type {number} */
+ chunkSize: 0,
+ /** @type {number} */
+ dwManufacturer: 0,
+ /** @type {number} */
+ dwProduct: 0,
+ /** @type {number} */
+ dwSamplePeriod: 0,
+ /** @type {number} */
+ dwMIDIUnityNote: 0,
+ /** @type {number} */
+ dwMIDIPitchFraction: 0,
+ /** @type {number} */
+ dwSMPTEFormat: 0,
+ /** @type {number} */
+ dwSMPTEOffset: 0,
+ /** @type {number} */
+ dwNumSampleLoops: 0,
+ /** @type {number} */
+ dwSamplerData: 0,
+ /** @type {!Array<!Object>} */
+ loops: []
};
/**
* The data of the "bext" chunk.
* @type {!Object<string, *>}
*/
WaveFile.bext = {
- /** @type {string} */
- chunkId: '',
- /** @type {number} */
- chunkSize: 0,
- /** @type {string} */
- description: '', //256
- /** @type {string} */
- originator: '', //32
- /** @type {string} */
- originatorReference: '', //32
- /** @type {string} */
- originationDate: '', //10
- /** @type {string} */
- originationTime: '', //8
- /**
- * 2 32-bit values, timeReference high and low
- * @type {!Array<number>}
- */
- timeReference: [0, 0],
- /** @type {number} */
- version: 0, //WORD
- /** @type {string} */
- UMID: '', // 64 chars
- /** @type {number} */
- loudnessValue: 0, //WORD
- /** @type {number} */
- loudnessRange: 0, //WORD
- /** @type {number} */
- maxTruePeakLevel: 0, //WORD
- /** @type {number} */
- maxMomentaryLoudness: 0, //WORD
- /** @type {number} */
- maxShortTermLoudness: 0, //WORD
- /** @type {string} */
- reserved: '', //180
- /** @type {string} */
- codingHistory: '' // string, unlimited
+ /** @type {string} */
+ chunkId: "",
+ /** @type {number} */
+ chunkSize: 0,
+ /** @type {string} */
+ description: "", //256
+ /** @type {string} */
+ originator: "", //32
+ /** @type {string} */
+ originatorReference: "", //32
+ /** @type {string} */
+ originationDate: "", //10
+ /** @type {string} */
+ originationTime: "", //8
+ /**
+ * 2 32-bit values, timeReference high and low
+ * @type {!Array<number>}
+ */
+ timeReference: [0, 0],
+ /** @type {number} */
+ version: 0, //WORD
+ /** @type {string} */
+ UMID: "", // 64 chars
+ /** @type {number} */
+ loudnessValue: 0, //WORD
+ /** @type {number} */
+ loudnessRange: 0, //WORD
+ /** @type {number} */
+ maxTruePeakLevel: 0, //WORD
+ /** @type {number} */
+ maxMomentaryLoudness: 0, //WORD
+ /** @type {number} */
+ maxShortTermLoudness: 0, //WORD
+ /** @type {string} */
+ reserved: "", //180
+ /** @type {string} */
+ codingHistory: "" // string, unlimited
+};
+/**
+ * The data of the 'mext' chunk.
+ * @type {!Object<string, *>}
+ */
+WaveFile.mext = {
+ /** @type {string} */
+ chunkId: "",
+ /** @type {number} */
+ chunkSize: 0,
+ /** @type {number} */
+ soundInformation: 0,
+ /** @type {number} */
+ frameSize: 0,
+ /** @type {number} */
+ ancillaryDataLength: 0,
+ /** @type {number} */
+ ancillaryDataDef: 0, //4
+ /** @type {string} */
+ reserved: ""
+};
+/**
+ * mpegInfo for making a wav from mpeg audio
+ * @type {!Object<string, *>}
+ */
+WaveFile.mpegInfo = {
+ /** @type {number} */
+ version: 0,
+ /** @type {number} */
+ layer: 0,
+ /** @type {number} */
+ sampleRate: 0,
+ /** @type {number} */
+ bitRate: 0,
+ /** @type {string} */
+ channelMode: "",
+ /** @type {number} */
+ padding: 0,
+ /** @type {number} */
+ modeExtension: 0,
+ /** @type {number} */
+ emphasis: 0,
+ /** @type {number} */
+ privateBit: 0,
+ /** @type {boolean} */
+ copyright: false,
+ /** @type {boolean} */
+ original: false,
+ /** @type {boolean} */
+ errorProtection: false,
+ /** @type {number} */
+ numChannels: 0,
+ /** @type {number} */
+ frameSize: 0,
+ /** @type {number} */
+ sampleLength: 0,
+ /** @type {boolean} */
+ freeForm: false
+};
+/**
+ * The data of the cart chunk.
+ * @type {!Object<string, *>}
+ */
+WaveFile.cart = {
+ /** @type {string} */
+ chunkId: "",
+ /** @type {number} */
+ chunkSize: 0,
+ /** @type {string} */
+ version: "",
+ /** @type {string} */
+ title: "",
+ /** @type {string} */
+ artist: "",
+ /** @type {string} */
+ cutId: "",
+ /** @type {string} */
+ clientId: "",
+ /** @type {string} */
+ category: "",
+ /** @type {string} */
+ classification: "",
+ /** @type {string} */
+ outCue: "",
+ /** @type {string} */
+ startDate: "",
+ /** @type {string} */
+ startTime: "",
+ /** @type {string} */
+ endDate: "",
+ /** @type {string} */
+ endTime: "",
+ /** @type {string} */
+ producerAppId: "",
+ /** @type {string} */
+ producerAppVersion: "",
+ /** @type {string} */
+ userDef: "",
+ /** @type {number} */
+ levelReference: 0,
+ /** @type {string} */
+ postTimer: "",
+ /** @type {string} */
+ reserved: "",
+ /** @type {string} */
+ url: "",
+ /** @type {string} */
+ tagText: ""
};
/**
* The data of the 'iXML' chunk.
@@ -1016,11 +1179,11 @@ The WaveFile properties
*/
WaveFile.iXML = {
/** @type {string} */
- chunkId: '',
+ chunkId: "",
/** @type {number} */
chunkSize: 0,
/** @type {string} */
- value: ''
+ value: ""
};
/**
* The data of the "ds64" chunk.
@@ -1028,40 +1191,40 @@ The WaveFile properties
* @type {!Object<string, *>}
*/
WaveFile.ds64 = {
- /** @type {string} */
- chunkId: '',
- /** @type {number} */
- chunkSize: 0,
- /** @type {number} */
- riffSizeHigh: 0, // DWORD
- /** @type {number} */
- riffSizeLow: 0, // DWORD
- /** @type {number} */
- dataSizeHigh: 0, // DWORD
- /** @type {number} */
- dataSizeLow: 0, // DWORD
- /** @type {number} */
- originationTime: 0, // DWORD
- /** @type {number} */
- sampleCountHigh: 0, // DWORD
- /** @type {number} */
- sampleCountLow: 0, // DWORD
- /** @type {number} */
- //"tableLength": 0, // DWORD
- /** @type {!Array<number>} */
- //"table": []
+ /** @type {string} */
+ chunkId: "",
+ /** @type {number} */
+ chunkSize: 0,
+ /** @type {number} */
+ riffSizeHigh: 0, // DWORD
+ /** @type {number} */
+ riffSizeLow: 0, // DWORD
+ /** @type {number} */
+ dataSizeHigh: 0, // DWORD
+ /** @type {number} */
+ dataSizeLow: 0, // DWORD
+ /** @type {number} */
+ originationTime: 0, // DWORD
+ /** @type {number} */
+ sampleCountHigh: 0, // DWORD
+ /** @type {number} */
+ sampleCountLow: 0 // DWORD
+ /** @type {number} */
+ //"tableLength": 0, // DWORD
+ /** @type {!Array<number>} */
+ //"table": []
};
/**
* The data of the "data" chunk.
* @type {!Object<string, *>}
*/
WaveFile.data = {
- /** @type {string} */
- chunkId: '',
- /** @type {number} */
- chunkSize: 0,
- /** @type {!Uint8Array} */
- samples: new Uint8Array(0)
+ /** @type {string} */
+ chunkId: "",
+ /** @type {number} */
+ chunkSize: 0,
+ /** @type {!Uint8Array} */
+ samples: new Uint8Array(0)
};
/**
* The data of the "LIST" chunks.
@@ -1080,12 +1243,12 @@ The WaveFile properties
* @type {!Object<string, *>}
*/
WaveFile.junk = {
- /** @type {string} */
- chunkId: '',
- /** @type {number} */
- chunkSize: 0,
- /** @type {!Array<number>} */
- chunkData: []
+ /** @type {string} */
+ chunkId: "",
+ /** @type {number} */
+ chunkSize: 0,
+ /** @type {!Array<number>} */
+ chunkData: []
};
/**
* The data of the '_PMX' chunk.
@@ -1093,17 +1256,17 @@ The WaveFile properties
*/
WaveFile._PMX = {
/** @type {string} */
- chunkId: '',
+ chunkId: "",
/** @type {number} */
chunkSize: 0,
/** @type {string} */
- value: ''
+ value: ""
};
/**
* The bit depth code according to the samples.
* @type {string}
*/
-WaveFile.bitDepth = '';
+WaveFile.bitDepth = "";
Cue points
Items in cue.points are objects like this:
@@ -1180,6 +1343,15 @@ Style guide
https://google.github.io/styleguide/jsguide.html