class Raudio::Wave

Overview

Wave represents raw audio data Use this for loading and manipulating audio waveforms

Defined in:

raudio/wave.cr

Constructors

Class Method Summary

Instance Method Summary

Constructor Detail

def self.load(filename : String | Path) : self #

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


[View source]
def self.load_from_memory(file_type : String, data : Bytes) : self #

Load wave from memory buffer


[View source]

Class Method Detail

def self.load(filename : String | Path, &) #

[View source]
def self.ready?(handle : LibRaudio::Wave) : Bool #

Check if wave data is ready


[View source]
def self.unload_samples(samples : Slice(Float32)) #

Unload wave samples data Only call this on samples returned by #load_samples


[View source]

Instance Method Detail

def channels : UInt32 #

Number of channels


[View source]
def close #

[View source]
def copy : Wave #

Copy wave data


[View source]
def crop(init_sample : Int32, final_sample : Int32) #

Crop wave data to specified samples range


[View source]
def export(filename : String) : Bool #

Export wave data to file


[View source]
def export_as_code(filename : String) : Bool #

Export wave data as code (.h)


[View source]
def finalize #

[View source]
def format(sample_rate : Int32, sample_size : Int32, channels : Int32) #

Convert wave data to desired format


[View source]
def frame_count : UInt32 #

Frame count


[View source]
def load_samples : Slice(Float32) #

Load wave samples as a floats array Returns a Slice of Float32 containing the sample data Note: You must manually call .unload_samples on the returned pointer when done


[View source]
def ready? : Bool #

Check if this wave is ready


[View source]
def release #

[View source]
def released? : Bool #

[View source]
def sample_rate : UInt32 #

Sample rate


[View source]
def sample_size : UInt32 #

Sample size (bit depth)


[View source]
def to_unsafe : Raudio::LibRaudio::Wave #

Get the underlying C struct


[View source]