Skip to main content

putao: Poor man's UTAU 🍇

レロレロ

putao is a Python module that allows programmatic creation, editing, and saving of UTAU-style songs.

No more having to wrestle with encoding issues: all filenames and text files use UTF-8, re-encoded from Shift-JIS if necessary.

Originally, it was a joke inspired by Composite's Bad Apple script but is now an experimental attempt at creating a voice synthesizer in Python.

Why name it putao?

Because python + utau = putao. Conincidentally, it means 'grape' (葡萄) in Chinese.

How it works

putao uses UTAU-format voicebanks (with oto.ini files).

The key difference is that putao does not shell out to resampler.exe, or any other .exe compiled resampler. putao's resampler is written entierly in Python, thanks to pyworld.

(Which means it is cross-platform, as long as you have a C compiler for pyworld.)

The resampler's core logic is in model.py, which models UTAU elements as python classes. To create a new resampler, inherit from the Resampler class and override the abstract methods.

To save time, putao generates frequency files from pyworld for all the wavfiles in oto.ini, similar to .frq files generated by UTAU's resampler.exe. These analysis files are just numpy arrays saved in numpy's native format (hence the .npy extension).

Later on when rendering songs, the frequency files can be loaded back into the resampler.

NOTE: You have to use putao extract <voicebank zipfile> -t <folder> so the oto.ini and filenames can be read correctly by putao!

Making a song

.mml song files are written with an extended form of Music Macro Language, described below.

Check out some examples: to render them, do the following: (You need to supply your own UTAU voicebank, though. Make sure to extract with putao extract for utf8!).

cd examples
putao new <name>
putao render -s <name>.mml

where name is one of the .mml files, i.e bad_apple.

putao is CLI-only for now; creating a GUI to make songs is currently high priority, and it will be worked on once putao's API is stabilised.

MML Syntax

(Anything enclosed in '[]' is optional.)

lengths below may be one of '1', '2', '4', '8', '16', '32', '64' (1 -> whole note, 2 -> half note, 4 -> quarter note, 8 -> eighth note, etc.)

Core syntax:

(key)[accidental][length]
    Play a note.

    key must be one of the letters 'abcdefg',
    and accidental may be '+', '#' (sharp) or '-' (flat).
    i.e 'c2'

p[length] / r[length]
    Pause/rest playing notes.

o(octave)
    Change the octave of the notes.

    octave must be a integer.

> / <
    Shift current octave up or down.

l(length)
    Change the length of the notes.

t(tempo)
    Change the tempo of the notes.

    tempo must be an integer, in beats per minute.

Extended syntax:

#[comment]
    A comment.
    Comments can appear anywhere in a line (i.e after commands).
    All text between the '#' until the next newline is ignored.

@(trackname)
    Add any notes after this to trackname.
    Any notes without a specified track are implictly added to the 'global' track.

|(lyrics)
    Add lyrics to the current track, split by whitespace.
    Each split is a phoneme.

Todo

  • Add midi support (WIP, 50%)
  • GUI

Install

pip install putao

On Linux, you may have to install your distro's equivelent of the following packages:

  • libsnffile1

i.e Debian:

sudo apt install libsndfile1

License

MIT.

Metadata

Release files for putao 0.4.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for putao 0.4.1
File Size Uploaded Provenance
putao-0.4.1.tar.gz 21.4 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for putao 0.4.1
File Interpreter ABI Platform
putao-0.4.1-py3-none-any.whl Python 3 none any Details

Total release size: 43.5 kB

Release files / putao-0.4.1.tar.gz

Download URL putao-0.4.1.tar.gz
Size 21.4 kB
Tags Source
SHA-256 checksum
How to use checksums
c846a31e10edca042547d3af27875ca7384d14639a9497c40dac76ad59e40837
BLAKE2b-256 checksum
How to use checksums
8069a804b12154f5fcf02f9df747bf2c96370f53fcd1dbbb45367f3878452a64
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via python-httpx/0.27.2

Release files / putao-0.4.1-py3-none-any.whl

Download URL putao-0.4.1-py3-none-any.whl
Size 22.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
588e5d94331ba766c2520241d60e9f4f77176eb376d8513dadc45a79e1297fd9
BLAKE2b-256 checksum
How to use checksums
0417064ec34fec05a56ffc6995c39f64c1e902ff392bd9cc8c2c7b18466c94c0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via python-httpx/0.27.2

Security for putao 0.4.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page