Comments (5)
I did own research and I found following libraries/solutions:
- BASS.NET - .NET wrapper (P/Invoke) for multiplatform un4seen BASS audio library
- ManagedBass - also wrapper for BASS audio library, but with non restrictive license as BASS.NET. Additionally all P/Invoke part is in PCL library.
- OpenAL and OpenTK - OpenAL is a cross-platform 3D audio API appropriate for use with gaming applications and many other types of audio applications. OpenTK is a C# wrapper for OpenAL and OpenGL.
- Gstreamer# - I found this probably on stack overflow. Looks outdated. Looks like P/Invoke bindings to gstreamer library. Banshee is a open source application which uses gstreamer under the hood.
- Vorbis# - OggVorbis decoder written purely in C#. Not an audio library, but can be used with
System.Media.SoundPlayer
to play ogg files. - PortAudioSharp - .NET bindings (P/Invoke) for the cross-platform low-latency audio library PortAudio.
- irrKlang - high level 2D and 3D cross platform (Windows, Mac OS X, Linux) sound engine and audio library.
Here's stack overflow question with some of this libraries mentioned: http://stackoverflow.com/questions/35896/how-can-i-play-compressed-sound-files-in-c-sharp-in-a-portable-way
I tested only BASS.NET and ManagedBass and they are working with .NET Core on Mono.
Most of these C# libraries are only P/Invoke bindings to some multiplatform C library. I like ManagedBass because it has PCL library which is .NET Core compatible (DNX and DNX Core environments). BASS.NET (and probably other mentioned libraries) have only full .NET version, so I can run it only with #if DNX451
switches and only in Mono runtime. With PCL ManagedBass I have code without #if DNX451
switches which compiles properly for DNX and DNX Core version.
But there is one issue in DNX Core, from which reason I can run ManagedBass only on Mono. This issue is related with name of P/Invoked library. Binding in PCL library looks like that:
[DllImport("bass", EntryPoint = "BASS_Start")]
public static extern bool Start();
and because this is a PCL, then name of library in a code must be same for all platforms. But library name in various platforms is different, e.g. "libbass.so" in Linux and "bass.dll" in Windows.
Mono has automatic library mapping mechanism described here (there is also manual mechanism described here).
Is there similar mechanism in DNX Core runtime or do you have plans for adding it?
from core.
Hey @czesiu it's an interesting question and I have to admit that I don't know the answer, but I did a bit of hunting to find out, and I suspect that answer is "no for now, probably in future". Though I'd also suspect that even the "no" might be supported by a third party somewhere.
If you look at the stack overflow answers for "how do I play sound with C#" you see people talking about the System.Media namespace:
- http://stackoverflow.com/questions/5756855/c-sharp-play-sound-with-one-line-of-c-sharp-code
- http://stackoverflow.com/questions/3502311/how-to-play-a-sound-in-c-net
- https://msdn.microsoft.com/en-us/library/System.Media.SystemSounds(v=vs.110).aspx
and if you go into the dotnet API reference you see that system.media isn't there yet:
If you search the dotnet forums for Audio - you get a couple leads in terms of third party products that might be worth looking at in more detail: https://github.com/reignstudios/ReignSDK
And you can also look towards UNITY (perhaps)
If I start to dig around a bit more, things start to get hazier. Sorry I can't be more help. It's an interesting question.
from core.
Right now, there's no "high-level" API for audio playback. If you are adventurous, you can try things like OpenTK, which expose lower-level OpenAL functionality. This will be much more difficult than something ready-to-go like System.Media.SoundPlayer, but will be cross-platform and much more flexible.
Disclaimer: I've never tried to use the OpenAL functionality of OpenTK on .NET Core. I've only used the graphics portions of the library.
from core.
Do you have plans for adding DllMap (automatic or/and manual) mechanism in CoreCLR?
from core.
@czesiu Maybe ask in a new issue.
from core.
Related Issues (20)
- Release notes link broken HOT 1
- When is the .net pace of change going to slow down, or the length of time to support a given .net version going to increase? HOT 4
- بروزرسانی فایلها
- .Net on embedded platform HOT 1
- > where.exe dotnet C:\Program Files (x86)\dotnet\dotnet.exe C:\Program Files\dotnet\dotnet.exe HOT 1
- Failed to publish WASM client project for Linux
- .NET April 2024 Update - .NET 8.0.4, NET 7.0.18, .NET 6.0.29 HOT 5
- Getting Failed to fetch https://packages.microsoft.com/repos/edge/dists/stable for the last few hours HOT 2
- Is there an API to get the latest preview .NET SDK version HOT 7
- Failed to fetch https://packages.microsoft.com/repos/edge/dists/stable/main/binary-amd64/Packages.gz File has unexpected size HOT 1
- Package installation instructions are stale and need to be updated HOT 3
- Fedora 38 reaches end of life on 14 May 2024
- Add support for Alpine 3.20 HOT 1
- BEARSMITH8G HOT 1
- import speech_recognition as sr # Initialize the recognizer r = sr.Recognizer() # Function to convert speech to text def speech_to_text(): with sr.Microphone() as source: print("Please start speaking:") audio = r.listen(source) try: text = r.recognize_google(audio) return text except sr.UnknownValueError: return "Sorry, I could not understand what you said" except sr.RequestError: return "Sorry, my speech recognition service is currently down" # Main function if __name__ == "__main__": text = speech_to_text() print("You said: " + text)
- AAAAAAAAAAAAAAAA HOT 2
- We are pleased to announce the release of .NET 9 Preview 3. HOT 1
- .NET May 2024 Update - .NET 8.0.5, NET 7.0.19, .NET 6.0.30 HOT 13
- https://docs.synthesized.io/sdk/latest
- Golden Skulls over a dark background. Dead by Daylight's Year 8 Anniversary livestream is live now on Twitch and Youtube.https://docs.synthesized.io/sdk/latestc43a66cff7a403d56c5c5e1ff10d3d5f95961abf80f97f0e35380594909f0e4d HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from core.