pub fn decode<M: CMath>(input_stream: &[u8]) -> Vec<f32>Expand description
Decodes an encoded pulsejet sample into a newly-allocated buffer.
This function is optimized for size and designed to be compiled in a
size-constrained environment. In such environments, it’s common not
to have access to all of the required math functions, and instead
implement them by hand. For this reason, this decoder does not
depend on any such functions directly, and instead expects that
cos, exp2, sin, and sqrt functions are defined using a CMath
trait. Default implemention is provided through Std type.
pulsejet expects that these functions behave similarly
to the corresponding similarly-named cmath functions. This shim
mechanism can also be used to provide less accurate, speed-optimized
versions of these functions if desired.
Additionally, this function will not perform any error checking or handling. The included metadata API can be used for high-level error checking before decoding takes place if required (albeit not in a non-size-constrained environment).
§Returns
Decoded samples in the [-1, 1] range (normalized).