Home    Life Calendars    PTTTL    POW papers    The Millers    Cube 2    Github Counter Music

Convert RTTTL to .wav and .mp3 audio

RTTTL (Ring Tone Text Transfer Language) is a method of storing monophonic melodies in simple text files, used in old Nokia phones to describe ringtones. If you want to convert RTTTL ringtone files into MP3/WAV audio files for use on a modern smartphone (complete with authentic shitty-sounding beeps), you can do it here.

Paste the contents of an RTTTL file below (or select one of the built-in examples) to download an mp3 audio file that plays the tones dscribed in the RTTTL text you provided. The tones generated have a very slight attack/decay to avoid nasty clicks and pops. (also converts PTTTL, which is my hacky extension of RTTTL that allows polyphony, scroll down for a full description)

Code

The code used for PTTTL/RTTTL parsing and audio generation can be found on github:

https://github.com/eriknyquist/ptttl

Polyphonic Tone Text Transfer Language (PTTTL)

The Polyphonic Tone Text Transfer Language (PTTTL) is a way to describe polyphonic melodies in a plain text file. PTTTL is a superset of Nokia's RTTTL format, used for monophonic ringtones.

Why?

I needed a good way to store simple tones and melodies for some project. RTTTL looked pretty good but only works for monophonic melodies. I needed polyphony.

PTTTL format

Valid RTTTL strings are also valid PTTTL strings. A parser that properly handles PTTTL can also handle RTTTL.

A PTTTL string is made up of three colon-seperated sections; the name section, the default values section, and the data section.

Whitespace characters, empty lines, and lines beginning with a "#" character are ignored.

The initial "name" section is intended to contain the name of the ringtone in the original RTTTL format. PTTTL requires this field to be present, to maintain backwards compatibility with RTTTL, but places no constraints on its contents.

Default values section

The very first statement is the default values section and is identical to the section of the same name from the RTTTL format.

Example

b=123, d=8, o=4

Default values specification

Data section

The PTTTL data section is just like the RTTTL data section, in that a melody consists of multiple comma-seperated notes to be played sequentially. Unlike RTTTL, PTTTL allows multiple melodys to be defined, separated by the vertical pipe character ``|``, all of which will be played in unison.

The format of a note is identical to that described by the RTTTL format. Each note includes, in sequence; a duration specifier, a standard music note, either a, b, c, d, e, f or g (optionally followed by '#' or 'b' for sharps and flats), and an octave specifier. If no duration or octave specifier are present, the default applies.

Durations

Valid values for note duration are:

Dotted rhythm patterns can be formed by adding a period "." either after the note letter (e.g. "c#.", or "c#.5"), or after the octave number (e.g. "c#5.")

Notes

Valid values for note pitch (non case-sensitive):

Octave

Valid values for note octave are between 0 and 8.

Example

Consider the following PTTTL string:

# 123 beats-per-minute, default quarter note, default 4th octave Test Melody: b=123, d=4, o=4: 16c, 8p, 16c | 16e, 8p, 16e | 16g5, 8p, 16g5

This would play 3 sixteenth notes simultaneously (C, octave 4; E, octave 4; G, octave 5), followed by an eighth note rest, followed by the same three sixteenth notes again

Note that the above sample is much easier to read if we put each melody on a new line and align the notes in columns. This is the recommended way to write PTTTL:

# Nicely aligned Test Melody: b=123, d=4, o=4: 16c, 8p, 16c | 16e, 8p, 16e | 16g5, 8p, 16g5

In order to keep things readable for large PTTTL files with multiple concurrent tracks, a semicolon character ";" can be used to further break up melodies into more practical blocks. Just as the veritcal pipe character "|" seperates concurrent tracks within a single melody, the semicolon character seperates multiple sequential melodies within a single data section. Melodies seperated by semicolons will be stitched together, one after the other, in the final output.

Select the "Polyphonic example" sample file in the RTTTL/PTTTL-to-mp3 encoder at the top of this page to see a large polyphonic melody that uses the semicolon character to help maintain readability.