class

Raudio::Sound

Inherits Reference < Object

Sound represents a short audio clip loaded in memory Use this for sound effects and short audio samples

Constructors

alias(source : Sound) : self

Load sound alias (uses same sample data as original)

Source
from_wave(wave : Wave) : self

Load sound from wave data

Source
load(filename : String | Path) : self

Load sound from file Supported formats: WAV, OGG, MP3, FLAC, QOA

Source

Class methods

load(filename : String | Path, &)
Source
ready?(handle : LibRaudio::Sound) : Bool

Check if sound data is ready

Source

Instance methods

channels

Get number of channels

Source
close
Source
finalize

GC fallback

Source
frame_count

Get frame count

Source
pan=(pan : Float32)

Set pan for the sound (0.5 is center)

Source
pause

Pause the sound

Source
pitch=(pitch : Float32)

Set pitch for the sound (1.0 is base level)

Source
play

Play the sound

Source
playing?

Check if sound is currently playing

Source
ready?

Check if this sound is ready

Source
release
Source
released?
Source
resume

Resume the paused sound

Source
sample_rate

Get sample rate

Source
sample_size

Get sample size

Source
stop

Stop the sound

Source
to_unsafe

Get the underlying C struct

Source
unload_alias
Source
update(data : Pointer(Void), frame_count : Int32)

Update sound buffer with new data

Source
volume=(volume : Float32)

Set volume for the sound (1.0 is max level)

Source