Ring Tone Text Transfer Language (RTTTL)
RTTTL (Previously referred to as Nokring) was originally developed in 1996 by Nokia1 for use in their mobile phones back when they were the dominant force in the mobile phone market and the most common method of composing, and sharing ringtones was through text messages. The format was simple and easy to understand which made its adoption quite popular though was quickly replaced by more modern formats such as MIDI and MP3 ringtones which offered more features and better sound quality.
The RTTTL format is still used today in some applications and devices such as hobbyist Arduino projects, IoT devices, and some older mobile phones.
How It Works
An RTTTL string is divided into three sections that are separated by colons :
and collectively contain everything necessary to play a ringtone.
Take the following RTTTL string below as an example:
Bethoven:d=4,o=5,b=160:c,e,c,g,c,c6,8b,8a,8g,8a,8g,8f,8e,8f,8e,8d,c,e,g,e,c6,g.
Part 1: Name Section (Bethoven
)
The name of the ringtone, this is normally not used by the player but is useful for identifying the ringtone. According to the official specification, the name must not exceed 11 characters in length though this is arbritary and many implementation of RTTTL are generally capable of handling names with much greater lengths. Whilst no character restrictions are specified, it is recommended to use only alphanumeric characters and spaces, with the semicolon :
character.
Part 2: Control Section (d=4,o=5,b=160
)
The control section contains the default values for the ringtone and is separated by commas ,
in a key-value pair further separated by an equals sign=
. These values are used when a note does not specify a value. Use the table below to learn more about each control value.
The duration of the note which is measured relative to other notes using a system of whole notes.It is not measured in time (seconds or minutes).
Value | Description |
---|---|
1 | A full note (1/1) |
2 | A half note (½) |
4 | A quarter note (¼) |
8 | An eighth note (⅛) |
16 | A sixteenth note (1/16) |
32 | A thirty-second note (1/32) |
The octave of the note (also referred to as scale or pitch) which is a range of notes that are higher or lower in pitch. The octave is measured in Hertz (Hz) and is used to determine the frequency of the note.
Value | Description |
---|---|
4 | Note A is 440Hz |
5 | Note A is 880Hz |
6 | Note A is 1.76 kHz |
7 | Note A is 3.52 kHz |
The beats per minute of the note (also referred to as tempo) which is the speed at which the note is played. The BPM is measured in beats per minute and is used to determine the tempo of the note.
The value for BPM must be one of the following:
5, 28, 31, 35, 40, 45, 50, 56, 63, 70, 80, 90, 100, 112, 125, 140, 160, 180, 200, 225, 250, 285, 320, 355, 400, 450, 500, 565, 635, 715, 800, 900
This would mean if for instance a ringtone is played at a BPM of 112, the tone will get one beat every (60/112) 1.867 second. Similiarly, if you you want the ringtone twice as fast, you would increase the BPM to 224.
Part 3: Tone Commands (c,e,c,g,c,c6,8b,8a,8g,8a,8g,8f,8e,8f,8e,8d,c,e,g,e,c6,g.
)
The tone commands section contains the notes that make up the ringtone with each note separated by a comma ,
character.
Each tone note must be one of the following (not case sensitive):
B, A#, A, G#, G, F#, F, E, D#, D, C#, C, P
Each note can also have an optional duration and octave specified after the note. The duration and octave are separated by a number which is the duration of the note and the octave of the note respectively. If the duration or octave is not specified, the default values from the control section are used.
The note P
is a special note that represents a pause or rest in the music and is used to create silence in the ringtone rather than output any audible frequency.
Tones can be represented in the following format:
[(d)uration][note][(o)ctave][.]
Notes can also have a dot .
character after the note which indicates a dotted note, this gives the note a duration of itself plus half of itself.
Here are three examples of notes with varying duration, note, octave, and dot:
Note | Description |
---|---|
8c5 | An eighth note C in the 5th octave. |
4d6. | A dotted quarter note D in the 6th octave. |
16g4 | A sixteenth note G in the 4th octave. |
Audio Hardware
RTTTL is incredibly useful for programming electrical components with PWM outputs such as passive buzzers and speakers to play simple monophonic melodies such as chimes, sirens, alarms, and ringtones. If you are interested in playing RTTTL on a passive buzzer via a microcontroller, the ESPHome project has a built-in component readily available for use with RTTTL through microcontrollers such as ESP3266 and ESP32. For a pre-made device that already has everything needed to program and play RTTTL with no additional programming required, check out the Apollo MSR-2 mmWave Sensor for use with Home Assistant and comes packed with several other features beyond RTTTL.
RTTTL Specifications
1RTTTL is not a well documented format and is a relatively niche piece of historical technology which was quickly replaced by more modern formats such as MIDI and MP3 ringtones. There is very little information available on the modern internet today regarding the language, original authors, etc. with citations.
; ; Ringing Tones text transfer language (RTTTL) ; ; Version 1.1 / 13-Aug-1999 ; - Updated by The TDD for strict conformity ; with Nokia Smart Messaging 2.0 Specification ; ; http://www.binet.lv/personal/nokia/note_syntax_1-1.txt ; ; Version 1.0 / 29-July-1998 ; - First version by John Mostelo ; ; http://members.tripod.com/~ringtones/note_syntax.txt ; <ringing-tones-text-transfer-language> := <name> <sep> [<defaults>] <sep> <note-command>+ <name> := <char>+ ; maximum name length 11 characters <sep> := ":" <defaults> := <def-note-duration> | <def-note-scale> | <def-beats> | <def-volume> | <def-style> <def-note-duration> := "d=" <duration> <def-note-scale> := "o=" <scale> <def-beats> := "b=" <beats-per-minute> <def-volume> := "v=" <volume> <def-style> := "s=" <style> <beats-per-minute> := 25,28,...,900 ; decimal value <volume> := 0..15 ; 0 - no tone, 15 - maximal volume, decimal value <style> := 1 | ; normal 2 | ; continuous 3 ; staccato ; If not specified, defaults are ; ; 4 = duration ; 5 = scale ; 63 = beats-per-minute ; 7 = volume ; 1 = style <note-command> := [<duration>] <note> [<scale>] [<special-duration>] <delimiter> <duration> := "1" | ; Full 1/1 note "2" | ; 1/2 note "4" | ; 1/4 note "8" | ; 1/8 note "16" | ; 1/16 note "32" | ; 1/32 note <note> := "P" | ; pause "C" | "C#" | "D" | "D#" | "E" | "F" | "F#" | "G" | "G#" | "A" | "A#" | "B" | "H" <scale> := "4" | ; Note A is 440Hz "5" | ; Note A is 880Hz "6" | ; Note A is 1.76 kHz "7" ; Note A is 3.52 kHz <special-duration> := "." | ; Dotted note ";" | ; Double dotted note "&" ; 2/3 length <delimiter> := "," ; End of specification
; ; Ringing Tones text transfer language (RTTTL) ; ; Version 1.1 / 13-Aug-1999 ; - Updated by The TDD for strict conformity ; with Nokia Smart Messaging 2.0 Specification ; ; http://www.binet.lv/personal/nokia/note_syntax_1-1.txt ; ; Version 1.0 / 29-July-1998 ; - First version by John Mostelo ; ; http://members.tripod.com/~ringtones/note_syntax.txt ; <ringing-tones-text-transfer-language> := <name> <sep> [<defaults>] <sep> <note-command>+ <name> := <char>+ ; maximum name length 11 characters <sep> := ":" <defaults> := <def-note-duration> | <def-note-scale> | <def-beats> | <def-volume> | <def-style> <def-note-duration> := "d=" <duration> <def-note-scale> := "o=" <scale> <def-beats> := "b=" <beats-per-minute> <def-volume> := "v=" <volume> <def-style> := "s=" <style> <beats-per-minute> := 25,28,...,900 ; decimal value <volume> := 0..15 ; 0 - no tone, 15 - maximal volume, decimal value <style> := 1 | ; normal 2 | ; continuous 3 ; staccato ; If not specified, defaults are ; ; 4 = duration ; 5 = scale ; 63 = beats-per-minute ; 7 = volume ; 1 = style <note-command> := [<duration>] <note> [<scale>] [<special-duration>] <delimiter> <duration> := "1" | ; Full 1/1 note "2" | ; 1/2 note "4" | ; 1/4 note "8" | ; 1/8 note "16" | ; 1/16 note "32" | ; 1/32 note <note> := "P" | ; pause "C" | "C#" | "D" | "D#" | "E" | "F" | "F#" | "G" | "G#" | "A" | "A#" | "B" | "H" <scale> := "4" | ; Note A is 440Hz "5" | ; Note A is 880Hz "6" | ; Note A is 1.76 kHz "7" ; Note A is 3.52 kHz <special-duration> := "." | ; Dotted note ";" | ; Double dotted note "&" ; 2/3 length <delimiter> := "," ; End of specification
RTTTL (RingTone Text Transfer Language) is the primary format used to distribute ringtones for Nokia phones. An RTTTL file is a text file, containing the ringtone name, a control section and a section containing a comma separated sequence of ring tone commands. White space must be ignored by any reader application. Example: Simpsons:d=4,o=5,b=160:32p,c.6,e6,f#6,8a6,g.6,e6,c6,8a,8f#,8f#,8f#,2g This file describes a ringtone whose name is 'Simpsons'. The control section sets the beats per minute at 160, the default note length as 4, and the default scale as Octave 5. <RTX file> := <name> ":" [<control section>] ":" <tone-commands> <name> := <char> ; maximum name length 10 characters <control-section> := <control-pair> ["," <control-section>] <control-pair> := <control-name> ["="] <control-value> <control-name> := "o" | "d" | "b" ; Valid in control section: o=default scale, d=default duration, b=default beats per minute. ; if not specified, defaults are 4=duration, 6=scale, 63=beats-per-minute ; any unknown control-names must be ignored <tone-commands> := <tone-command> ["," <tone-commands>] <tone-command> :=<note> | <control-pair> <note> := [<duration>] <note> [<scale>] [<special-duration>] <delimiter> <duration> := "1" | "2" | "4" | "8" | "16" | "32" ; duration is divider of full note duration, eg. 4 represents a quarter note <note> := "P" | "C" | "C#" | "D" | "D#" | "E" | "F" | "F#" | "G" | "G#" | "A" | "A#" | "B" <scale> :="4" | "5" | "6" | "7" ; Note that octave 4: A=440Hz, 5: A=880Hz, 6: A=1.76 kHz, 7: A=3.52 kHz ; The lowest note on the Nokia 61xx is A4, the highest is B7 <special-duration> := "." ; Dotted note ; End of specification