Orchestra#

Compatible motors powered by Talon FX have the ability to produce audible output through the MusicTone (Java, C++, Python) control request. The Orchestra API extends this ability and orchestrates multiple motors to play music.

To get started, construct an Orchestra (Java, C++, Python) object with an instrument and CHRP. Ensure that addInstrument() and loadMusic() are not called periodically, as they are blocking functions.

Note

For information on converting MIDI to CHRP, see CHRP Converter.

Orchestra m_orchestra = new Orchestra();

// Add a single device to the orchestra
m_orchestra.addInstrument(m_motor);

// Attempt to load the chrp
var status = m_orchestra.loadMusic("track.chrp");

if (!status.isOK()) {
   // log error
}
Orchestra m_orchestra;

// Add a single device to the orchestra
m_orchestra.addInstrument(m_motor);

// Attempt to load the chrp
auto status = m_orchestra.loadMusic("track.chrp");

if (!status.IsOK()) {
   // log error
}
self.orchestra = Orchestra()

self.orchestra.add_instrument(self.motor);

status = self.orchestra.load_music("track.chrp")

if not status.is_ok():
   # log error

Once the track has been loaded, play/pause/stop can be used to manage the track. play() only needs to be called once.

m_orchestra.play();
m_orchestra.Play();
self.orchestra.play()

Playback While Disabled (FRC)#

Playback can be safely enabled during robot disable by enabling the Allow Music Dur Disable (Java, C++, Python) config.