Module: Musa::MIDIRecorder

Included in:
All
Defined in:
lib/musa-dsl/midi/midi-recorder.rb

Overview

MIDI event recording and transcription utilities.

Provides tools for capturing raw MIDI bytes alongside sequencer position timestamps and converting them into structured note events. Useful for recording phrases from external MIDI controllers synchronized with the sequencer timeline.

The captured events can be transcribed into hashes suitable for Musa's transcription pipelines, including note on/off pairing, duration calculation, and silence detection.

Examples:

Basic recording workflow

require 'musa-dsl'
require 'midi-communications'

sequencer = Musa::Sequencer::Sequencer.new(4, 24)
recorder = Musa::MIDIRecorder::MIDIRecorder.new(sequencer)

# Capture MIDI from controller
input = MIDICommunications::Input.gets
input.on_message { |bytes| recorder.record(bytes) }

# After recording, get structured notes
notes = recorder.transcription
notes.each { |n| puts "#{n[:pitch]} at #{n[:position]} for #{n[:duration]}" }

See Also:

Defined Under Namespace

Classes: MIDIRecorder