Arkham / elm-rttl / RTTL

Parse ringtones written using RTTL and Nokia Composer


type Ringtone
    = Ringtone ({ tempo : BPM, tones : List Tone })

A ringtone has a well-defined tempo in BPM (beats-per-minute) and is composed by multiple tones, which can be either pitches or pauses.

Parsing

parseComposer : { tempo : Basics.Int } -> String -> Result (List Parser.DeadEnd) Ringtone

Parse a ringtone expressed in the Nokia Composer format. It is a less generic format compared to RTTL since you can only express 3 octaves. Since the format does not specify a tempo, you will need to choose one.

Here's an example: 4c2 4d2 4e2 16- 8.#a3

Encoding

encode : Ringtone -> Json.Encode.Value

Encode ringtone as a list of { frequency, duration } objects