iO-808 Documentation

repository·master·Indexed 20 days ago

https://github.com/vincentriemer/io-808

iO-808 is a web-based recreation of the TR-808 drum machine (version 2.0.0) that synthesizes sounds using the Web Audio API instead of samples. Built with React and Redux, it features a functional interface for drum machine operations, including tempo and volume control, instrument parameter configuration, and step sequencing. The project utilizes WAAClock for scheduling, seamless-immutable for high-performance state management of over 12,000 steps, and a custom KnobOverlayManager for UI interactions.

Tokens
8.2K
Snippets
26
Records
43
Agent score
72%

What's inside io-808

  1. Overview of iO-808

    master
    iO-808 is a web-based recreation of the TR-808 drum machine. It uses the Web Audio API to synthesize drum sounds (rather than using samples) and provides a functional interface for drum machine operations. The project is built using a modern React/Redux stack to manage complex state and high-performance UI updates.
  2. Tools and Libraries used in iO-808

    master

    iO-808 relies on several key libraries to handle audio synthesis, state management, and UI styling:

    • Web Audio API: Used for all sound synthesis. The library WAAClock is used specifically for scheduling drum hits.
    • React: Powers the user interface.
    • Redux: Manages application state, using redux-localstorage for state persistence and react-redux to connect components to the store.
    • seamless-immutable: Used as the primary data structure for the Redux store to ensure high performance when mutating a large state (which includes over 12,000 steps).
    • reselect: Used for efficient computation of values derived from the Redux store to optimize UI performance.
    • radium: Handles styling for React components via inline styles, providing support for pseudo-selectors like :hover and automatic vendor prefixing.
  3. Clear patterns

    master

    To wipe the contents of a pattern:

    1. Set the mode knob to PATTERN CLEAR.
    2. Select the pattern to clear using the step buttons.
    3. Check the BASIC VARIATION switch to ensure you are clearing the correct variation (A or B).
    4. Press the CLEAR button.

    Note: This clears the drum hits/triggers for both the 1st PART and 2nd PART, but it does not reset the pattern lengths.

  4. Program drum patterns in 1st PART mode

    master

    To program the first 16 steps of a pattern:

    1. Set the mode knob to 1st PART.
    2. Ensure the basic variation switch is in the A position.
    3. Select a pattern by clicking one of the step buttons (the blinking light indicates the currently selected pattern).
    4. Set the INSTRUMENT-SELECT knob to the desired drum (e.g., BD for Bass Drum).
    5. Click step buttons to add or remove drum hits. Illuminated buttons represent active triggers.

    Note on the Accent Instrument: Selecting the Accent instrument does not produce sound. Instead, it sequences volume changes. The LEVEL knob for the Accent instrument determines the volume difference between active and inactive steps; increasing it makes inactive steps quieter, adding swing/feel.

  5. Set pattern lengths for 1st and 2nd parts

    master

    Pattern lengths determine how many steps are played in a part.

    To set the length:

    1. Select the desired part via the mode knob (1st PART or 2nd PART).
    2. Select the pattern using the step buttons.
    3. Drag the CLEAR button (located below the mode knob) to the specific step button representing the desired length.

    Behavioral Rules:

    • Setting the length of the 1st PART automatically sets the 2nd PART length to 0.
    • Setting the length of the 2nd PART does not affect the 1st PART length.
  6. Program drum patterns in 2nd PART mode

    master

    Each pattern can have a second 16-step part (for a total of 32 steps). To edit it:

    1. Set the mode knob to 2nd PART.
    2. Select the desired pattern using the step buttons.
    3. Note that while editing, the sequencer will play the 1st PART followed by the 2nd PART in a loop.

    Important: By default, the 2nd PART has a pattern length of 0. You must set a length (see Setting Pattern Lengths) before you can hear or program it effectively.

  7. Play patterns in MANUAL PLAY mode

    master

    To turn programmed patterns into a song:

    1. Set the mode knob to MANUAL PLAY.
    2. Select Patterns:
      • Click one of the first 12 step buttons to select a BASIC RHYTHM.
      • Click one of the last 4 step buttons to select an INTRO/FILL IN.
    3. Starting the Sequence:
      • The blinking step buttons indicate which pattern will start when START/STOP is pressed.
      • Press the TAP button to toggle the starting pattern between the selected BASIC RHYTHM and the INTRO/FILL IN.
    4. Scheduling and Triggering:
      • While playing, clicking a BASIC RHYTHM button schedules it to play once the current pattern finishes.
      • Clicking an INTRO/FILL IN button selects which fill will be used when triggered.
      • Press the TAP button to trigger the selected INTRO/FILL IN after the current pattern finishes.
  8. Save and Load pattern collections

    master

    You can export and import your work using .json files.

    • Saving: Click the save button (second button on the top left). This downloads your pattern collection to your computer. Progress is automatically saved locally in the browser, so you can resume work later without manual saving.
    • Loading: Click the load button (top left-most button) and select an iO-808 .json file to restore a collection.
  9. Control playback with START_STOP_BUTTON_CLICK

    master

    The START_STOP_BUTTON_CLICK action toggles the playing state. The behavior varies depending on the selectedMode:

    • MODE_FIRST_PART / MODE_SECOND_PART: If starting, it resets currentStep to -1, sets the currentVariation based on basicVariationPosition, and sets currentPattern to the selectedPattern.
    • MODE_MANUAL_PLAY: If starting, it resets currentStep to -1, sets the variation, sets currentPattern (considering fillScheduled), and resets currentMeasure to 0.
    • MODE_PATTERN_CLEAR: Does nothing.
  10. Manage pattern sequencing with TICK

    master

    The TICK action is used to advance the playback step. It uses patternLengthSelector to determine when a pattern has finished. Depending on the selectedMode, it handles transitions:

    • MODE_FIRST_PART: Resets currentStep to 0 and advances the currentVariation.
    • MODE_SECOND_PART: Attempts to transition to SECOND_PART if its length is greater than 0; otherwise, it returns to FIRST_PART and advances the variation.
    • MODE_MANUAL_PLAY: Transitions between parts or measures using nextMeasure logic.

    If the pattern has not finished, it simply increments currentStep.

  11. Current limitations and unimplemented features

    master

    The following features from the original TR-808 hardware are currently not implemented in iO-808:

    • PLAY mode
    • COMPOSE mode
    • PRE-SCALE (all patterns are currently hardcoded to 3)
    • Adding triggers via the TAP button
  12. Update instrument parameters with INSTRUMENT_CHANGE

    master

    To update a specific control (like volume or decay) on a specific instrument, dispatch INSTRUMENT_CHANGE. The payload must contain the type of instrument, the controlName, and the new value.

    // Example payload structure for INSTRUMENT_CHANGE
    dispatch({
      type: 'INSTRUMENT_CHANGE',
      payload: {
        type: 'kick',
        controlName: 'volume',
        value: 0.8
      }
    });