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)
= "../../../testfiles/gs-16b-2c-44100hz.flac"
fpath = HDataType$Float32
dtype = HFile$decode(fpath, dtype)
hdecodedaudio $harray() hdecodedaudio
sr
sr() -> integer
source
Get the sampling rate of the decoded audio.
Returns
An integer.
Examples
library(harmonium)
= "../../../testfiles/gs-16b-2c-44100hz.flac"
fpath = HDataType$Float32
dtype = HFile$decode(fpath, dtype)
hdecodedaudio $sr() hdecodedaudio
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)
= "../../../testfiles/gs-16b-2c-44100hz.flac"
fpath = HDataType$Float32
dtype = HFile$decode(fpath, dtype)
hdecodedaudio = hdecodedaudio$harray() # now the inner HArray struct has 2 references.
harray $invalidate() # back to 1 reference. hdecodedaudio