needed-libraries icon indicating copy to clipboard operation
needed-libraries copied to clipboard

Pure Nim sound mixer

Open Keithcat1 opened this issue 4 years ago • 6 comments

I can't find any libraries for playing sound, panning and changing volume and things like that without shipping extra DLLs with my app. I'd be happy if there was a simple library that could: Load sounds from a file or from bytes. Play, pan, loop and change the volume of sounds and stop them from playing, maybe with a sound type. It'd also be nice if the library had control of which device output the audio. Thanks!

Keithcat1 avatar Sep 17 '19 14:09 Keithcat1

Doesn't SDL allow for this? You can link statically against SDL but it's some work.

Araq avatar Sep 18 '19 09:09 Araq

Hi, Sorry, I'm not much good with C, most of my experience is with Cython, and I've never wrapped a C library. Would there be a SDL wrapper that links statically? Thanks!

Keithcat1 avatar Sep 18 '19 14:09 Keithcat1

I am not sure what you mean by "pure". Usually that means does not rely on any non-nim libraries. I don't think there is a pure nim sound library.

But I do have an openAL wrapper: https://github.com/treeform/openal OpenAL has been used by many games in the past - its not as popular now, but I feel it's a solid choice.

I also have a higher level nim wrapper on top of openAL: https://github.com/treeform/euphony thats much easier to use.

Maybe those can help you?

Note: SDL has been already wrapped: https://github.com/nim-lang/sdl2 You can try that lib as well.

treeform avatar Sep 18 '19 19:09 treeform

Hi and thanks for the help. Your OpenAL library bindings look really nice, do they require DLLs? The SDL section under Windows says to do, and I'm currently using Windows. Would I still be able to use it? Thanks!

Keithcat1 avatar Sep 18 '19 20:09 Keithcat1

Yes, you would need to download and ship the openAl.dll right next to your exe. If you are on Windows that is really easy.

On Wed, Sep 18, 2019, 1:00 PM Keithcat1 [email protected] wrote:

Hi and thanks for the help. Your OpenAL library bindings look really nice, do they require DLLs? The SDL section under Windows says to do, and I'm currently using Windows. Would I still be able to use it? Thanks!

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/nim-lang/needed-libraries/issues/109?email_source=notifications&email_token=AAA6X7EFC6EVLZSDAIHCBW3QKKCHFA5CNFSM4IXQ7BT2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD7BIT2A#issuecomment-532842984, or mute the thread https://github.com/notifications/unsubscribe-auth/AAA6X7CSZ3LZZ5UOKH4NZE3QKKCHFANCNFSM4IXQ7BTQ .

treeform avatar Sep 18 '19 20:09 treeform

This might not help too much, but if you're looking for a starting off point, check into libsndfile and PortAudio. The former can provide audio format decoding (e.g. OGG, FLAC, WAV, no MP3 yet because of patents, but it's on it's way). And the later provides a cross platform audio API. They're both written in C (with libsndfile also having deps on other C libraries). For C#'s .NET ecosystem, I did leverage these two libraries to build a cross platform audio decoding & playback engine: https://gitlab.com/define-private-public/Bassoon

I have considered porting it to Nim, but I have other projects I want to work on at the moment.

define-private-public avatar Oct 01 '20 14:10 define-private-public