Examples of low level control (synthesis) of audio ? - speakers, HDMI audio
solidstate1991
laszloszeremi at outlook.com
Mon Aug 26 19:45:49 UTC 2024
On Thursday, 22 August 2024 at 16:56:05 UTC, Stephen Tashiro
wrote:
> Are there good explanations or examples of code for low level
> control of audio in Dlang?
>
> I assume that all high level audio synthesis programs (music,
> speech synthesis, etc.) rely on some common method of outputing
> sound. I also assume the output to analog speakers must be
> different code than output over HDMI. Is that correct?
>
> I visualize the final output as data that stores a waveform as
> a sequence of values that represent amplitudes. Is that low
> level of representation necessary? - or do modern speakers and
> audio devices have built-in programs that accept more concise
> formats?
https://code.dlang.org/packages/iota
It's a bit janky and preliminary library ATM, but you can get an
audio stream for both Linux and Windows. Only caveat is you need
to have the audio thread in a `@nogc` thread, which is pretty
much expected with real-time applications. It has a few
testcases, but also my game engine uses it for its software
synths.
Besides of audio, it also can do windowing, input, OpenGL
initialization, etc.
More information about the Digitalmars-d
mailing list