C++ audio mixing library design
lisyarus.github.io
C++ audio mixing library design
1–10 of 54 posts
Re: C++ audio mixing library design
#2Re: C++ audio mixing library design
#3Re: C++ audio mixing library design
#4Very nice article, however in 2022, why using C arrays as parameters in C++ code, when std::span, std::vector exist?
Re: C++ audio mixing library design
#5Very nice article, however in 2022, why using C arrays as parameters in C++ code, when std::span, std::vector exist?
SDL takes array pointers as arguments for its audio output functions in general, so I would assume they were coding against the SDL Audio API.
void engine::callback(std::span output)
{
std::size_t samples = 0;
if (stream_)
{
samples = stream_->read(output.data(), output.size());
if (samples == 0) stream_ = nullptr;
}
auto remaining = output.subspan(samples);
std::fill(remaining.begin(), remaining.end(), 0.f);
}Re: C++ audio mixing library design
#6How about Rust audio (https://github.com/RustAudio) and then FFI?
I am developing the audio lib for the music live coding language I design in Rust and I think the experience of Rust is really good, because of `cargo` (the package management), the community, the syntax and compiler, the ergonomics, and so on. For one of my usages, the audio lib in Rust compiles to wasm and runs in browsers smoothly. I can also write VST plugins with the same audio library in Rust:
https://github.com/chaosprint/glicol
There are also many other Rust audio libs such as dasp, fundsp and hexosynth, all worth checking out. Before I became addicted to Rust audio, I had checked some C++ audio project, such as the Maximillian lib especially the JS bindings, the source code of SuperCollider and the JUCE for VST. But apparently I have made my decision for the reasons abovementioned.
Re: C++ audio mixing library design
#7Re: C++ audio mixing library design
#8I wonder if, in retrospect, the decision to use floats was a good one. The author mentioned issues with the time of each sample for the sine wave, which were float-related. I get that audio effects (compresser, reverb etc) are probably easier using floats but I don't immediately see why it's better to have float as the core data structure and convert to int at the end rather than having int as the core and convert to…
Re: C++ audio mixing library design
#9"All my engine is in C++, and I’m really sick of SDL_DoThatThing(&options, pointer_to_void, size_in_magical_units, &callback, user_data, legacy_value) (sorry for all C admirers, I do respect you, it’s just that I’m not one of you)." How about Rust audio ( https://github.com/RustAudio ) and then FFI? I am developing the audio lib for the music live coding language I design in Rust and I think the experience of Rust is…
Re: C++ audio mixing library design
#10I wonder if, in retrospect, the decision to use floats was a good one. The author mentioned issues with the time of each sample for the sine wave, which were float-related. I get that audio effects (compresser, reverb etc) are probably easier using floats but I don't immediately see why it's better to have float as the core data structure and convert to int at the end rather than having int as the core and convert to…