A Python package for the exploration of musical tunings.
Project description
PyTuning is a Python library intended for the exploration of musical scales and microtonalities. It can be used by developers who need ways of calculating, analyzing, and manipulating musical scales, but it can also be used interactively.
It makes heavy use of the SymPy package, a pure-Python computer algebra system, which allows scales and scale degrees to be manipulated symbolically, with no loss of precision. There is also an optional dependency on Matplotlib (and Seaborn) for some visualizations that have been included in the package.
Some of the package’s features include:
Creation of scales in a variety of ways (EDO, Euler-Fokker, Diatonic, Harmonic, from generator intervals, etc.)
Ability to represent created scales in ways that are understood by external software (Scala, Timidity, Fluidsynth, Yoshimi, Zynaddsubfx).
Some analysis functions (for example, PyTuning provides a framework for searching for scale modes based upon defined metric functions and combinatorial analysis). Also included are some number-theoretic functions, such as prime limits and odd limits.
Some scale visualizations.
Interactive use.
As a simple example, to create a 31-TET scale and then create a tuning table for the timidity soft-synth:
scale = create_edo_scale(31)
tuning_table = create_timidity_tuning(scale, reference_note=69)
The design of PyTuning is purposefully simple so that non-computer professionals can use it without much difficultly (musicians, musicologist, interested people of all stripes).
In scope this project is similar to the Scala software package, with a few differences:
Scala is a mature, full-featured package that includes many, many scales and functions for manipulating and analyzing those scales. This project is much newer and less mature; its scope is currently much less (but hopefully it will be easy to extend).
PyTuning is written in Python and relies on modern, well maintained dependencies. Scala is written in Ada, and while this is an interesting choice, it probably limits the population of users who could change or extend it should a need arise.
Scala is mainly an application. PyTuning is a development library, but with ways for non-programmers to use it interactively.
This package does not interact with sound cards or audio drivers, so one can’t play a scale directly. There are, however, functions for exporting scales into other software packages so that music and sound can be produced.
Installation
PyTuning runs under Python 2.7.X and 3.X.
The easiest way to install PyTuning is via the Python Package Index, with which Pytuning is registered:
pip install pytuning
There are two hard dependencies for PyTuning: SymPy and NumPy. SymPy is a pure Python library and pip will handle its installation nicely. NumPy is a more complicated package and if installed via pip may involve much compilation; it would probably behoove you to install the package manually via whatever mechanism your platform provides before pip installing the package .
If you are running the package interactively it is recommended that the Jupyter interactive shell be installed. This is discussed in the documentation under the notes on Interactive use.
The source-code is available on GitHub, where it can be cloned and installed.
Documentation
Documentation for the package can be found on Read the Docs. Documentation for the latest development version is here.
Roadmap
More scales, more visualizations, more analysis functions. Pull requests are welcome!
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
Built Distribution
File details
Details for the file PyTuning-0.7.3-py3-none-any.whl
.
File metadata
- Download URL: PyTuning-0.7.3-py3-none-any.whl
- Upload date:
- Size: 108.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | db0b1231c012c1cf6a3c73aa7d791b4cff79a72f2ec6535f159c873fe302214b |
|
MD5 | d13215d573cbb1325dac923fc5f30548 |
|
BLAKE2b-256 | 2659e2c2fc91688f788587fb387ef6120c9a1ad3a8b88771fba9fc6a9c9a969d |