HDecodedAudio
An audio represented by an HArray of samples and its corresponding sampling rate.
Methods
harray
harray() -> HArray source
Get the decoded HArray.
Returns
A float HArray.
Examples
library(harmonium)
fpath = "../../../testfiles/gs-16b-2c-44100hz.flac"
dtype = HDataType$Float32
hdecodedaudio = HFile$decode(fpath, dtype)
hdecodedaudio$harray()sr
sr() -> integer source
Get the sampling rate of the decoded audio.
Returns
An integer.
Examples
library(harmonium)
fpath = "../../../testfiles/gs-16b-2c-44100hz.flac"
dtype = HDataType$Float32
hdecodedaudio = HFile$decode(fpath, dtype)
hdecodedaudio$sr()invalidate
invalidate() source
Replaces the inner value of the external pointer, invalidating it.
This function is useful to remove one of the shared references of the inner pointer in rust.
Examples
library(harmonium)
fpath = "../../../testfiles/gs-16b-2c-44100hz.flac"
dtype = HDataType$Float32
hdecodedaudio = HFile$decode(fpath, dtype)
harray = hdecodedaudio$harray() # now the inner HArray struct has 2 references.
hdecodedaudio$invalidate() # back to 1 reference.