# Atari Lynx instrument editor

Atari Lynx instrument editor consists of two tabs: Sample and Macros.

## Sample

for sample settings, see [the Sample instrument editor](sample.md).

the only differences are the lack of an "Use wavetable" option, and the presence of a "Use sample" one.

note that using samples on Lynx is CPU expensive!

## Macros

- **Volume**: volume sequence.
- **Arpeggio**: pitch sequence.
- **Duty/Int**: bit pattern for LFSR taps and integration.
- **Panning (left)**: output level for left channel.
- **Panning (right)**: output level for right channel.
- **Pitch**: fine pitch.
- **Phase Reset**: trigger restart of waveform/LFSR reset.

## audio generation description

Atari Lynx generates sound using a 12-bit linear feedback shift register with configurable tap. nine separate bits can be enabled to be the source of feedback: 0, 1, 2, 3, 4, 5, 7, 10 and 11. to generate _any_ sound at least one bit _must_ be enabled.

### square wave

the LFSR is shifted at the rate define by sound pitch and generates square wave by setting channel output value to +volume or -volume, depending on the bit shifted in.

### triangle wave

alternatively when "int" bit is set sound wave is generated by adding or subtracting volume from output effectively producing triangle wave.

#### how triangle wave works?

hint: to obtain triangle set bits "int" and "11" in "Duty/Int" sequence and set volume to about 22.
by enabling 11th tap bit the value shifted in is negated after 11 bit is shifted in hence the volume is added for 11 cycles and then subtracted for 11 cycles.
