Coder Social home page Coder Social logo

naviamold1 / pypiano Goto Github PK

View Code? Open in Web Editor NEW

This project forked from felixgse/pypiano

0.0 0.0 0.0 35 KB

PyPiano is a python library to programmatically play piano. It is an easy to use abstraction layer on top of the python-mingus package providing a simple to use interface to play mingus music containers

License: Other

Python 100.00%

pypiano's Introduction

PyPiano

PyPiano is a python library to programmatically play piano. It is an easy-to-use abstraction layer on top of the python-mingus package providing a simple user interface to play mingus music containers, such as Notes, NoteContainers, Bars and Tracks. It bundles a default sound fonts file to enable playing and recording audio out of the box. By default, 8 different pianos are available. It allows playing Piano via audio output or recording music to wav files.

Installation

For PyPiano to work you need Fluidsynth to be installed. Please check the Fluidsynth website on how to install Fluidsynth on your system. Note that you also need to install and set up git-lfs before installing PyPiano. You then can install PyPiano from Github using pip:

pip install git+https://github.com/FelixGSE/pypiano.git

Usage

from pypiano import Piano
from mingus.containers import Note

p = Piano()

# Play a simple C-4 via audio
p.play("C-4")

# Play a mingus Note
note = Note("C-4")
p.play(note)

# Record a Note to a wav file
p.play(note, recording_file="my_first_recording.wav", record_seconds=2)

# Use a different instrument
p.load_instrument("Honky-tonk Piano")
p.play(note)

The same code works with more complex mingus containers like, NoteContainers, Bars and Tracks

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change. Please make sure to update tests as appropriate.

Note that the sound fonts are checked in as Git large file. If you have git-lfs installed the bundled sound font files in pypiano/sound_fonts/FluidR3_GM.sf2 should be cloned automatically. If not, you should install git-lfs and fetch them after.

Know issues

The default sound fonts were taken from the fluid-soundfont debian package (check /scripts/get_default_sf_file.py for details). The file contains 194 instruments of which only 8 are used within this project, thus making the package unnecessarily large. All 186 unused instruments should be removed from the shipped sound fonts to reduce package size. It is an open task to find out how to safely remove unused instruments.

License

  • PyPiano is distributed under MIT license - Check corresponding license file
  • Default sound fonts are distributed under MIT license - Check corresponding license file

pypiano's People

Contributors

felixgse avatar naviamold1 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.