midi_listen: Listen to midi events

Description Usage Arguments Details Value Examples

Description

These functinos will launch a process that checks every n seconds (default 0.5) if any/a given midi event has been received on any/a given midi interface.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
midi_all(callback = ~cat(.x, "\n"), n = 0.5, with_clock = FALSE)

midi_one_event(
  event = c("noteoff", "noteon", "poly aftertouch", "cc", "program",
    "channel aftertouch", "pitch", "position", "select", "start", "continue", "stop",
    "reset"),
  callback = ~cat(.x, "\n"),
  n = 0.5
)

midi_one_interface(
  interface,
  callback = ~cat(.x, "\n"),
  n = 0,
  with_clock = FALSE
)

midi_one_event_one_interface(
  event = c("noteoff", "noteon", "poly aftertouch", "cc", "program",
    "channel aftertouch", "pitch", "position", "select", "start", "continue", "stop",
    "reset"),
  interface,
  callback = ~cat(.x, "\n"),
  n = 0.5
)

Arguments

callback

The callback function to execute when R receives a MIDI message. This function takes one argument, which is the JSON MIDI message.

n

Time in second between each check for a new MIDI message.

with_clock

Whether or not to listen to the clock event.

event

the event to listen to. Available event are "noteoff", "noteon", "poly aftertouch", "cc", "program", "channel aftertouch", "pitch", "position", "select", "start", "continue", "stop", and "reset"

interface

name of the interface to listen to. Must be one of midi_list().

Details

midi_all(), listens for all interfaces and all events (except the clock, which can be listen with with_clock = FALSE), midi_one_event() listens to one specific event on all interfaces, midi_one_interface() listens to any event from one interface, and midi_one_event_one_interface() listens to one event on one interface.

Value

A background process listen to MIDI events

Examples

1
2
3
4
5
6
if (interactive()){
  # Launch
  midi_all()
  # Kill the process
  midi_close_all()
}

ColinFay/noon documentation built on Sept. 18, 2020, 12:01 a.m.