Experts in SMS and MMS Technology. NCLs Provato is an SMS/MMS Gateway supporting  WAP Push, EMS, MMS, SMS, Nokia Smart Messaging, SMPP, CIMD, UCP, MM7, M20, TC35 NCL Technologies Ltd
Provato - SMS MMS Gateway
Mobile Messaging in J2EE & .NET

SwiftNote - Java SMS Toolkit

ie.ncl.media.music
Class RTTTL

java.lang.Object
  extended by ie.ncl.media.music.Melody
      extended by ie.ncl.media.music.RTTTL

public class RTTTL
extends Melody

RTTTL, or Ring Tone Text Transfer Language, is a de facto standard for describing melodies that can be sent to mobile phones and saved as ring tones.

An RTTTL compliant ringtone consist of a name, some default settings and a melody. The format of the one-line RTTTL string should conform to the following 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

 
 

Sample RTTTL ring tones are (treble-click on name to select a ringtone):
 

Bolero:d=4, o=5, b=80:c6, 8c6, 16b, 16c6, 16d6, 16c6, 16b, 16a, 8c6, 16c6, 16a, c6, 8c6, 16b, 16c6, 16a, 16g, 16e, 16f, 2g, 16g, 16f, 16e, 16d, 16e, 16f, 16g, 16a, g, g, 16g, 16a, 16b, 16a, 16g, 16f, 16e, 16d, 16e, 16d, 8c, 8c, 16c, 16d,8e, 8f, d, 2g
Entertainer:d=4, o=5, b=140:8d, 8d#, 8e, c6, 8e, c6, 8e, 2c.6, 8c6, 8d6, 8d#6, 8e6, 8c6, 8d6, e6, 8b, d6, 2c6, p, 8d, 8d#, 8e, c6, 8e, c6, 8e, 2c.6, 8p, 8a, 8g, 8f#, 8a, 8c6, e6, 8d6, 8c6, 8a, 2d6
Indiana:d=4, o=5, b=250:e, 8p, 8f, 8g, 8p, 1c6, 8p., d, 8p, 8e, 1f, p., g, 8p, 8a, 8b, 8p, 1f6, p, a, 8p, 8b, 2c6, 2d6, 2e6, e, 8p, 8f, 8g, 8p, 1c6, p, d6, 8p, 8e6, 1f.6, g, 8p, 8g, e.6, 8p, d6, 8p, 8g, e.6, 8p, d6, 8p, 8g, f.6, 8p, e6, 8p, 8d6, 2c6
Mission:d=4, o=6, b=100:32d, 32d#, 32d, 32d#, 32d, 32d#, 32d, 32d#, 32d, 32d, 32d#, 32e, 32f, 32f#, 32g, 16g, 8p, 16g, 8p, 16a#, 16p, 16c, 16p, 16g, 8p, 16g, 8p, 16f, 16p, 16f#, 16p, 16g, 8p, 16g, 8p, 16a#, 16p, 16c, 16p, 16g, 8p, 16g, 8p, 16f, 16p, 16f#, 16p, 16a#, 16g, 2d, 32p, 16a#, 16g, 2c#, 32p, 16a#, 16g, 2c, 16p, 16a#5, 16c
PinkPanther:d=4, o=5, b=160:8d#, 8e, 2p, 8f#, 8g, 2p, 8d#, 8e, 16p, 8f#, 8g, 16p, 8c6, 8b, 16p, 8d#, 8e, 16p, 8b, 2a#, 2p, 16a, 16g, 16e, 16d, 2e
The Simpsons:d=4, o=5, b=160:c.6, e6, f#6, 8a6, g.6, e6, c6, 8a, 8f#, 8f#, 8f#, 2g, 8p, 8p, 8f#, 8f#, 8f#, 8g, a#., 8c6, 8c6, 8c6, c6


Constructor Summary
RTTTL(Melody melody)
          Construct an RTTTL from another melody (e.g.
RTTTL(java.lang.String tune)
          Construct a ring tone according to the above specification.
 
Method Summary
 RingToneMessage getRingTone(Address addr)
          Convert this melody into SmartMessage format so that it can be sent to a mobile phone using Narrow Band Socket.
 java.lang.String toString()
          Print the RTTTL string for this melody.
 
Methods inherited from class ie.ncl.media.music.Melody
add, clearNotes, createMIDI, createMIDI, getBeat, getDuration, getLoop, getName, getNotes, getScale, getStyle, getVolume, setBeat, setDuration, setLoop, setName, setScale, setStyle, setVolume
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

RTTTL

public RTTTL(java.lang.String tune)
      throws MelodyException
Construct a ring tone according to the above specification.

Throws:
MelodyException

RTTTL

public RTTTL(Melody melody)
Construct an RTTTL from another melody (e.g. and IMelody).

Method Detail

toString

public java.lang.String toString()
Print the RTTTL string for this melody.

Overrides:
toString in class java.lang.Object

getRingTone

public RingToneMessage getRingTone(Address addr)
Convert this melody into SmartMessage format so that it can be sent to a mobile phone using Narrow Band Socket.


Experts in SMS and MMS Technology. NCLs Provato is an SMS/MMS Gateway supporting  WAP Push, EMS, MMS, SMS, Nokia Smart Messaging, SMPP, CIMD, UCP, MM7, M20, TC35 NCL Technologies Ltd
Provato - SMS MMS Gateway
Mobile Messaging in J2EE & .NET

SwiftNote - Java SMS Toolkit