Classicamiga Forum Retro Edition
Thread: Arduino to play the audio file in Zx Spectrum
Tiago 10:52 29th October 2015
Hi,
some time ago i remember someone here to talk about a circuit to read the audio from a tape into the ZX Spectrum
Well i am trying to do something similar:
I bought an small cricuit that has a sdcard slot and a 2.5 output jack. It reads mp3/wav files. The price is +/- 5 euros.
I am using the Arduino, i am using the UNO 3, but it can be done with the smaller one, the Nano. I connect the mp3 board to the Arduino, put a mp3 in the scard, and with some wire and programming i was able to play the mp3 and listen in headphones. It needs a 5v but with the Arduino nano it can be done with 3v. I will now put a LCD screen to see the name of the files in the sdcard, and some buttons to choose the file and play it.
Putting the ZX game file in mp3 or wav and connect the Arduino into the ZX, i think i can create a player for the ZX with a size smaller then a credit card. Total production cost should be around 20 euros.

Arduino nano +/- 6 euros
LCD +/- 7 euros
MP3 card +/- 5 euros
Buttons +/- 2 euros
wire+solder +/- 50 cents

The lcd needs a lot of iron solder to put all cables connected to the arduino.
The game will take the same time to load, but you can have all games in the sdcard. It is the same concept to the Amiga HXC, but simple to do it.
I am sure someone did this before, but it's quite fun to do it yourself.
[Reply]
Buleste 09:24 30th October 2015
A friend and I made something for most 8-bits that use a standard tape deck and added motor control to it. We never got anyone with a Spectrum to test it though.

I'd love to see pictures and a link to the mp3/sdcard/audio output as that could make a lot of difference to the project with playback frequencies.

http://arduitapemarkii.blogspot.co.uk/
[Reply]
Tiago 12:25 30th October 2015
Hi Buleste, the circuit is this one:
http://www.dx.com/p/uart-control-ser...9#.VjNvkuztlHw
[Reply]
Buleste 14:50 30th October 2015
Originally Posted by Tiago:
Hi Buleste, the circuit is this one:
http://www.dx.com/p/uart-control-ser...9#.VjNvkuztlHw
Thanks for that I am seriously going to have to build another version of the Arduitape
[Reply]
Tiago 15:10 30th October 2015
The code is not that difficult. I was able to put it to play an mp3 and could do a play/pause with a input. It is easy to put a potentiometer to control volume. And 3 or 4 buttons to choose a file to play from the sdcard. this last part i need to read more about it.

check the base code:

/***********************************************************/
//Demo for the Serial MP3 Player by Catalex
//Hardware: Serial MP3 Player *1
//Board: Arduino UNO R3
//IDE: Arduino-1.0
//Function: To play the first song in the micro sd card.
//Store: http://www.aliexpress.com/store/1199788
// http://www.dx.com/
#include <SoftwareSerial.h>

#define ARDUINO_RX 5//should connect to TX of the Serial MP3 Player module
#define ARDUINO_TX 6//connect to RX of the module
SoftwareSerial mySerial(ARDUINO_RX, ARDUINO_TX);

static int8_t Send_buf[8] = {0} ;

#define CMD_PLAY_W_INDEX 0X03
#define CMD_SET_VOLUME 0X06
#define CMD_SEL_DEV 0X09
#define DEV_TF 0X02
#define CMD_PLAY 0X0D
#define CMD_PAUSE 0X0E
#define CMD_SINGLE_CYCLE 0X19
#define SINGLE_CYCLE_ON 0X00
#define SINGLE_CYCLE_OFF 0X01
#define CMD_PLAY_W_VOL 0X22

void setup()
{
mySerial.begin(9600);
delay(500);//Wait chip initialization is complete
sendCommand(CMD_SEL_DEV, DEV_TF);//select the TF card
delay(200);//wait for 200ms
sendCommand(CMD_PLAY_W_VOL, 0X0F01);//play the first song with volume 15 class
}
void loop()
{

}

void sendCommand(int8_t command, int16_t dat)
{
delay(20);
Send_buf[0] = 0x7e; //starting byte
Send_buf[1] = 0xff; //version
Send_buf[2] = 0x06; //the number of bytes of the command without starting byte and ending byte
Send_buf[3] = command; //
Send_buf[4] = 0x00;//0x00 = no feedback, 0x01 = feedback
Send_buf[5] = (int8_t)(dat >> 8);//datah
Send_buf[6] = (int8_t)(dat); //datal
Send_buf[7] = 0xef; //ending byte
for(uint8_t i=0; i<8; i++)//
{
mySerial.write(Send_buf[i]) ;
}
}
[Reply]
Buleste 15:45 30th October 2015
Did you have to rename the mp3 files to fit with the code?
[Reply]
Tags:Array
Up