capture_audio(3)

πŸ“¦
version 0.7.1 Β· 2 versions
, in nixos 26.05

πŸ’– capture_audio(3) β€” the Arcan Lua API giveth a mic πŸ’–

okay so this is a page from the Arcan Lua API, and honestly? it's kind of a slay little function. let's get into it πŸŽ€


✨ NAME ✨

capture_audio β€” setup an audio device capture stream 🎀✨


🌸 SYNOPSIS 🌸

AID or NIL
capture_audio( devstr )

so yeah, you hand it a device string and you get back either an AID or NIL. that's the whole vibe check πŸ¦‹


πŸ’… DESCRIPTION πŸ’…

bestie, listen. capture_audio is the function you call when you want to map an external capture device β€” think a microphone, like a literal actual mic πŸŽ™οΈ β€” onto an AID. and what's an AID for? monitoring, bb. like forwarding it to a recordtarget, or to a frameserver that does audio processing for voice recognition and similar features. it's giving "your computer finally hears you" energy fr fr πŸ‘‘


🫢 NOTES 🫢

  1. okay so the device must be supported by the underlying sound support system β€” and it has to emit audio data that matches the compile-time defined format, e.g. 44100/16bit/2ch LE 16 samples. also it must match a valid entry as provided by list_audio_inputs. no cap, if it doesn't line up with one of those, it's not gonna work 😭

🧚 EXAMPLE 🧚

look at her go:

function capture_audio0()
      a = list_audio_inputs();
      b = capture_audio(a[1]);
end

you list the inputs, you grab the first one, you capture it. iconic. ate and left no crumbs πŸ’…βœ¨


πŸ’€ MISUSE πŸ’€

do not do this. i'm literally begging:

function capture_audio0()
      b = capture_audio(-1);
end

-1 is not a device string, bestie. this is the "why would you do that" section πŸ™ˆ


⭐ SEE ALSO ⭐

  • list_audio_inputs(3) β€” go check that one out, it's how you get the valid device entries in the first place πŸ‘€

heads up: that format thing in NOTES is a must, not a suggestion. if your device doesn't match the compile-time defined format and a valid list_audio_inputs entry, it's a no from the sound system 🌈

and that's the page!! πŸŽ€ written under the audio corner of the docs, with a date of October 2026 β€” see you in the group chat, mwah πŸ’–πŸ¦‹βœ¨

πŸ“¦ where this page comes from