Module audio

interact with the audio system

Functions

go (delay, func, args) Add a coroutine to the audio scheduler
cancel (co) Cancel a scheduled coroutine
wait (t) Suspend a coroutine for a period or until an event occurs
now () Return the current scheduler time Returns seconds since the scheduler started
event (name) Resume coroutines pending on an event name
latency (seconds) Set the audio input/output latency The actual latency may be slightly higher, due to driver implementation and block size
play (content, duration) Play a function or audio_buffer.


Functions

go (delay, func, args)
Add a coroutine to the audio scheduler

Parameters:

  • delay (Optional) delay in seconds before starting the coroutine
  • func The function to run as a coroutine
  • args Zero or more arguments to pass to the function

Returns:

    The coroutine created (which can be used by audio.cancel())
cancel (co)
Cancel a scheduled coroutine

Parameters:

  • co The coroutine to cancel
wait (t)
Suspend a coroutine for a period or until an event occurs

Parameters:

  • t A period (in seconds) or an event name (string) to wait for
now ()
Return the current scheduler time Returns seconds since the scheduler started
event (name)
Resume coroutines pending on an event name

Parameters:

  • name The event name (string) to resume
latency (seconds)
Set the audio input/output latency The actual latency may be slightly higher, due to driver implementation and block size

Parameters:

  • seconds The intended latency in seconds
play (content, duration)
Play a function or audio_buffer.

Parameters:

  • content The buffer or function to play
  • duration seconds to play
generated by LDoc 1.3.12