Node interface to shntool application (http://www.etree.org/shnutils/shntool/)
The 'shntool' application is a multi-purpose WAV file data processing tool. It can process any file that contains WAVE type data, compressed or not, provided there is a format module to handle that particular file time.
This node module acts as a Node.js interface to that application.
You will need have installed the shntool software to use this module. It can be obtained here: http://shnutils.freeshell.org/shntool/
Just install the node module into your project from NPM
npm install --save node-shntool
This is the first release of this interface, it is currently experimental. It currently supports 'CUE file' generation, joining files, and rudimentary format conversion. The first argument to the promise calls is a string or list of strings used by the 'globby' module to locate the input files. The second argument to the promise calls is any options for the function itself.
// TYPESCRIPT (async)
import * as shntool from 'node-shntool';
// JAVASCRIPT (Promise)
var shntool = require('node-shntool');
This service function returns a list of supported audio files, filtered from the supplied globby globs.
// TYPESCRIPT (async)
const files = await shntool.audiofiles('path/to/files/*');
// JAVASCRIPT (promise)
shntool.audiofiles('path/to/files/*').then(
function(files) {
// files is an array of paths to supported audio files
console.log(filelist.join('\n'));
}
).catch( (err) => {
// handle error
});
This service function result is an array of text lines.
// TYPESCRIPT (async)
const cuelines = await shntool.cuefile('prefix-*.wav');
// JAVASCRIPT (Promise)
shntool.cuefile('prefix-*.wav').then(
function(cuelines) {
// each line of the CUE lines is available here
console.log(cuelines.join('\n'));
}
).catch( (err) => {
// handle error
});
This service function joins the specified files into a destination file.
// note that the options here are actually the defaults so you can omit them
// TYPESCRIPT (async)
const joinfile = await shntool.joined('prefix-*.wav', { destfile: 'joined.wav', dir: '.' });
// JAVASCRIPT (Promise)
shntool.joined('prefix-*.wav', { destfile: 'joined.wav', dir: '.' }).then(
function(joinedfile) {
// the joinedfile is actually on the file system at this point
// if you combine the CUE file with the joined file you can burn a CD
}
).catch( (err) => {
// handle error
});
This service function converts the files specified as specified.
The result is an array of the target file paths as parsed from the conversion.
Currently only converting FLAC files to WAV files is supported (tested).
// note that the options here are actually the defaults so you can omit them
// TYPESCRIPT (async)
const convertedFiles = await shntool.convert('prefix-*.wav', { dir: '.' });
// JAVASCRIPT (Promise)
shntool.convert('prefix-*.wav', { dir: '.' }).then(
function(convertedFiles) {
// convertedFiles is an array of file paths (the target files)
}
).catch( (err) => {
// handle error
});
This module itself is MIT licensed. Feel free. The 'shntool' and its helper applications have their own licenses.