Skip to main content

High-performance library for rendering MIDI files to WAV and Opus formats using SoundFonts

Project description

MidiRenderer

MidiRenderer is a high-performance Python library for rendering MIDI files to WAV and Opus formats using SoundFonts. Built with Rust for speed and efficiency.

Features

  • Render MIDI to WAV and Opus
  • Uses SoundFont (.sf2) files
  • High-performance Rust backend
  • Cross-platform support (Windows, macOS, Linux, including ARM64)

Installation

pip install midirenderer

Quick Start

import midirenderer
from pathlib import Path

# Render MIDI to WAV
wav_data = midirenderer.render_wave_from(
    Path('soundfont.sf2').read_bytes(),
    Path('music.mid').read_bytes()
)

with open('output.wav', 'wb') as f:
    f.write(wav_data)

# Render MIDI to Opus
opus_data = midirenderer.render_opus_from(
    Path('soundfont.sf2').read_bytes(),
    Path('music.mid').read_bytes(),
    stereo=True,
    bitrate="128000"  # 128 kbps
)

with open('output.opus', 'wb') as f:
    f.write(opus_data)

API

  • render_wave_from(soundfont_bytes: bytes, midi_bytes: bytes) -> bytes
  • render_opus_from(soundfont_bytes: bytes, midi_bytes: bytes, stereo: bool = True, bitrate: str = "auto") -> bytes

Requirements

  • Python 3.8+
  • libopus (usually pre-installed on most systems)

License

MIT License

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

midirenderer-0.1.0-cp38-abi3-win_amd64.whl (342.2 kB view hashes)

Uploaded CPython 3.8+ Windows x86-64

midirenderer-0.1.0-cp38-abi3-manylinux_2_34_aarch64.whl (521.0 kB view hashes)

Uploaded CPython 3.8+ manylinux: glibc 2.34+ ARM64

midirenderer-0.1.0-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (485.1 kB view hashes)

Uploaded CPython 3.8+ manylinux: glibc 2.17+ x86-64

midirenderer-0.1.0-cp38-abi3-macosx_11_0_arm64.whl (402.9 kB view hashes)

Uploaded CPython 3.8+ macOS 11.0+ ARM64

midirenderer-0.1.0-cp38-abi3-macosx_10_12_x86_64.whl (420.3 kB view hashes)

Uploaded CPython 3.8+ macOS 10.12+ x86-64

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page