load_asample(3)
π 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
resourcebacked 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..1range. 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 to2.load_asample( int:channels=2, int:rate=48000, tblfloat:values )β channels default to2and rate defaults to48000.
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 π«Ά
play_audio(3)β go actually play the thing, bestie.
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
- nixos 26.05: arcan 0.7.1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms