Python bindings for WaoN - Wave-to-Notes transcriber
Reason this release was yanked:
non functional for transcription
Project description
WaoN Python Bindings
Python bindings for WaoN - Wave-to-Notes transcriber.
Installation
Building from Source
The Python bindings require the WaoN shared library to be built first. From the project root:
mkdir build
cd build
cmake .. -DBUILD_SHARED_LIB=ON -DBUILD_PYTHON_BINDINGS=ON
make
Installing with pip
Once built, you can install the Python package:
cd python
pip install .
For development installation:
pip install -e .
Requirements
- Python >= 3.6
- NumPy >= 1.16.0
- pybind11 >= 2.6.0 (for building)
- CMake >= 3.12 (for building)
Usage
Basic Usage
import waon
# Simple transcription with default settings
waon.transcribe_file("input.wav", "output.mid")
Advanced Usage
import waon
# Create transcriber and options
transcriber = waon.Transcriber()
options = waon.Options()
# Configure options
options.set_fft_size(4096) # Larger FFT for better frequency resolution
options.set_hop_size(1024) # Custom hop size
options.set_window(waon.WindowType.HANNING)
options.set_cutoff(-4.0) # More sensitive cutoff
options.set_note_range(36, 84) # C2 to C6
options.set_phase_vocoder(True) # Enable phase vocoder
# Optional: set progress callback
def progress_callback(progress):
print(f"Progress: {progress * 100:.1f}%")
transcriber.set_progress_callback(progress_callback)
# Perform transcription
transcriber.transcribe("input.wav", "output.mid", options)
Using NumPy Arrays
import waon
import numpy as np
# Generate or load audio data
sample_rate = 44100
audio_data = np.random.randn(sample_rate * 2) # 2 seconds of noise
# Transcribe
waon.transcribe(
audio_data,
sample_rate,
"output.mid",
fft_size=2048,
cutoff=-5.0,
note_bottom=48,
note_top=84
)
API Reference
Classes
Transcriber
Main transcription class.
transcribe(input_file, output_file, options=None): Transcribe audio file to MIDItranscribe_data(audio_data, sample_rate, output_file, options=None): Transcribe NumPy array to MIDIset_progress_callback(callback): Set progress callback function
Options
Configuration options for transcription.
set_fft_size(size): Set FFT size (must be power of 2)set_hop_size(size): Set hop size (0 = auto, default is fft_size/4)set_window(window): Set window type (WindowType enum)set_cutoff(cutoff): Set cutoff ratio (log10)set_note_range(bottom, top): Set MIDI note range to analyzeset_phase_vocoder(enable): Enable/disable phase vocoderset_drum_removal(bins, factor): Set drum removal parametersset_octave_removal(factor): Set octave removal factor
Enums
WindowType
NONE: No windowingPARZEN: Parzen windowWELCH: Welch windowHANNING: Hanning window (default)HAMMING: Hamming windowBLACKMAN: Blackman windowSTEEPER: Steeper 30-dB/octave rolloff window
ErrorCode
SUCCESS: Operation successfulMEMORY: Memory allocation failedFILE_NOT_FOUND: File not foundFILE_FORMAT: Invalid file formatINVALID_PARAM: Invalid parameterIO: I/O errorINTERNAL: Internal error
Functions
version_string(): Get library version stringversion(): Get library version as tuple (major, minor, patch)transcribe_file(input_file, output_file, **kwargs): Convenience function for file transcriptiontranscribe(audio_data, sample_rate, output_file, **kwargs): Convenience function for array transcription
Exceptions
WaonError: Exception raised for WaoN-specific errors
Examples
See the examples/ directory for more detailed examples:
basic_transcription.py: Simple file transcriptionadvanced_transcription.py: Advanced options and progress callbacknumpy_transcription.py: Using NumPy arrays
License
The Python bindings are released under the same license as WaoN (GPL v2 or later).
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file waon-0.10.tar.gz.
File metadata
- Download URL: waon-0.10.tar.gz
- Upload date:
- Size: 128.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.11
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
697559d800e1205eca3bf202a7d8860ee15fefdc8b9a1ea90bbf9ebcbfcd4960
|
|
| MD5 |
4c45cba99e580cdc949052dc1bb9e02d
|
|
| BLAKE2b-256 |
1f1d47c334eea5108ca26fb9b1a51a26a80068ce3e2db99de5bdfbb84b3f5c9a
|
File details
Details for the file waon-0.10-py3-none-any.whl.
File metadata
- Download URL: waon-0.10-py3-none-any.whl
- Upload date:
- Size: 123.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.11
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
21bd54379bb47c6c4e440a6815c78ebae150a1cc1b59619fcc09b28f5756adf6
|
|
| MD5 |
46b0c4e1c9ed000941d1bb2f4f4af1c3
|
|
| BLAKE2b-256 |
42ea11f52ec9fd229cb5aa468e7de28346ddf0c8154e1aa09fd0db6770dab5fb
|