npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@uttori/audio-padinfo

v1.2.2

Published

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

Downloads

1

Readme

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

Typedefs

AudioPadInfo

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

Kind: global class Properties

| Name | Type | Description | | --- | --- | --- | | pads | Array.<Pad> | Parsed Pads |

new AudioPadInfo(list, [overrides])

Creates an instance of AudioPadInfo.

| Param | Type | Default | Description | | --- | --- | --- | --- | | list | DataBufferList | | The DataBufferList of the audio file to process. | | [overrides] | object | | Options for this instance. | | [overrides.size] | number | 16 | ArrayBuffer 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

| Param | Type | Description | | --- | --- | --- | | data | Buffer | The 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

| Param | Type | Description | | --- | --- | --- | | buffer | DataBuffer | The 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.

| Param | Type | Default | Description | | --- | --- | --- | --- | | data | Pad | | The JSON values to encode. | | [data.originalSampleStart] | number | 512 | Sample start and end offsets are relative to the original file. | | [data.originalSampleEnd] | number | 512 | SP-404SX Wave Converter v1.01 on macOS sets the start values to 512, the start of data. | | [data.userSampleStart] | number | 512 | The length of the RIFF headers before the data chunk is always exactly 512 bytes. | | [data.userSampleEnd] | number | 512 | The sample end value is the length of the file, and when converted correctly this is the length of the whole file. | | [data.volume] | number | 127 | Volume is between 0 and 127. | | [data.lofi] | boolean | false | LoFi: false off, true on | | [data.loop] | boolean | false | Loop: false off, true on | | [data.gate] | boolean | true | Gate: false off, true on | | [data.reverse] | boolean | false | Reverse: false off, true on | | [data.format] | string | "'WAVE'" | Format is 0 for an 'AIFF' sample, and 1 for a 'WAVE' sample. | | [data.channels] | number | 2 | Mono or Stereo | | [data.tempoMode] | string | "'Off'" | Tempo Mode: 0 = 'Off', 1 = 'Pattern', 2 = 'User' | | [data.originalTempo] | number | 1200 | Tempo is BPM (beats per minute) mutiplied by 10, 0x4B0 = 1200 = 120 bpm. | | [data.userTempo] | number | 1200 | SP-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.

| Param | Type | Default | Description | | --- | --- | --- | --- | | pad | Pad | | The JSON values to check. | | [strict] | boolean | false | When 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.

| Param | Type | Description | | --- | --- | --- | | index | number | The 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.

| Param | Type | Description | | --- | --- | --- | | label | string | The pad label like A1 or J12. |

Pad : object

A Pad object.

Kind: global typedef Properties

| Name | Type | Description | | --- | --- | --- | | avaliable | boolean | If the pad is actively used in the pad file or not. | | label | string | The human readable pad text, A1 - J12. | | filename | string | The filename for the corresponding Wave File, A0000001.WAV - J0000012.WAV. | | originalSampleStart | number | Sample start and end offsets are relative to the original file | | originalSampleEnd | number | SP-404SX Wave Converter v1.01 on macOS sets the start values to 512, the start of data | | userSampleStart | number | The length of the RIFF headers before the data chunk is always exactly 512 bytes | | userSampleEnd | number | The sample end value is the length of the file, and when converted correctly this is the length of the whole file | | volume | number | Volume is between 0 and 127 | | lofi | boolean | LoFi: false off, true on | | loop | boolean | Loop: false off, true on | | gate | boolean | Gate: false off, true on | | reverse | boolean | Reverse: false off, true on | | format | string | Format is 0 for an 'AIFF' sample, and 1 for a 'WAVE' sample | | channels | number | Mono or Stereo | | tempoMode | string | Tempo Mode: 0 = 'Off', 1 = 'Pattern', 2 = 'User' | | originalTempo | number | BPM determined by the software. Tempo is BPM (beats per minute) mutiplied by 10, 0x4B0 = 1200 = 120 bpm | | userTempo | number | User 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