Class: MusaLCEServer::Live::Live

Inherits:
Daw
  • Object
show all
Defined in:
lib/live/live.rb

Overview

Note:

Transport controls (play, stop, etc.) are not implemented for Live as the MIDI Remote Script API doesn't support them.

DAW controller for Ableton Live.

Implements the Daw interface for Ableton Live, providing track management and MIDI routing through the MusaLCE for Live MIDI Remote Script.

Examples:

# Started via MusaLCEServer.run('live')
daw.track('Bass').out.note(60, velocity: 100, duration: 1)

Since:

  • 0.1.0

Instance Method Summary collapse

Constructor Details

This class inherits a constructor from MusaLCEServer::Daw

Instance Method Details

#daw_initialize(midi_devices:, clock:, osc_server:, osc_client:, logger:) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Since:

  • 0.1.0



28
29
30
31
32
33
34
35
36
# File 'lib/live/live.rb', line 28

def daw_initialize(midi_devices:, clock:, osc_server:, osc_client:, logger:)
  super
  tracks = Tracks.new(midi_devices, logger: logger)
  handler = Handler.new(osc_server, osc_client, tracks, logger: logger)

  logger.info('Loaded Ableton Live driver')

  return tracks, handler
end

#midi_sync(midi_device_name, manufacturer: nil, model: nil, name: nil) ⇒ void

This method returns an undefined value.

Sets the MIDI device to use for clock synchronization.

Examples:

daw.midi_sync('IAC Driver Bus 1')

Parameters:

  • midi_device_name (String)

    default device name to search for

  • manufacturer (String, nil) (defaults to: nil)

    optional manufacturer filter

  • model (String, nil) (defaults to: nil)

    optional model filter

  • name (String, nil) (defaults to: nil)

    optional name filter (overrides midi_device_name)

Since:

  • 0.1.0



63
64
65
66
67
68
69
70
71
# File 'lib/live/live.rb', line 63

def midi_sync(midi_device_name, manufacturer: nil, model: nil, name: nil)
  name ||= midi_device_name

  @clock.input = MIDICommunications::Input.all.find do |_|
    (_.manufacturer == manufacturer || manufacturer.nil?) &&
      (_.model == model || model.nil?) &&
      (_.name == name || name.nil?)
  end
end

#track(name, all: false) ⇒ Track+

Retrieves track(s) by name.

Unlike Bitwig, Live can have multiple tracks with the same name.

Parameters:

  • name (String)

    the track name

  • all (Boolean) (defaults to: false)

    if true, returns all matching tracks; otherwise returns first match

Returns:

  • (Track, Array<Track>)

    the track(s) matching the name

Since:

  • 0.1.0



45
46
47
48
49
50
51
# File 'lib/live/live.rb', line 45

def track(name, all: false)
  if all
    @tracks.find_by_name(name)
  else
    @tracks.find_by_name(name).first
  end
end