Learn Events related to Musical Time

Getting Started

Welcome to RNBO

Quickstart

RNBO Basics

Key Differences

Why We Made RNBO

Coding Resources

Fundamentals

Audio IO

Messages to rnbo~

Using Parameters

MIDI in RNBO

Messages and Ports

Polyphony and Voice Control

Audio Files in RNBO

Using Buffers

Using the FFT

Export Targets

Export Targets Overview

VST/AudioUnit
Max External Target
Raspberry Pi Target
The Web Export Target
The C++ Source Code Target

Code Export

Working with JavaScript
Working with C++

Special Topics

Sample Accurate Patching
Scala and Custom Tuning

RNBO and Max for Live

RNBO Raspberry Pi OSCQuery Runner

Metadata

Export Description

Raspberry Pi GPIO

Updating the RNBO Package

Events related to Musical Time

Much like for Message and MIDI Events, you can call scheduleEvent to address your RNBO Device's transport and do things like change the tempo or time signature.

@rnbo/js exposes the TempoEvent, TransportEvent, TimeSignatureEvent, and BeatTimeEvent classes for scheduling events related to musical time and the transport that is active in your RNBO device. Like Message events or MIDI events, you call the scheduleEvent function to schedule these various events.

The following example demonstrates how you could schedule these different types of event:

  • A TempoEvent that sets the tempo to 60 bpm,
  • A TimeSignatureEvent that sets the device's time signature to simple triple (3/4) time,
  • A TransportEvent that sets the transport to be running (as opposed to stopped), and
  • A BeatTimeEvent that moves the transport to a new time, specified in a number of quarter notes from the transport's start. This start time, or time 0, would correspond to 1.1.1 in Ableton Live's transport, for example.
const { TempoEvent, BeatTimeEvent, TimeNow, createDevice, TimeSignatureEvent, TransportEvent } = require("@rnbo/js");

let context = new AudioContext();

// Somehow initialize your patcher
const response = await fetch("export/patch.export.json");
const patcher = await response.json();

const device = await createDevice({
    patcher: patcher,
    context: context
});

// will schedule an event that immediately changes the tempo to 60 bpm, assuming we've initialized our device
let tempoEvent = new TempoEvent(TimeNow, 60);
device.scheduleEvent(tempoEvent);

// will schedule an event that immediately sets the time signature to simple triple time (3/4)
let timeSignatureEvent = new TimeSignatureEvent(TimeNow, 3, 4);
device.scheduleEvent(timeSignatureEvent);

// will schedule an event that immediately sets the Transport to be running
let transportEvent = new TransportEvent(TimeNow, 1);
device.scheduleEvent(transportEvent);

// will immediately move the Transport to a new time, measured in quarter notes — 4 quarter notes from time 0. 
let beatTimeEvent = new BeatTimeEvent(TimeNow, 4);
device.scheduleEvent(beatTimeEvent);