Class: DX7Voice

DX7Voice(data, index)

DX7 Voice (patch) structure Represents a single DX7 voice/patch with 6 operators, algorithm selection, LFO, pitch envelope, and global parameters. Supports two formats: - **Packed format (128 bytes)**: DX7 internal format with bit-packed parameters - **Unpacked format (169 bytes)**: Decompressed format with all parameters expanded Each voice contains: - 6 FM operators with individual EGs, frequency, output level, and scaling - Algorithm selection (1-32) for operator routing - Feedback loop (0-7) for algorithm feedback - LFO parameters (speed, delay, depth, wave shape) - Pitch envelope generator (4 rates, 4 levels) - Global parameters (transpose, pitch mod sensitivity, etc.) - 10-character voice name

Constructor

new DX7Voice(data, index)

Create a DX7Voice from raw 128-byte data
Parameters:
Name Type Default Description
data Array.<number> | Uint8Array 128 bytes of voice data
index number 0 Voice index (0-31)
Source:
Throws:
If data length is not exactly 128 bytes
Type
DX7ValidationError
Examples
// Create a voice from packed DX7 bank data
const bankData = new Uint8Array(...); // 4096 bytes for 32 voices
const voiceIndex = 5; // 6th voice in bank
const voiceData = bankData.subarray(voiceIndex * 128, (voiceIndex + 1) * 128);
const voice = new DX7Voice(voiceData, voiceIndex);
console.log(voice.name); // e.g., "BASS 1"
// Load a voice from a single-voice SYX file
const file = document.getElementById("voice-file").files[0];
const voice = await DX7Voice.fromFile(file);
console.log(voice.toJSON());
// Create from JSON and export to SysEx
const json = loadVoiceData();
const voice = DX7Voice.fromJSON(json);
const syxData = voice.toSysEx(); // For single voice synths like Volca FM
const packed = voice.data; // 128 bytes for DX7 bank
// Modify operator parameters
const voice = await DX7Voice.fromFile(file);
const unpacked = voice.unpack();
unpacked[DX7Voice.UNPACKED_OP_OUTPUT_LEVEL] = 80; // Change OP1 output level
unpacked[DX7Voice.UNPACKED_ALGORITHM] = 5; // Change to algorithm 6
const modifiedVoice = DX7Voice.fromUnpacked(unpacked);

Classes

DX7Voice

Methods

getParameter(offset) → {number}

Get a raw parameter value from the packed data
Parameters:
Name Type Description
offset number Byte offset in the voice data (0-127)
Source:
Throws:
If offset is out of range
Type
DX7ValidationError
Returns:
Parameter value (0-127)
Type
number

getUnpackedParameter(offset) → {number}

Get a parameter value from the unpacked 169-byte format
Parameters:
Name Type Description
offset number Byte offset in the unpacked data (0-168)
Source:
Throws:
If offset is out of range
Type
DX7ValidationError
Returns:
Parameter value (0-127)
Type
number

setParameter(offset, value)

Set a raw parameter value in the packed data
Parameters:
Name Type Description
offset number Byte offset in the voice data
value number Parameter value (0-127)
Source:

toJSON() → {object}

Convert voice to JSON format
Source:
Returns:
Voice data in JSON format
Type
object

toSysEx() → {Uint8Array}

Export voice to DX7 single voice SysEx format (VCED format) This is useful for synths that only support single voice dumps (e.g., KORG Volca FM) Converts from 169-byte unpacked format to 155-byte VCED format
Source:
Returns:
Single voice SysEx data (163 bytes)
Type
Uint8Array

unpack() → {Uint8Array}

Unpack the voice data to 169-byte unpacked format This converts the packed 128-byte format to the full DX7 parameter set
Source:
Returns:
169 bytes of unpacked voice data (138 operator + 8 pitch EG + 13 global + 10 name = 169 bytes)
Type
Uint8Array

(static) createDefault(index) → {DX7Voice}

Create a default/empty voice
Parameters:
Name Type Default Description
index number 0 Voice index
Source:
Returns:
Type
DX7Voice

(async, static) fromFile(file) → {Promise.<DX7Voice>}

Load a DX7 voice from a single voice SYX file
Parameters:
Name Type Description
file File | Blob SYX file (single voice in VCED format)
Source:
Throws:
  • If file has invalid VCED header
    Type
    DX7ParseError
  • If file cannot be read (FileReader error)
    Type
    Error
Returns:
Type
Promise.<DX7Voice>

(static) fromJSON(json, index) → {DX7Voice}

Create a DX7Voice from a JSON object
Parameters:
Name Type Default Description
json DX7VoiceJSON JSON representation of a DX7 voice
index number 0 Voice index (optional, defaults to 0)
Source:
Throws:
If JSON structure is invalid
Type
DX7ValidationError
Returns:
Type
DX7Voice

(static) fromSysEx(data, index) → {DX7Voice}

Create a DX7Voice from SysEx data
Parameters:
Name Type Default Description
data Array.<number> | ArrayBuffer | Uint8Array Voice data (128 bytes of packed voice data) or VCED SysEx data (163 bytes with header/footer)
index number 0 Voice index (optional, defaults to 0)
Source:
Throws:
Returns:
Type
DX7Voice

(static) fromUnpacked(unpacked, index) → {DX7Voice}

Create a voice from unpacked 169-byte data
Parameters:
Name Type Default Description
unpacked Array.<number> | Uint8Array 169 bytes of unpacked data (159 parameters + 10 name bytes)
index number 0 Voice index
Source:
Returns:
Type
DX7Voice

(static) pack(unpacked) → {Uint8Array}

Pack 169-byte unpacked data to 128-byte format
Parameters:
Name Type Description
unpacked Array.<number> | Uint8Array 169 bytes of unpacked data (159 parameters + 10 name bytes)
Source:
Returns:
128 bytes of packed data
Type
Uint8Array

Type Definitions

DX7BankJSON

JSON representation of a DX7 bank
Type:
  • Object
Properties:
Name Type Description
version string Version string (e.g., "1.0")
name string Bank name (e.g., filename)
voices Array.<DX7VoiceIndexJSON> Array of 32 voices
Source:

DX7OperatorJSON

JSON representation of a DX7 operator (human-readable)
Type:
  • Object
Properties:
Name Type Description
id number Operator number (1-6)
osc Object Oscillator parameters (frequency, detune)
eg Object Envelope generator (rates and levels)
key Object Key scaling parameters (break point, velocity)
output Object Output parameters (level, amp mod sensitivity)
scale Object Keyboard scaling (left/right curves and depths)
Source:

DX7VoiceIndexJSON

JSON representation of a DX7 voice with bank index
Type:
  • Object
Properties:
Name Type Description
index number Voice index in bank (1-32)
name string Voice/patch name
operators Array.<DX7OperatorJSON> Array of 6 operators
pitchEG Object Pitch envelope parameters
lfo Object LFO parameters
global Object Global voice parameters
Source:

DX7VoiceJSON

JSON representation of a DX7 voice (patch)
Type:
  • Object
Properties:
Name Type Description
name string Voice/patch name (max 10 characters)
operators Array.<DX7OperatorJSON> Array of 6 operators
pitchEG Object Pitch envelope generator (rates and levels)
lfo Object Low frequency oscillator parameters
global Object Global voice parameters (algorithm, feedback, transpose, etc.)
Source: