Miniaudio.Net 0.1.0

dotnet add package Miniaudio.Net --version 0.1.0
                    
NuGet\Install-Package Miniaudio.Net -Version 0.1.0
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Miniaudio.Net" Version="0.1.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Miniaudio.Net" Version="0.1.0" />
                    
Directory.Packages.props
<PackageReference Include="Miniaudio.Net" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Miniaudio.Net --version 0.1.0
                    
#r "nuget: Miniaudio.Net, 0.1.0"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Miniaudio.Net@0.1.0
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Miniaudio.Net&version=0.1.0
                    
Install as a Cake Addin
#tool nuget:?package=Miniaudio.Net&version=0.1.0
                    
Install as a Cake Tool

miniaudioNet

NuGet NuGet Downloads CI License: MIT

miniaudioNetは、C言語で書かれたオーディオライブラリであるminiaudioを.NETから安全に扱うためのラッパーライブラリです。

Windows、Linux、macOS(x64/ARM64)に対応しており、NuGetパッケージにはすべてのプラットフォーム向けのネイティブバイナリが含まれています。

インストール

NuGet パッケージマネージャー

Install-Package Miniaudio.Net

.NET CLI

dotnet add package Miniaudio.Net

PackageReference

<PackageReference Include="Miniaudio.Net" Version="0.1.0" />

クイックスタート

using Miniaudio.Net;

// オーディオファイルを再生
using var context = new MiniaudioContext();
using var sound = context.CreateSound("path/to/audio.mp3");

sound.Start();

Console.WriteLine("再生中... Enterキーで終了");
Console.ReadLine();

対応プラットフォーム

プラットフォーム アーキテクチャ
Windows x64, ARM64
Linux x64, ARM64
macOS x64, ARM64

開発状況

注意: 現状はCodexまかせで開発されています。

ディレクトリ構成

miniaudioNet/
├── native/                     # CMake ベースのネイティブブリッジ (miniaudionet)
│   ├── CMakeLists.txt          # ma_engine / ma_sound を DLL/SO/DYLIB 化
│   └── CMakePresets.json       # 各 OS / RID 向けのビルドプリセット
├── scripts/                    # ネイティブ資産を出力する補助スクリプト
├── src/Miniaudio.Net/          # .NET 8.0 ラッパー (NuGet パッケージ本体)
├── samples/MiniaudioNet.Sample # 簡単な再生コンソールアプリ
└── third_party/miniaudio/      # 付属 miniaudio ヘッダー

必要条件

  • CMake 3.21 以上
  • C/C++ コンパイラ (MSVC, clang, gcc など)
  • .NET SDK 8.0 以上
  • PowerShell 7

ネイティブバイナリの取得

GitHub Actions (.github/workflows/ci.yml) では Windows / Linux / macOS 各 RID 向けに miniaudionet をビルドし、成果物を NuGet パッケージへ自動投入します。ローカルでも同じ出力を得たい場合は次のスクリプトを利用してください。

PowerShell (Windows)

pwsh ./scripts/build-native.ps1 -Rid win-x64   # 例: Windows x64 版
pwsh ./scripts/build-native.ps1 -Rid win-arm64 # ARM64 版も同じコマンドで生成

Bash (Linux / macOS)

./scripts/build-native.sh --rid linux-x64
./scripts/build-native.sh --rid osx-arm64

各コマンドは CMakePresets を介して build/native/<preset>/ にビルドし、artifacts/native/<RID>/native/ に DLL/SO/DYLIB を配置します。.csproj はこのディレクトリを検出して runtimes/<RID>/native/ として NuGet へ自動梱包し、同時に bin/<Configuration>/<TFM>/runtimes/... にコピーします。アプリ側ではパッケージを参照するだけでネイティブライブラリが解決されます。

ラッパーとサンプルのビルド

# ソリューション全体
dotnet build miniaudioNet.sln -c Release

# パッケージのみを Release で生成
dotnet pack src/Miniaudio.Net/Miniaudio.Net.csproj -c Release

dotnet packartifacts/native/** の内容を自動で取り込み、artifacts/packages/.nupkg.snupkg を出力します。生成されたパッケージをローカルフィードに追加すれば、.NET プロジェクトへ参照するだけで Windows / macOS / Linux のいずれでも即動作します。

サンプルの実行:

dotnet run --project samples/MiniaudioNet.Sample -- <audio-file>

ストリーミング API の動作確認には次のコンソールアプリを利用できます。

dotnet run --project samples/MiniaudioNet.Sample.Streaming -- [frequency-hz] [duration-seconds]

GitHub Actions ワークフロー概要

  1. 行列 (win-x64, win-arm64, linux-x64, linux-arm64, osx-x64, osx-arm64) でネイティブブリッジをビルド。
  2. 各 RID の成果物をアップロード。
  3. 収集済みのバイナリを使って dotnet build / dotnet pack を実行し、NuGet パッケージを生成。
Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • net8.0

    • No dependencies.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
0.1.0 294 12/16/2025