BasicPitch 1.0.3

dotnet add package BasicPitch --version 1.0.3
                    
NuGet\Install-Package BasicPitch -Version 1.0.3
                    
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="BasicPitch" Version="1.0.3" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="BasicPitch" Version="1.0.3" />
                    
Directory.Packages.props
<PackageReference Include="BasicPitch" />
                    
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 BasicPitch --version 1.0.3
                    
#r "nuget: BasicPitch, 1.0.3"
                    
#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 BasicPitch@1.0.3
                    
#: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=BasicPitch&version=1.0.3
                    
Install as a Cake Addin
#tool nuget:?package=BasicPitch&version=1.0.3
                    
Install as a Cake Tool

The content in this document was translated by AI.

basic-pitch-dotnet

basic-pitch is a project by Spotify that converts audio into MIDI. It is developed in Python itself, and this project is its ported version to .net.

How to use

Introduce it using NuGet: https://www.nuget.org/packages/BasicPitch/

You can refer to the ToMidiSample project for how to use it at the code level.

Basic principles of technology

basic-pitch itself completes its work in 3 steps:

  1. Use the nmp model to infer the audio input.
  2. Use the postprocessing algorithm to process the output of the nmp model.
  3. Convert the data from the previous step into a MIDI file.

This project also follows this principle:

  1. Use the onnx model version of nmp in conjunction with Microsoft's Windows.AI.MachineLearning framework for inference.
  2. Port the post-processing algorithms implemented in Python by Numpy/scipy using Microsoft's System.Numerics.Tensors framework.
  3. Use NAudio.Midi to generate MIDI files.

Among them, the audio data input to the nmp model in the first step will be slightly different in the Python version:

  • The downmix algorithm used in the Python version is to calculate the average of multiple channels, and the resampling algorithm used is soxr_hq.
  • This project uses NAudio.MediaFoundationResampler to implement these two steps. The output results may not be exactly the same as those of the Python version, but the final results are basically the same.
Product Compatible and additional computed target framework versions.
.NET net8.0-windows10.0.17763 is compatible.  net9.0-windows 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.

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
1.0.3 177 3/12/2025
1.0.2 164 3/12/2025
1.0.1 159 3/12/2025
1.0.0 165 3/12/2025