Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create a fast and reusable sound engine #62

Open
Dawoodoz opened this issue Apr 20, 2023 · 2 comments
Open

Create a fast and reusable sound engine #62

Dawoodoz opened this issue Apr 20, 2023 · 2 comments
Labels
enhancement New feature or request Performance

Comments

@Dawoodoz
Copy link
Owner

Fast
SIMD vectorized playback of sounds without interpolation. Changing volume should be optional to save performance. Having the same volume on all channels should only multiply once.

Efficient
The backends should stop requesting samples when there are no sounds to play, so that it can be used for basic click sounds in an otherwise silent application. Future operating-systems might have a significant delay for initializing playback, but closing and restarting when needed would be the simplest solution to re-implement, making sure that all implementations support this feature just by cleaning up resources. One can also make a setting to run the sound engine without interrupting on silence, to get lower latency for applications that run sounds almost constantly.

Standardizing
The sound engine should try to standardize basic types and methods for storing and converting sounds, which can be in a separate sound core API, not listed in the framework subset, without adding dependencies to sound backends when only used to process sound for conversion tools. This allow sound encoders and decoders for different file formats to be reused across different sound engines. First define how to load into a lossless integer sound buffer, then use standard conversion functions to convert between different sound formats.

Non-imposing
Custom sound engines should be free not to use the SDK's example sound engine, add their own sound formats for import or in-memory compression, have their own pipeline design for distorting effects, and do their own sound mixing for different usecases and optimizations.

@Dawoodoz Dawoodoz added enhancement New feature or request Performance labels Apr 20, 2023
@Dawoodoz Dawoodoz added this to the First stable release milestone Apr 23, 2023
@Dawoodoz
Copy link
Owner Author

Dawoodoz commented Jun 8, 2023

The new F32xF SIMD vector will allow sound engines to take advantage of 256-bit SIMD from AVX when present and fall back on 128-bit SIMD when not available. Then older low-end laptops will have fast sound to afford many sounds playing at the same time.

@Dawoodoz
Copy link
Owner Author

Having 3D surround sound might require fetching the speaker configuration from the system to automatically use surround sound when available. More system dependencies should be optional to integrate, by defaulting on stereo if featching a speaker setup is not implemented. A list with some standard speaker placements should allow getting surround sound even if the system won't give the default setup or if the user can't find the settings.

Just mono and stereo is probably fine for a first version, as long as 3D sounds can be added later without breaking the design. Maybe one API for sound buffers, a simple API for 2D and another for 3D with listeners and effects.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request Performance
Projects
None yet
Development

No branches or pull requests

1 participant