Skip to content

nexus_audio_util

audio · scripts/audio/nexus_audio_util.m

NEXUS_AUDIO_UTIL  Shared audio plumbing for audioplayer, audiorecorder & friends.

  Audio devices are reached through the Java Sound API of the bundled Java
  runtime (javax.sound.sampled), so no extra native audio library has to be
  shipped.  When Java Sound or an audio device is not available (a headless
  server, a container, a missing system sound library) every operation that
  needs a device raises an ordinary Nexus error; nothing blocks.

  Internal operations (not a public interface):
    L = nexus_audio_util ('devices', IO, CALLER)   IO: 0 output, 1 input
    mix = nexus_audio_util ('mixer', IO, ID, CALLER)
    fmt = nexus_audio_util ('format', FS, NBITS, NCH)
    B = nexus_audio_util ('encode', Y, NBITS)      samples -> int8 bytes
    [Y, N] = nexus_audio_util ('decode', B, NBITS, NCH, TYPE)
    [Y, FS, NBITS] = nexus_audio_util ('prepare', Y, FS, NBITS, CALLER)
    nexus_audio_util ('callback', FCN, OBJ)