![]() |
VOOZH | about |
dotnet add package NetCoreAudio --version 2.0.1
NuGet\Install-Package NetCoreAudio -Version 2.0.1
<PackageReference Include="NetCoreAudio" Version="2.0.1" />
<PackageVersion Include="NetCoreAudio" Version="2.0.1" />Directory.Packages.props
<PackageReference Include="NetCoreAudio" />Project file
paket add NetCoreAudio --version 2.0.1
#r "nuget: NetCoreAudio, 2.0.1"
#:package NetCoreAudio@2.0.1
#addin nuget:?package=NetCoreAudio&version=2.0.1Install as a Cake Addin
#tool nuget:?package=NetCoreAudio&version=2.0.1Install as a Cake Tool
The library allows playback of audio files on .NET on any supported operating system (Windows, macOS, Linux) and any CPU architecture (AMD, ARM, etc.) with minimal dependencies.
The library can be downloaded and installed like any other NuGet package. On Windows, there are no further prerequisites, as it depends entirely on OS components for its functionality. On other operating systems, however, additional utilities may have to be installed before the library can fully function.
On Mac, the library depends on afplay for its audio playback functionality, which should already be included in the operating system.
However, for audio recording functionality, we need to install the ffmpeg tool.
Linux implementation depends on ALSA architecture. Therefore, the machine needs to have the following utilities installed, which may or may not be included in the distro:
In addition to this, we need mpg123 to be able to play MP3 files on Linux.
The library can play and record audio. It will automatically detect which OS it's running on and will activate the components specific to this OS.
Below is the description of its public API:
For audio playback, the library exposes the Player class for audio playback, which detects the OS the library is running on and abstracts away any OS-specific audio playback implementations.
The class contains the following properties:
bool Playing: Indicates that the audio is currently playing.bool Paused: Indicates that the audio playback is currently paused.It also has the following methods:
Task Play(string fileName): Will stop any current playback and will start playing the specified audio file. The fileName parameter can be an absolute path or a path relative to the directory where the library is located. Sets the Playing flag to true. Sets the Paused flag to false.Task Pause(): Pauses any ongoing playback. Sets Paused flag to true. Doesn't modify the Playing flag.Task Resume(): Resumes any paused playback. Sets the Paused flag to false. Doesn't modify the Playing flag.Task Stop(): Stops any current playback and clears the buffer. Sets the Playing and Paused flags to false. Stopped playback cannot be resumed. If the same file needs to be played again, it can only be played from the beginning.Task SetVolume(): Sets the playing volume as percentage.The class also has the following event handler:
EventHandler PlaybackFinished: Internally, sets the Playing flag to false. Additional handlers can be attached to it to handle any custom logic.For audio recording, we use the Recorder class. The class contains the following properties:
bool Recording: Indicates that the audio is currently being recorded.
Task Record(string fileName): Begins the recording into the specified audio file.
Task Stop(): Stops the recording ans saves the data into the file specified previously.
If you want to support me and my work, you can do so via this page.
If you want my help integrating this library with your software or making any bespoke changes to it to meet your needs, you can book my time via this page.
For any other queries, you can get in touch with me via LinkedIn.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net5.0 net5.0 was computed. net5.0-windows net5.0-windows was computed. net6.0 net6.0 was computed. net6.0-android net6.0-android was computed. net6.0-ios net6.0-ios was computed. net6.0-maccatalyst net6.0-maccatalyst was computed. net6.0-macos net6.0-macos was computed. net6.0-tvos net6.0-tvos was computed. net6.0-windows net6.0-windows was computed. net7.0 net7.0 was computed. net7.0-android net7.0-android was computed. net7.0-ios net7.0-ios was computed. net7.0-maccatalyst net7.0-maccatalyst was computed. net7.0-macos net7.0-macos was computed. net7.0-tvos net7.0-tvos was computed. net7.0-windows net7.0-windows was computed. net8.0 net8.0 was computed. net8.0-android net8.0-android was computed. net8.0-browser net8.0-browser was computed. net8.0-ios net8.0-ios was computed. net8.0-maccatalyst net8.0-maccatalyst was computed. net8.0-macos net8.0-macos was computed. net8.0-tvos net8.0-tvos was computed. net8.0-windows net8.0-windows was computed. net9.0 net9.0 was computed. net9.0-android net9.0-android was computed. net9.0-browser net9.0-browser was computed. net9.0-ios net9.0-ios was computed. net9.0-maccatalyst net9.0-maccatalyst was computed. net9.0-macos net9.0-macos was computed. net9.0-tvos net9.0-tvos was computed. net9.0-windows net9.0-windows was computed. net10.0 net10.0 was computed. net10.0-android net10.0-android was computed. net10.0-browser net10.0-browser was computed. net10.0-ios net10.0-ios was computed. net10.0-maccatalyst net10.0-maccatalyst was computed. net10.0-macos net10.0-macos was computed. net10.0-tvos net10.0-tvos was computed. net10.0-windows net10.0-windows was computed. |
| .NET Core | netcoreapp3.0 netcoreapp3.0 was computed. netcoreapp3.1 netcoreapp3.1 was computed. |
| .NET Standard | netstandard2.1 netstandard2.1 is compatible. |
| MonoAndroid | monoandroid monoandroid was computed. |
| MonoMac | monomac monomac was computed. |
| MonoTouch | monotouch monotouch was computed. |
| Tizen | tizen60 tizen60 was computed. |
| Xamarin.iOS | xamarinios xamarinios was computed. |
| Xamarin.Mac | xamarinmac xamarinmac was computed. |
| Xamarin.TVOS | xamarintvos xamarintvos was computed. |
| Xamarin.WatchOS | xamarinwatchos xamarinwatchos was computed. |
Showing the top 5 NuGet packages that depend on NetCoreAudio:
| Package | Downloads |
|---|---|
|
Aximo.Engine
Do not use reference this package directly. Use this meta package: https://www.nuget.org/packages/Aximo Aximo Game Engine is an Open Source Game Engine written purly in C#. Documentation: https://www.aximo.games Source: https://github.com/AximoGames/AxEngine |
|
|
hUD.Kit.Math
Package Description |
|
|
BagheeraTranscriber
Package Description |
|
|
AvaloniaXT
Package Description |
|
|
Bagheera.Transcriber
Package Description |
Showing the top 4 popular GitHub repositories that depend on NetCoreAudio:
| Repository | Stars |
|---|---|
|
Particle1904/DatasetHelpers
Dataset Helper program to automatically select, re scale and tag Datasets (composed of image and text) for Machine Learning training.
|
|
|
maker-community/ElectronBot.DotNet
一个为ElectronBot机器人和瀚文键盘(HelloWorldKeyboard)开发的上位机软件(包含机器人USB操作SDK和瀚文键盘HID操作SDK),采用Windows App SDK框架编写界面。 A host computer software developed for ElectronBot robots (including robot USB operation SDK), using the Windows App SDK framework to write UI.
|
|
| microsoft/conversational-speaker | |
|
csharpfritz/Fritz.StreamTools
Handy tools for managing my live stream, built with ASP.NET Core
|