New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@uttori/audio-padinfo

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@uttori/audio-padinfo

Utility to manipulate the PAD_INFO.BIN file for SP-404 / SP-404SX / SP-404A series of samplers.

  • 1.2.2
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

view on npm npm module downloads Build Status Dependency Status Coverage Status Tree-Shaking Support Dependency Count Minified + GZip Minified

Uttori Pad Info

Utility to manipulate the PAD_INFO.BIN file for SP-404 / SP-404SX / SP-404A series of samplers.

Install

npm install --save @uttori/audio-padinfo

Example

const fs = require('fs');
const { AudioPadInfo } = require('@uttori/audio-padinfo');
const data = fs.readFileSync('./PAD_INFO.bin');
const { pads } = AudioPadInfo.fromFile(data);
console.log('Pads:', pads);
➜ [
    {
      "avaliable": false,
      "label": "A1",
      "filename": "A0000001.WAV",
      "originalSampleStart": 512,
      "originalSampleEnd": 385388,
      "userSampleStart": 512,
      "userSampleEnd": 385388,
      "volume": 87,
      "lofi": false,
      "loop": false,
      "gate": false,
      "reverse": true,
      "format": "WAVE",
      "channels": "Stereo",
      "tempoMode": "Off",
      "originalTempo": 109.9,
      "userTempo": 109.9
    },
    ...,
    {
      "avaliable": false,
      "label": "J12",
      "filename": "J0000012.WAV",
      "originalSampleStart": 512,
      "originalSampleEnd": 53424,
      "userSampleStart": 512,
      "userSampleEnd": 53424,
      "volume": 127,
      "lofi": false,
      "loop": false,
      "gate": true,
      "reverse": false,
      "format": "WAVE",
      "channels": "Stereo",
      "tempoMode": "Off",
      "originalTempo": 100,
      "userTempo": 100
    }
  ]

API Reference

Classes

AudioPadInfo

Uttori Pad Info - Utility to manipulate the PAD_INFO.BIN file for SP-404 series of samplers.

Typedefs

Pad : object

A Pad object.

AudioPadInfo

Uttori Pad Info - Utility to manipulate the PAD_INFO.BIN file for SP-404 series of samplers.

Kind: global class Properties

NameTypeDescription
padsArray.<Pad>Parsed Pads

new AudioPadInfo(list, [overrides])

Creates an instance of AudioPadInfo.

ParamTypeDefaultDescription
listDataBufferListThe DataBufferList of the audio file to process.
[overrides]objectOptions for this instance.
[overrides.size]number16ArrayBuffer byteLength for the underlying binary parsing.

Example (AudioPadInfo)

const fs = require('fs');
const data = fs.readFileSync('./PAD_INFO.bin');
const { pads } = AudioPadInfo.fromFile(data);
fs.writeFileSync('./output.json', JSON.stringify(pads, null, 2));
console.log('Pads:', pads);
➜ [
    {
      "avaliable": false,
      "label": "A1",
      "filename": "A0000001.WAV",
      "originalSampleStart": 512,
      "originalSampleEnd": 385388,
      "userSampleStart": 512,
      "userSampleEnd": 385388,
      "volume": 87,
      "lofi": false,
      "loop": false,
      "gate": false,
      "reverse": true,
      "format": "WAVE",
      "channels": "Stereo",
      "tempoMode": "Off",
      "originalTempo": 109.9,
      "userTempo": 109.9
    },
    ...,
  {
      "avaliable": false,
      "label": "J12",
      "filename": "J0000012.WAV",
      "originalSampleStart": 512,
      "originalSampleEnd": 53424,
      "userSampleStart": 512,
      "userSampleEnd": 53424,
      "volume": 127,
      "lofi": false,
      "loop": false,
      "gate": true,
      "reverse": false,
      "format": "WAVE",
      "channels": "Stereo",
      "tempoMode": "Off",
      "originalTempo": 100,
      "userTempo": 100
    }
  ]

audioPadInfo.parse()

Parse the PAD_INFO.BIN file, decoding the supported pad info.

This is stored alongside the samples in PAD_INFO.BIN and contains 120 × 32-byte records, one for each pad from A1 to J12. In this file, values are stored in big-endian order

Kind: instance method of AudioPadInfo

AudioPadInfo.fromFile(data) ⇒ AudioPadInfo

Creates a new AudioPadInfo from file data.

Kind: static method of AudioPadInfo Returns: AudioPadInfo - the new AudioPadInfo instance for the provided file data

ParamTypeDescription
dataBufferThe data of the image to process.

AudioPadInfo.fromBuffer(buffer) ⇒ AudioPadInfo

Creates a new AudioPadInfo from a DataBuffer.

Kind: static method of AudioPadInfo Returns: AudioPadInfo - the new AudioPadInfo instance for the provided DataBuffer

ParamTypeDescription
bufferDataBufferThe DataBuffer of the image to process.

AudioPadInfo.encodePad(data) ⇒ Buffer

Encode JSON values to a valid pad structure.

Kind: static method of AudioPadInfo Returns: Buffer - - The new pad Buffer.

ParamTypeDefaultDescription
dataPadThe JSON values to encode.
[data.originalSampleStart]number512Sample start and end offsets are relative to the original file.
[data.originalSampleEnd]number512SP-404SX Wave Converter v1.01 on macOS sets the start values to 512, the start of data.
[data.userSampleStart]number512The length of the RIFF headers before the data chunk is always exactly 512 bytes.
[data.userSampleEnd]number512The sample end value is the length of the file, and when converted correctly this is the length of the whole file.
[data.volume]number127Volume is between 0 and 127.
[data.lofi]booleanfalseLoFi: false off, true on
[data.loop]booleanfalseLoop: false off, true on
[data.gate]booleantrueGate: false off, true on
[data.reverse]booleanfalseReverse: false off, true on
[data.format]string"'WAVE'"Format is 0 for an 'AIFF' sample, and 1 for a 'WAVE' sample.
[data.channels]number2Mono or Stereo
[data.tempoMode]string"'Off'"Tempo Mode: 0 = 'Off', 1 = 'Pattern', 2 = 'User'
[data.originalTempo]number1200Tempo is BPM (beats per minute) mutiplied by 10, 0x4B0 = 1200 = 120 bpm.
[data.userTempo]number1200SP-404SX Wave Converter v1.01 on macOS computes the original tempo as 120 / sample length.

AudioPadInfo.checkDefault(pad, [strict]) ⇒ boolean

Checks to see if a Pad is set to the default values, if so it is likely.

Kind: static method of AudioPadInfo Returns: boolean - - Returns true if the Pad is set the the default values, false otherwise.

ParamTypeDefaultDescription
padPadThe JSON values to check.
[strict]booleanfalseWhen strict all values are checked for defaults, otherwise just the offsets are checked.

AudioPadInfo.getPadLabel(index) ⇒ string

Convert a numberic value used in the PAD_INFO.bin file for that pad to the pad label like A1 or J12.

Kind: static method of AudioPadInfo Returns: string - - The pad label like A1 or J12.

ParamTypeDescription
indexnumberThe numberic value used in the PAD_INFO.bin file.

AudioPadInfo.getPadIndex(label) ⇒ number

Convert a pad label like A1 or J12 to the numberic value used in the PAD_INFO.bin file for that pad.

Kind: static method of AudioPadInfo Returns: number - - The numberic value used in the PAD_INFO.bin file.

ParamTypeDescription
labelstringThe pad label like A1 or J12.

Pad : object

A Pad object.

Kind: global typedef Properties

NameTypeDescription
avaliablebooleanIf the pad is actively used in the pad file or not.
labelstringThe human readable pad text, A1 - J12.
filenamestringThe filename for the corresponding Wave File, A0000001.WAV - J0000012.WAV.
originalSampleStartnumberSample start and end offsets are relative to the original file
originalSampleEndnumberSP-404SX Wave Converter v1.01 on macOS sets the start values to 512, the start of data
userSampleStartnumberThe length of the RIFF headers before the data chunk is always exactly 512 bytes
userSampleEndnumberThe sample end value is the length of the file, and when converted correctly this is the length of the whole file
volumenumberVolume is between 0 and 127
lofibooleanLoFi: false off, true on
loopbooleanLoop: false off, true on
gatebooleanGate: false off, true on
reversebooleanReverse: false off, true on
formatstringFormat is 0 for an 'AIFF' sample, and 1 for a 'WAVE' sample
channelsnumberMono or Stereo
tempoModestringTempo Mode: 0 = 'Off', 1 = 'Pattern', 2 = 'User'
originalTemponumberBPM determined by the software. Tempo is BPM (beats per minute) mutiplied by 10, 0x4B0 = 1200 = 120 bpm
userTemponumberUser set BPM on the device

Tests

To run the test suite, first install the dependencies, then run npm test:

npm install
npm test
DEBUG=Uttori* npm test

Contributors

Thanks

License

Keywords

FAQs

Package last updated on 01 Jan 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc