load_asample(3)

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

πŸ’– load_asample(3) β€” preload an audio sample for later/repeated playback πŸ’–

okay bestie, welcome to the Arcan Lua API page for load_asample. this is the one where you prep a short little audio moment so you can trigger it again and again. iconic behavior only. ✨


🌸 NAME 🌸

load_asample β€” preload an audio sample for later/repeated playback.

like… prep the sound now, spam it later. no cap. πŸŽ€


πŸ¦‹ SYNOPSIS πŸ¦‹

aid
load_asample( string:resource, number:gain )
load_asample( int:channels=2, tblfloat:values )
load_asample( int:channels=2, int:rate=48000, tblfloat:values )

✨ DESCRIPTION ✨

okay so this function is used to create short audio samples that can be triggered repeatedly β€” very sound-effects-and-audio-feedback-to-user-events coded. πŸ’…

there are two forms to this function, bestie:

  • the first one is where you point at a resource backed by a RIFF / WAV file, and the format defines the parameters.
  • the other is for a caller-supplied buffer of normalised, interleaved float values in the -1..1 range. yes, that range specifically. don’t get cute with it. 🫢

and for the buffer version, the synopsis is giving you two little layouts:

  • load_asample( int:channels=2, tblfloat:values ) β€” channels default to 2.
  • load_asample( int:channels=2, int:rate=48000, tblfloat:values ) β€” channels default to 2 and rate defaults to 48000.

the resource form takes a string:resource and a number:gain. the whole thing hands you back an aid. main character return value. πŸ‘‘


πŸ”₯ EXAMPLE πŸ”₯

function load_asample0()
      aid = load_asample("test.wav", 0.5);
      play_audio(aid);
end

literally load test.wav with gain 0.5, then play_audio(aid). slay. 🎧


🫢 SEE ALSO 🫢


later bestie πŸ’– this page is from the audio section, dated October 2026, and it’s serving load_asample(3) realness. periodt. βœ¨πŸ‘‘

πŸ“¦ where this page comes from