Defines an instrument or assigns one to a channel.
Syntax
Instrument id, wave_id, envelope_id
Instrument channel, instrument_id
Description
INSTRUMENT gives generated sound a reusable voice. The definition form combines a WAVE slot and an ENVELOPE slot into an instrument id. That instrument can then be selected with VOICE or assigned to a specific channel.
The assignment form changes the instrument used by a channel. After that, NOTE and PLAY commands on that channel use the selected instrument, so the same melody can sound smooth, buzzy, plucked, or noisy depending on the waveform and envelope.
This is the command to use when SOUND and NOTE are working but the default tone is too plain for the program you are writing.
Example
wave 1, 0
envelope 1, 0.01, 0.10, 0.50, 0.20
instrument 1, 1, 1
instrument 0, 1
note 0, "C", 4, 0.25
Notes
- Use VOICE to set the default instrument without naming a channel every time.
See also