TuningFork.Osc.Out (TuningFork v0.1.0)

Copy Markdown View Source

Plays a TuningFork.Score out over OSC, in time.

{:ok, client} = TuningFork.Osc.Client.start_link(port: 57_120)
{:ok, playing} = TuningFork.Osc.Out.play(client, score)

Summary

Functions

Returns a specification to start this module under a supervisor.

The messages score becomes, as {seconds, address, args}, without sending them.

Play score through client, sending one message per note when its moment arrives.

Stop, sending the :hush address first.

Types

t()

@type t() :: pid()

Functions

child_spec(init_arg)

Returns a specification to start this module under a supervisor.

See Supervisor.

messages(score, opts \\ [])

@spec messages(TuningFork.Score.t(), keyword()) :: [{float(), String.t(), [term()]}]

The messages score becomes, as {seconds, address, args}, without sending them.

Takes play/3's :address and :shape options.

iex> score = TuningFork.Score.new(bpm: 120, beats: 4)
iex> TuningFork.Osc.Out.messages(score)
[]

play(client, score, opts \\ [])

@spec play(TuningFork.Osc.Client.t(), TuningFork.Score.t(), keyword()) ::
  {:ok, t()} | {:error, term()}

Play score through client, sending one message per note when its moment arrives.

The player stops when the calling process exits.

Options

  • :address — what to send each note to, default "/play"
  • :shape — a function from a TuningFork.Voice and its length in seconds to the argument list. Default is [freq, gain, seconds, pan], all floats
  • :loop — start again on reaching the end, default false
  • :hush — an address to send on stopping, default "/hush". nil sends nothing

stop(player)

@spec stop(t()) :: :ok

Stop, sending the :hush address first.