VBcoders Browse New Submit Contact Sign In

No account? Register free

Forgot password?

To play RTTTL (nokia ring tone) tunes

BarryDunne  (3 Submissions)   Miscellaneous   Visual Basic 3.0   Beginner   Wed 3rd February 2021

If you have a nokia mobile phone and looked at ring tones you will have come across RTTTL, the text format for the tunes.
This is a stand alone module with one public function PlayRTTTL. You give it a tune as a string in RTTTL format and it plays it using beeps.
Note that this only works on NT as the Beep function is different on windows.
If you are wondering what it could be used for, here is an example, at work we have written a phone book system for staff extension numbers and when you click on an entry you see details about the person and a picture. I wanted to let staff also give themselves a theme song that would play when you clicked on them. Since there are hundreds of RTTTL tunes available on the internet I decided to use that format as it is easily edited by users and saved to the database, and users can add new ones whenever they like.
The code could have been written better, but I wanted to keep it in a self contained single module that you could plug and play into any project.
This has nothing to do with Nokia mobile phones, it just uses the same format for the tunes.
If you have not seen them, this is an example of the format:
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
The Simpsons are probably copyrighted so don't use that one at home kids :)

Inputs
It takes a string containing the RTTTL tune

Returns
nothing

Side Effects
The Beeps are synchronous so be prepared to wait while it is playing. You could avoid this by creating an exe that takes the RTTTL as a command line and shelling that from within your program.

Rate To play RTTTL (nokia ring tone) tunes (7(7 Vote))
To play RTTTL (nokia ring tone) tunes.bas

To play RTTTL (nokia ring tone) tunes Comments

No comments yet — be the first to post one!

Post a Comment

0/1000 characters