Page 1 of 1

Red box/ blue box - old school fun...

Posted: Fri Oct 07, 2016 11:51 pm
by DrChip
Hi,
Here’s a link TO “Redbox_sounds” IN my DROPBOX:

https://www.DROPBOX.com/sh/48cw3pileq41 ... Lm5na?dl=0

Code: Select all

REM red box / blue box wip
REM just having fun... old school!
REM 1 = nickel, 2 = dime, 3 = quarter 
REM st and Koop soon
REM enjoy... oh, this is for education and fun. Please 
REM don't use in the real world!

init:
sw=SCREEN_WIDTH()
sh=SCREEN_HEIGHT()
ox=sw/3
oy=sh/2
d$="redbox_5_real.wav"
n$="redbox_10_real.wav"
q$="redbox_25_real.mp3"
MUSIC d$ LOAD d$
MUSIC n$ LOAD n$
MUSIC q$ LOAD q$
GRAPHICS
GOSUB drawpad

BUTTON "1" TEXT "1" AT 10,40 SIZE 100,40
BUTTON "2" TEXT "2" AT 110,40 SIZE 100,40
BUTTON "3" TEXT "3" AT 210,40 SIZE 100,40
BUTTON "4" TEXT "4" AT 10,80 SIZE 100,40
BUTTON "5" TEXT "5" AT 110,80 SIZE 100,40
BUTTON "6" TEXT "6" AT 210,80 SIZE 100,40
BUTTON "7" TEXT "7" AT 10,120 SIZE 100,40
BUTTON "8" TEXT "8" AT 110,120 SIZE 100,40
BUTTON "9" TEXT "9" AT 210,120 SIZE 100,40
BUTTON "#" TEXT "#" AT 10,160 SIZE 100,40
BUTTON "0" TEXT "0" AT 110,160 SIZE 100,40
BUTTON "*" TEXT "*" AT 210,160 SIZE 100,40

LOOP:
IF BUTTON_PRESSED("1") THEN MUSIC d$ PLAY
IF BUTTON_PRESSED("2") THEN MUSIC n$ PLAY
IF BUTTON_PRESSED("3") THEN MUSIC q$ PLAY
GOTO LOOP

drawpad:
'  1️⃣2️⃣3️⃣
'  4️⃣5️⃣6️⃣
'  7️⃣8️⃣9️⃣
'  #️⃣0️⃣*️⃣
'  •   •   •
'   5 10 25
 'full pad with st and kp soon
BUTTON "up" TEXT "⬆️" AT 45+ox,15+oy
BUTTON "press" TEXT "•" AT 45+ox,50+oy
BUTTON "down" TEXT "⬇️" AT 45+ox,85+oy
BUTTON "left" TEXT "⬅️" AT 0+ox,50+oy
BUTTON "right" TEXT "➡️" AT 90+ox,50+oy
RETURN

Re: Red box/ blue box - old school fun...

Posted: Sat Oct 08, 2016 12:05 am
by rbytes
Looks like fun. Will you be posting the three songs that the code calls for? I will comment those lines out for now, and try it without sound.

Re: Red box/ blue box - old school fun...

Posted: Sat Oct 08, 2016 12:13 am
by DrChip
The sound files are in my Dropbox at the top of the code. I posted the link above the code. I used sound files because I thought it was more accurate then generating two sounds (DTMF * 6.5536) for a modified red and blue box. I'll add a pay phone soon. :)

Re: Red box/ blue box - old school fun...

Posted: Sat Oct 08, 2016 12:29 am
by rbytes
Thanks!

Re: Red box/ blue box - old school fun...

Posted: Sat Oct 08, 2016 9:18 am
by Dutchman
This was abacadabra for me, until I found this: https://en.wikipedia.org/wiki/Red_box_(phreaking) :lol:
Most probably not legal :?

Re: Red box/ blue box - old school fun...

Posted: Sat Oct 08, 2016 9:35 am
by DrChip
I know... but have you seen a pay phone anywhere? I use to modify those radio shack dtmf hand dialers by replacing the crystal to make the * key to simulate coins. 1 beep for a nickel, 2 beeps for a dime and 5 beeps for a quarter.

Steve jobs and waz made these in the early '70's along with blue boxes when rotary phones were around. They even sold them on campus. It's out dated now, but I'm sure it still works in a very small percentage of places.

With cell phones so accessible, pay phones are becoming extinct! :)

Re: Red box/ blue box - old school fun...

Posted: Sat Oct 08, 2016 10:09 am
by DrChip
Please note: this is for educational purposes and history needs. It's not to be used on a real pay phone!

Jobs box is in a museum today, but it's shows you how wild things were back in the day. :)

For whatever it’s worth, I was able to implement this in Java using the Javax JSP stuff:
************************************************

Code: Select all

package org.drg00n.util.dtmf;

import javax.sound.sampled.AudioFormat;
import javax.sound.sampled.AudioSystem;
import javax.sound.sampled.SourceDataLine;

/*Implement a DTMF dialer with javax’s DSP
* Tone tables are in tones.java
*/

public class DTMF {

public static void generateTones(float hz1, float hz2, int msecs, int volume)
throws Exception {
float frequency = 44100.0F;
int samplesize = 8;
int channels;
boolean signed = true;
boolean bigendian = false;
byte[] buf;
double ttpi = (2.0 * Math.PI);
AudioFormat format;
buf = new byte[2];
channels = 1;
format = new AudioFormat(frequency, samplesize, channels, signed,
bigendian);
SourceDataLine sdl = AudioSystem.getSourceDataLine(format);
sdl.open(format);
sdl.start();
for (int i = 0; i < msecs * frequency / 1000; i++) {

double angle = i / (frequency / hz1) * ttpi;
double angle2 = i / (frequency / hz2) * ttpi;
buf[0] = (byte) (((Math.sin(angle)) + (Math.sin(angle2))) * 10);
sdl.write(buf, 0, 1);
}
sdl.drain();
sdl.stop();
sdl.close();
}
}

********************************************
then create a class for the coins using your data on the frequencies and times for each coin:
********************************************

package org.drg00n.util.dtmf;

public class payphone {

public static void qaurter() throws Exception {
DTMF.generateTones(1700, 2200, 33, 100);
DTMF.generateTones(0, 0, 33, 100);
DTMF.generateTones(1700, 2200, 33, 100);
DTMF.generateTones(0, 0, 33, 100);
DTMF.generateTones(1700, 2200, 33, 100);
DTMF.generateTones(0, 0, 33, 100);
DTMF.generateTones(1700, 2200, 33, 100);
DTMF.generateTones(0, 0, 33, 100);
DTMF.generateTones(1700, 2200, 33, 100);
DTMF.generateTones(0, 0, 33, 100);
}

public static void dime() throws Exception {
DTMF.generateTones(1700, 2200, 66, 100);
DTMF.generateTones(0, 0, 66, 0);
DTMF.generateTones(1700, 2200, 66, 100);
}

public static void nickle() throws Exception {
DTMF.generateTones(1700, 2200, 66, 100);
}
}

************************************************
then you call the coin you want and it beeps out of the sound card:

a main class to beep the coin tones:
************************************

package org.drg00n.util.dtmf;

public class dialer {

public static void main(String[] args) {

/*
* Dial some DTMF Tones:
*/

try {

//	payphone.dime();
//	payphone.nickle();
payphone.qaurter();

} catch (Exception e) {
e.printStackTrace();
}
}

}