naudio / NAudio

Audio and MIDI library for .NET
MIT License
5.5k stars 1.1k forks source link

NAudio Cross Platform Support with Linux & Mac #1077

Open Kuumba123 opened 1 year ago

Kuumba123 commented 1 year ago

Is NAudio cross platform with Linux & Mac . I remember seeing some github issue for this repro a little while ago saying that anything in NAudio.Core (via the nugget package) is cross platform. However I time I try to use anything in that namespace my linux app just crashes and I haven't found any examlpes online when it comes to NAudio working on any other platforms aside windows , is it really cross platform ? Im not trying to do anything advanced quite just yet , I mainly just wanna play raw sample data and some basic volume controls. Any help would be appricated :)

smay4finger commented 12 months ago

However I time I try to use anything in that namespace my linux app just crashes

Is there more information available then "just crashes"?

I would also be interested in a solution for Linux.

Kuumba123 commented 12 months ago

@smay4finger sorry guess I should have posted that first . All my code does is get the list of devices from the NAudio.Wave.DirectSound.Devices (using the NAudio.Core nugget package) :

        var devices = NAudio.Wave.DirectSoundOut.Devices;

This is the error message Im getting: Unhandled exception. System.DllNotFoundException: Unable to load shared library 'dsound.dll' or one of its dependencies. In order to help diagnose loading problems, consider using a tool like strace. If you're using glibc, consider setting the LD_DEBUG environment variable

moorehousew commented 10 months ago

Late reply but @Kuumba123 DirectSound is a Windows-only API. You might have some luck running your .NET application (compiled for Windows) under Wine, otherwise it's not available on *nix.

markheath commented 10 months ago

Yes, it was a mistake to leave DirectSound in the NAudio.Core assembly. It should be moved out. I am in discussions with someone who has offered to contribute a Linux IWavePlayer implementation which would be a great addition to NAudio.

lujiaxing commented 8 months ago

Yes, it was a mistake to leave DirectSound in the NAudio.Core assembly. It should be moved out. I am in discussions with someone who has offered to contribute a Linux IWavePlayer implementation which would be a great addition to NAudio.

How is it going?

markheath commented 8 months ago

I believe the code has been created, but am still waiting for the pull request

DashNY commented 7 months ago

+1. Would love to run it on my SBC (e.g. Raspberry Pi, Odroid N2+) and play sounds / capture microphone or line input. Is there any update on the issue? Thanks.

markheath commented 7 months ago

no update I'm afraid

E-Hain commented 3 months ago

There seem to be quite a few people interested in a Linux compatible Naudio, myself included... any progress?

Kuumba123 commented 3 months ago

Havent had a chance to do any testing latly but last time it didnt work . From what I can tell atleast we havent really got the cross platform support features that I oringally opened this issue for.

vchelaru commented 2 months ago

I am also interested in this feature. For context, I develop games using MonoGame and these natively run on Windows, Mac, and Linux. I've been using NAudio to supplement the missing Song functionality in MonoGame.

I'm interested in the general philosophy regarding cross platform versions of NAudio beyond desktop platforms. Is there any possibility of supporting it on mobile (iOS and Android) or blazor for web apps?

PlatinumLucario commented 2 months ago

I've also opened a discussion about adding an AlsaOut(), when a NAudio.Alsa namespace is made. https://github.com/naudio/NAudio/discussions/1134