1.7.0 • Published 3 years ago
brstm v1.7.0
brstm.js
BRSTM decoder.
Part of Nikku.
Usage example
import { Brstm } from 'brstm';
// BRSTM file should be read and passed as ArrayBuffer type
const brstm = new Brstm(arrayBuffer);
// Here you get an Object containing all the metadata extracted from BRSTM's file HEAD chunk
const metadata = brstm.metadata;
// You get per-channel PCM samples
const samples = brstm.getAllSamples();
// If you don't want the full samples, you can decode them partially
// getSamples(offset, size) will return the per-channel `offset`-th sample until `(offset + size - 1)`-th sample
const samplesPartial = brstm.getSamples(0, 100);Members
rawData:{Uint8Array}, representation of array buffer passed in at class constructor.metadata:{Object}, the metadata extracted from BRSTM's file HEAD chunkfileSize:{number}endianness:{number}, 0 - little endian, 1 - big endiancodec:{number}- 0 - 8-bit PCM
- 1 - 16-bit PCM
- 2 - 4-bit ADPCM
loopFlag:{number}numberChannels:{number}, channel count of the whole filesampleRate:{number}loopStartSample:{number}, loop start, in terms of sample #totalSamples:{number}totalBlocks:{number}, total number of blocks, per channel, including final blockblockSize:{number}samplesPerBlock:{number}finalBlockSize:{number}, Final block size, without padding, in bytesfinalBlockSizeWithPadding:{number}, Final block size, with padding, in bytestotalSamplesInFinalBlock:{number}, Total samples in final blockadpcTableSamplesPerEntry:{number}, Samples per entry in ADPC tableadpcTableBytesPerEntry:{number}, Bytes per entry in ADPC tablenumberTracks:{number}, Number of trackstrackDescriptionType:{number}, Track description type (0 or 1)trackDescriptions:{Array<TrackDescription>}, Basic description of each trackTrackDescription:{Object},numberChannels:{number}, this particular track's channel counttype:{number}, this particular track's description type (0 or 1)
Methods
getAllSamples():{Array<Int16Array>}, per-channel PCM samplesgetSamples(offset, size):{Array<Int16Array>}, per-channel samples fromoffset-th sample until(offset + size - 1)-th sample
1.7.0--test.1
3 years ago
1.7.0--test.0
3 years ago
1.7.0
3 years ago
1.6.1
4 years ago
1.6.0
5 years ago
1.5.1
5 years ago
1.5.0
5 years ago
1.4.0
5 years ago
1.3.3
5 years ago
1.3.2
6 years ago
1.3.1
6 years ago
1.3.0
6 years ago
1.2.0
6 years ago
1.1.0
6 years ago
1.2.1
6 years ago
1.0.0
6 years ago
0.1.3
6 years ago
0.1.2
7 years ago
0.1.1
7 years ago
0.1.0
7 years ago