- AudioPattern ⇐
DataBuffer AudioPattern - Roland SP-404SX / SP-404 MKii Pattern Utility A utility to read, modify and write pattern files from a Roland SP-404SX / SP-404 MKii
PTNfiles. Can also convert patterns to MIDI or convert from MIDI to pattern. Several values are not saved into the pattern but are configured when recording a pattern:- BPM
- Quantization Strength / Shuffle Rate
- Quantization Grid Size
- Metronome Volume
Substep on Sequencer Mode actually generates multiple notes depending on the substep type offset by a set number of ticks, no other designation is set on the note.
Notes in the pattern grid will typically line up, but if the last note or a note near the end plays a sample beyond the length of the bar, there needs to be place holder notes for however long that is.
- Note :
object - PadMapping :
object
AudioPattern - Roland SP-404SX / SP-404 MKii Pattern Utility
A utility to read, modify and write pattern files from a Roland SP-404SX / SP-404 MKii PTN files.
Can also convert patterns to MIDI or convert from MIDI to pattern.
Several values are not saved into the pattern but are configured when recording a pattern:
- BPM
- Quantization Strength / Shuffle Rate
- Quantization Grid Size
- Metronome Volume
Substep on Sequencer Mode actually generates multiple notes depending on the substep type offset by a set number of ticks, no other designation is set on the note.
Notes in the pattern grid will typically line up, but if the last note or a note near the end plays a sample beyond the length of the bar, there needs to be place holder notes for however long that is.
Kind: global class
Extends: DataBuffer
- AudioPattern ⇐
DataBuffer- new AudioPattern([input], options)
- instance
- .bars :
number - .timeSignature :
number - .notes :
Array.<Note> - .defaultMap :
Record.<string, PadMapping> - .parse
- .toMidi ⇒
AudioMIDI
- .bars :
- static
- .defaultMap ⇒
Record.<string, PadMapping> - .defaultMapOG ⇒
Record.<string, PadMapping> - .fromMidi(AudioMIDI, noteMap, patternPPQN, [og]) ⇒
DataBuffer
- .defaultMap ⇒
Creates a new AudioPattern.
| Param | Type | Description |
|---|---|---|
| [input] | Array.<number> | ArrayBuffer | Buffer | DataBuffer | Int8Array | Int16Array | Int32Array | number | string | Uint8Array | Uint16Array | Uint32Array | undefined |
The data to process. |
| options | object |
The options for parsing the pattern. |
| [options.bytesPerNote] | number |
The number of bytes for each note; default is 8. |
| [options.padsPerBank] | number |
The number of pads per bank, 12 or 16 for the MKii; default is 16. |
| [options.og] | boolean |
When true, process for the original SP404s, when false for the MKii; default is false. |
Example (AudioPattern)
const data = fs.readFileSync('./PTN00025.BIN');
const file = new AudioPattern(data);
console.log('Notes:', file.notes);The number of bars in the pattern, so 1 bar is 1.
Kind: instance property of AudioPattern
The time signature of the pattern, 0 = 4/4, 1 is 3/4, 2 is 2/4, 3 = 1/4, 4 is 5/4, 5 is 6/4, 7 is 7/4.
Kind: instance property of AudioPattern
audioPattern.notes : Array.<Note>
Kind: instance property of AudioPattern
The default mapping of pads A1 to J16 to MIDI notes.
Kind: instance property of AudioPattern
Parse the pattern into notes and extract the bar count from the footer.
Kind: instance property of AudioPattern
| Param | Type | Description |
|---|---|---|
| options | object |
The options for parsing the pattern. |
| [options.bytesPerNote] | number |
The number of bytes for each note; default is 8. |
| [options.padsPerBank] | number |
The number of pads per bank, 12 or 16 for the MKii; default is 16. |
| [options.og] | boolean |
When true, process for the original SP404s, when false for the MKii; default is false. |
Convert the parsed notes to a AudioMidi instance ready to be saved as MIDI file or manipulated further.
Kind: instance property of AudioPattern
Returns: AudioMIDI - A new AudioMIDI instance populated from the pattern.
| Param | Type | Description |
|---|---|---|
| options | object |
The options |
| [options.bpm] | number |
The BPM of the track, when undefined no tempo event will be added. |
| options.ppq | number |
The pulses per quarter note; OG is 96, MKii is 480. |
| options.fileName | string |
The name of the pattern file being converted, |
| options.noteMap | Record.<string, number> |
A map of Pads A1 to J16 that correspond to which MIDI note. |
The default mapping of pads A1 to J16 to MIDI notes.
Kind: static property of AudioPattern
Returns: Record.<string, PadMapping> - The default mapping of pads A1 to J16 to MIDI notes.
The default mapping of pads A1 to J12 to MIDI notes for the OG SP404.
https://support.roland.com/hc/en-us/articles/201932129-SP-404-Playing-the-SP-404-via-MIDI
Kind: static property of AudioPattern
Returns: Record.<string, PadMapping> - The default mapping of pads A1 to J16 to MIDI notes.
Converts a AudioMIDI structure back into a pad file format. Pads that play all the way through will have 2 on notes, one to start the sound and one to end it.
Kind: static method of AudioPattern
Returns: DataBuffer - A new DataBuffer representing the pad file.
| Param | Type | Default | Description |
|---|---|---|---|
| AudioMIDI | AudioMIDI |
The AudioMIDI instance to convert back to a pad file. | |
| noteMap | Record.<string, string> |
A map of Pads A1 to J16 that correspond to which MIDI note |
|
| patternPPQN | number |
The pulses per quarter note of the pattern; OG is 96, MKii is 480. | |
| [og] | boolean |
false |
When true, process for the original SP404s, when false for the MKii; default is false. |
Kind: global typedef
Properties
| Name | Type | Description |
|---|---|---|
| ticks | number |
The delay in ticks until the next track. |
| midiNote | number |
The MIDI note value (47-106). |
| bankSwitch | number |
The channel offset (00=ABCDE, 01=FGHIJ). |
| pitchMode | number |
The pitch mode of Step Sequencer notes. |
| velocity | number |
The velocity of the note (0-127). |
| unknown3 | number |
An unknown value, commonly 64 / 0x40. |
| length | number |
The length of the note in ticks (2 Bytes). |
| sampleNumber | number |
The calculated sample number based on MIDI note and bank switch. |
| padLabel | string |
The label of the pad, constructed from the sample number and bank. |
Kind: global typedef
Properties
| Name | Type | Description |
|---|---|---|
| midiNote | number |
The MIDI note numeric value. |
| pad | string |
The human friendly pad label. |
| bankSwitch | number |
The value for the bank switch byte. |