RTTTL Obfuscation

15

1

RTTTL, or Ring Tone Text Transfer Language is a music format that was invented by Nokia in the dawn of time when dinosaurs roamed the land. It allows for fairly crude pieces of music (no chords or anything), and the format is pretty simple which is why I think it's pretty cool. Take a look at this one:

DejaVu: d=8,o=5,b=200: e, e, c, e, g, 2g4

Let's dissect the format. The "DejaVu" part at the beginning is the title -- this cannot be longer than ten characters. The d and o are the default values for duration and octave -- if a note doesn't specify duration or octave, it'll use these. Finally, the b is the beats per minute.

After that, the actual notes of the song are listed. The format of a note is DPO, where D is the duration of the note (1, 2, 4, 8, 16), P is the pitch (A,B,C,D,E,F,G,A#,B#,C#,D#,E#,F#,G#), and O is the octave (4-8 in the Nokia implementation, however it is different for other implementations. For the purposes of the challenge we'll say it is 1-8). If the duration or the octave is not specified, the defaults are used. Additionally, a note can have a dot after it -- this essentially multiplies the duration by 1.5.

In our example here, we have two E notes with no duration and octave, which mean that they have the default duration and octave (8, or eighth-note and octave 5), a C with no duration and octave, an E and a G. The final note is a G note with a duration of 2 (half-note) and an octave of 4.

Now that we've gone over the format, what's the challenge? The challenge actually doesn't have too much to do with RTTTL. Your task is to create an obfuscated program that outputs "Hello, World!" (exactly) that is also a valid RTTTL song that is at least five seconds long.

In order to test your RTTTL song, you can use this site to convert your song to a MIDI file, then listen to it in a MIDI player. This is . Good luck!

EDIT: Here's a website for converting MIDIs to RTTTLs if you so desire. Link

EDIT2: This shiny bounty will be awarded to the winner (most upvoted post) in 7 days.

a spaghetto

Posted 2015-10-09T01:07:39.880

Reputation: 10 647

Can the beats per second be a decimal? – Downgoat – 2015-10-09T01:37:29.710

No. Also that was supposed to be beats per minute, I've fixed that. – a spaghetto – 2015-10-09T01:51:44.853

1Is there any way to convert a midi file to an RTTTL song? – The_Basset_Hound – 2015-10-09T02:10:33.667

I'm sure there is. Maybe try googling it? (You'd have to make sure the MIDI file doesn't contain chords, which RTTTL doesn't support.) – a spaghetto – 2015-10-09T02:22:59.040

1

Found one that works: http://midi.mathewvp.com/midi2RTTL.php

– The_Basset_Hound – 2015-10-09T03:11:44.887

Would the person who downvoted this challenge please explain why they downvoted it? It's really important that I get feedback so I can make better challenges in the future. – a spaghetto – 2015-10-09T13:36:13.867

The challenge itself looks pretty hard, so instead I wrote a script to play the tunes. (It's not golfed). PowerShell / Console Beep based Play-RTTTL.ps1, and found some example songs online.

– TessellatingHeckler – 2015-10-09T17:36:43.897

Updated the question to make octaves 1-8. If you guys are writing any RTTTL players I recommend you change them. The Nokia implementation does indeed use 4-8 but the format can handle 1-8. – a spaghetto – 2015-10-09T18:21:34.653

Answers

13

Whitespace, 2748 Bytes

(replace \t with actual tabs)

Hello:d=4, o=5, b=120:2p, 16a2,
16p, 16a2, 16p, 16a3,\t16p, 16a3, 16p,\t16g2, 16p, 16g2, 16p,
16g3,\t16p,\t16g3, 16p, 16a2, 16p, e3,\td3,
16b2, 16c3, 16b2, 16a2,\t8g2,\t16a2, 16p, 16a2,\t16p, 16a3,\t16p,
16a3,\t16p,\t16g2, 16p, 16g2, 16p, 16g3,\t16p, 16g3,
16p, 16a2, 16p, e3,\td3,\t16b2, 16c3,\t16b2,\t16a2, 8g2, 16a2,
16p,\t16a2,\t16p, 16a3, 16p, 16a3, 16p,\t16g2,\t16p,
16g2, 16p, 16g3, 16p,\t16g3,\t16p, 16a2,\t16p,\te3, d3, 16b2,
16c3,\t16b2,\t16a2, 8g2, 16a2, 16p, 16a2,\t16p, 16a3, 16p,
16a3, 16p, 16g2, 16p,\t16g2,\t16p, 16g3,\t16p,\t16g3,\t16p,\t16a2,
16p,\te3,\td3, 16b2, 16c3, 16b2, 16a2,\t8g2, 16a2,\t16p,
16a2, 16p, 16a3, 16p,\t16a3, 16p,\t16g2,\t16p, 16g2, 16p,
16g3,\t16p,\t16g3, 16p, 16a2, 16p, e3,\td3,\t16b2, 16c3,
16b2, 16a2, 8g2, 16a2,\t16p, 16a2, 16p, 16a3, 16p, 16a3,
16p,\t16g2,\t16p, 16g2, 16p, 16g3, 16p,\t16g3,\t16p,\t16a2,
16p, e3, d3, 16b2,\t16c3,\t16b2,\t16a2, 8g2,\ta2,\t8c#3,\t8e3,
g2,\t8b2,\t8d3, a2, 8c#3, 8e3, g2,\t8b2, 8d3, a2, 8c#3,
8e3, g2, 8b2, 8d3,\ta2,\t8c#3, 8e3,\tg2,\t8b2,\t8d3,\ta2,
8c#3,\t8e3,\tg2, 8b2, 8d3, a2, 8c#3,\t8e3, g2, 8b2,\t8d3,
a2, 8c#3, 8e3, g2,\t8b2,\t8d3,\ta2, 8c#3, 8e3,\tg2, 8b2,
8d3,\t16a2,\t16p, 16a2, 16p, 16a3, 16p,\t16a3, 16p,\t16g2, 16p,
16g2, 16p, 16g3, 16p,\t16g3,\t16p, 16a2,\t16p,\te3, d3, 16b2,
16c3,\t16b2,\t16a2, 8g2, 16a2, 16p, 16a2,\t16p, 16a3,\t16p,\t16a3,
16p, 16g2, 16p, 16g2,\t16p,\t16g3, 16p, 16g3,\t16p, 16a2, 16p,
e3,\td3,\t16b2, 16c3, 16b2, 16a2, 8g2,\t16a2,\t16p, 16a2, 16p,
16a3, 16p, 16a3, 16p,\t16g2, 16p, 16g2, 16p, 16g3,\t16p,
16g3,\t16p,\t16a2, 16p, e3, d3, 16b2,\t16c3,\t16b2, 16a2,\t8g2,
16a2, 16p, 16a2, 16p,\t16a3,\t16p, 16a3,\t16p,
16g2,\t16p,\t16g2, 16p, 16g3, 16p, 16g3,\t16p,\t16a2,\t16p, e3,
d3, 16b2, 16c3, 16b2,\t16a2, 8g2,\ta2, 8c#3,
8e3,\tg2,\t8b2, 8d3, a2, 8c#3, 8e3,\tg2,\t8b2,\t8d3,\ta2,
8c#3, 8e3, g2, 8b2, 8d3,
a2,\t8c#3,\t8e3, g2, 8b2, 8d3, a2, 8c#3,
8e3,
g2, 8b2, 8d3, a2, 8c#3,\t8e3,
g2, 8b2,
8d3, a2,\t8c#3,\t8e3,\tg2, 8b2,
8d3, a2,
8c#3,\t8e3, g2, 8b2,\t8d3, 1a3,
1a2,\td3,
8f#3, 8a3, c3, 8e3, 8g3, d3,\t8f#3,
8a3,\tc3, 8e3, 8g3, d3,
8f#3, 8a3,
c3, 8e3, 8g3,\td3,
8f#3,
8a3, c3, 8e3, 8g3,\td3, 8f#3,
8a3,
c3,
8e3,
8g3,d3,8f#3,8a3,c3,8e3,8g3,d3,8f#3,8a3,c3,8e3,8g3,d3,8f#3,8a3,c3,8e3,8g3,8d3,274p,8f3,274p,8d3,8c#3,8c3,274p,8b2,274c3,8p,8c#3,8d3,274p,8f3,274p,8d3,8c#3,8c3,274p,8b2,274c3,8p,8c#3,8d3,274p,8f3,274p,8d3,8c#3,8c3,274p,8b2,274c3,8p,8c#3,8d3,274p,8f3,274p,8d3,8c#3,8c3,274p,8b2,274c3,8p,8c#3,8d3,274p,8f3,274p,8d3,8c#3,8c3,274p,8b2,274c3,8p,8c#3,8d3,274p,8f3,274p,8d3,8c#3,8c3,274p,8b2,274c3,8p,8c#3,8d3,274p,8f3,274p,8d3,8c#3,8c3,274p,8b2,274c3,8p,8c#3,8d3,274p,8f3,274p,8d3,8c#3,8c3,274p,8b2,274c3,8p,8c#3,8d3,274p,8f3,274p,8d3,8c#3,8c3,274p,8b2,274c3,8p,8c#3,8d3,274p,8f3,274p,8d3,8c#3,8c3,274p,8b2,274c3,8p,8c#3,8d3,274p,8f3,274p,8d3,8c#3,8c3,274p,8b2,274c3,8p,8c#3,8d3,274p,8f3,274p,8d3,8c#3,8c3,274p,8b2,274c3,8p,8c#3,8d3,274p,8f3,274p,8d3,8c#3,

It's a horrible ringtone version of The Doors with Hello, I love you.

Download converted MIDI

Fabian Schmengler

Posted 2015-10-09T01:07:39.880

Reputation: 1 972

My player doesn't like it octave: 2, Cannot index into a null array.. The question said only octaves 4-8 are valid, so that's all I coded it for. Sounds good on the linked website, though. – TessellatingHeckler – 2015-10-09T07:09:20.187

Ah yes I forgot about this. Some players will support more octaves and some won't. The standard Nokia one only supports 4-8 which is why I mentioned that. – a spaghetto – 2015-10-09T13:33:13.623

8

H9+, 157,007 bytes

MIDI!!!!

Is too long for the post. So here, have a pastebin. (The pastebin doesn't have proper capitalization, FYI.) I used the following softwares:

The song is "Anthem of our Dying Day", by Story of the Year. It is the full, 3.5 minute song. ^-^.

It starts out with:

ANTHEM:d=4,o=5,b=120:172c#,86f#,86a4,172p,16p,43a4,86p,43f#4,172a4,10p,57a4,...

H, of course, prints Hello, World!. And there are no 9s nor +s in the code, I made sure. Good thing this isn't a .

Conor O'Brien

Posted 2015-10-09T01:07:39.880

Reputation: 36 228

Magnifique. +1 for you – a spaghetto – 2015-10-15T00:05:12.573

@quartata Merci! – Conor O'Brien – 2015-10-15T00:09:28.327

1Hmm, it sounds like a herd of llamas are running around on 10 pianos, is that intended, or some playback problem on my side? – aditsu quit because SE is EVIL – 2015-10-16T21:10:07.793

@aditsu It sort of is; it's just a rather intense rock song. – Conor O'Brien – 2015-10-16T22:28:06.950

4

-1 doesn't implement spec ("that outputs "Hello, World!" (exactly)") and isn't written in a programming language.

– Peter Taylor – 2015-10-17T07:24:48.410

@PeterTaylor Acknowledged. – Conor O'Brien – 2015-10-17T18:48:07.847

Most of your note durations are invalid – aditsu quit because SE is EVIL – 2015-10-21T10:33:42.190

@aditsu ANd yet, somehow, it still works. There's a MIDI, isn't there? – Conor O'Brien – 2015-10-21T10:57:20.783

That's because that site can handle some invalid values, not because you are using the correct format. – aditsu quit because SE is EVIL – 2015-10-21T11:33:24.887

7

123, 816 Bytes

H:d=4,o=4,b=400:2a,2b,2a,2b,1a,1b,2a,1b,1a,2b,1a,1b,1a,2b,1a,1b,2a,2b,2a,2b,2a,2b,2a,2b,1a,1b,2a,1b,1a,1b,1a,2b,1a,1b,1a,2b,1a,1b,2a,1b,1a,2b,2a,2b,2a,2b,2a,2b,2a,1b,1a,2b,1a,1b,2a,1b,1a,3b,3a,1b,2a,1b,1a,2b,1a,3b,1a,2b,1a,2b,1a,1b,2a,2b,2a,2b,2a,2b,2a,2b,1a,1b,1a,2b,1a,1b,2a,1b,3a,3b,1a,2b,1a,1b,2a,1b,3a,1b,2a,2b,2a,2b,2a,2b,2a,2b,1a,1b,1a,2b,1a,1b,3a,3b,2a,1b,1a,3b,3a,1b,2a,1b,1a,2b,2a,2b,2a,2b,2a,1b,1a,1b,2a,1b,1a,2b,3a,3b,1a,1b,2a,3b,3a,2b,2a,2b,2a,2b,2a,2b,1a,1b,1a,1b,2a,1b,1a,1b,1a,1b,2a,1b,1a,2b,2a,2b,2a,2b,1a,1b,1a,1b,2a,1b,1a,2b,1a,1b,2a,2b,2a,2b,2a,2b,2a,2b,1a,1b,2a,1b,1a,1b,1a,1b,2a,1b,1a,2b,1a,1b,2a,1b,1a,2b,2a,2b,2a,2b,2a,2b,1a,1b,1a,1b,1a,2b,1a,1b,2a,1b,1a,2b,1a,1b,2a,2b,2a,2b,2a,1b,3a,3b,1a,2b,1a,1b,2a,1b,3a,1b,2a,2b,2a,2b,2a,2b,2a,2b,1a,1b,2a,1b,1a,1b,3a,3b,2a,1b,1a,3b,3a,1b,2a,1b,1a,2b,1a

Download tune

This one is just rhythmic beeping, but the language surely has more potential for this challenge, since in 123, all characters except 1, 2 and 3 are ignored. Credits for the original 123 code go to Martin Büttner.

Fabian Schmengler

Posted 2015-10-09T01:07:39.880

Reputation: 1 972

Wow, never seen this language before. Nice one! – a spaghetto – 2015-10-11T00:34:50.187

2

Python 2.7, 1606 bytes

Okay, so it's not amazingly obfuscated, but it does work. I've converted it to a midi file and it does play.

The tune is Still Alive from Portal. I got the tune as a midi file from here, which I then converted into a RTTL. The last few notes are off, but I think that's okay.

print[':d=4,o=5,b=120:2p,8g,8f#,8e,8e,2f#,1p,8a4,8g,8f#,8e,e,f#.,d,8e,1a4,8p,8a4,e,8f#,g.,8e,c#,d.,e,8a4,a4,1f#,2p,8g,8f#,8e,8e,2f#,1p,8a4,8g,8f#,8e,e.,8f#,d.,8e,2a4,2p,e,8f#,g.,8e,c#.,8d,e,8a4,8d,8e,8f,8e,8d,8c,p,8a4,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a,512p,8a,512p,8b,512p,8a,512p,8f#,512p,d,p,8g,8p,8a,8p,2a,8p,8a,8a,512p,8a,512p,8b,512p,8a,512p,8f#,512p,d,p,8g,8p,8a,8p,2a,8p,8a,8a,512p,8a,512p,8b,512p,8a,512p,8f#,512p,d,p,8g,8p,8a,8p,2a,8p,8a,8a,512p,8a,512p,8b,512p,8a,512p,8f#,512p,d,p,8g,8p,8a,8p,a.,p.,8g,8a,a.,p.,8g,8f#,2f#',''.join(map(chr,[72,101,108,108,111,44,32,87,111,114,108,100,33]))][1]

Status

Posted 2015-10-09T01:07:39.880

Reputation: 995

Looks like it switched around the melody and backing/counter-melody parts in various places. There might be a version with just the melody somewhere. – cole – 2015-10-17T04:30:04.953

Um.. your program doesn't seem to be a valid RTTTL song – aditsu quit because SE is EVIL – 2015-10-17T07:00:51.353

@aditsu The only way I can check if its valid is by converting it to a midi file, so uh... you'll have to tell me how it's invalid. – Status – 2015-10-18T01:08:06.770

3Well, 2f#' doesn't seem to be a valid note, and neither is ''.join(map(chr, etc. – aditsu quit because SE is EVIL – 2015-10-18T22:02:29.063

@aditsu I can not locate any documentation on RTTTL that suggests such characters are invalid. I don't know how to load it into a phone, but I can convert the entire code to a midi file and that plays without crashing. – Status – 2015-10-18T23:53:45.030

1It's right here in the challenge text: "The format of a note is DPO, where D is the duration of the note […]" - read the whole paragraph. – aditsu quit because SE is EVIL – 2015-10-19T00:24:25.727

1

Lenguage

Hello: d=8,o=4,b=130: a, b, 4e5, a, b, 4e5, g, b, 4e5, g, b, 4e5, f, a, 4e5, f, a, 4e5, g, b, 4e5, f, a, 4e5, a, b, 4e5, a, b, 4e5, g, b, 4e5, g, b, 4e5, f, a, 4e5, f, a, 4e5, g, b, 4e5, f, a, e5, e, 4e, a, 4a., b, 4b., c5, 4c.5, 4d.5, 4c5, 2d5, p, g, b, 4e5, f, a, e5, e, e, 4a, 4a, 4b, 4b, 4c5, 2c5, b, c5, 4b, 2a, p, g, b, 4e5, f, a, e5, e, 4e, a, 4a., b, 4b., c5, 4c.5, 4d.5, 4c5, 2d5, p, g, b, 4e5, f, a, e5, d5, 2e5, a, b, 4e5, g, b, 4e5, g, b, d5, c5, e5, 4d.5, d5, c5, 4e5, a, c#5, 4e5, a, c#5, d5, e5, f5, e5, e5, d5, 2d5, g, b, 4d5, g, b, c5, d5, e5, d5, d5, c5, c5, g, 4a, f, a, 4c5, f, a, a#, c5, 4d.5, 4c.5, c5, a#, 4a, 2g#, f#, g#, 4a, a, 4b, a, 4c5, a, c5, 4e5, a, c5, d5, e5, 4f5, f5, 4f5, e5, 4d5, g, b, 4d5, g, b, c5, d5, 4e5, f5, 4e5, d5, c5, g, 2a, f, a, a#, c5, 4d5, c5, 4c5, 4a#, 4a, 2g#., 2p., p, f#, g#, 2a, a, b, 4e5, g, b, 4e5, g, b, 4e5, f, a, 4e5, f, a, 4e5, g, b, 4e5, f, a, 4e5, 4a, 4c#5, 1e5

Followed by many gazillions of spaces so that the total length is 150306725405247424813082671095009555930972306375297366901721134222563463360025683976401363734706798738542991492

Convert and download (note: the code is truncated to save bandwidth, but the resulting midi should be the same)

aditsu quit because SE is EVIL

Posted 2015-10-09T01:07:39.880

Reputation: 22 326

2Lionel Richie - "Hello" ? – LukStorms – 2015-10-18T11:29:30.870

@LukStorms yes! :) – aditsu quit because SE is EVIL – 2015-10-18T22:00:31.617