Escolar Documentos
Profissional Documentos
Cultura Documentos
(/pt/)
Explorar (/pt/explore/)
vamos fazer:
Criar (/pt/editInstructable/)
Concursos (/pt/contest/)
Sobre (/pt/about/)
Voc
Arduino Chiptunes
0
0
Portugus
(/id/Arduino-Chiptunes/?lang=pt)
8 Etapas
(/id/Arduino-Chiptunes/0/?lang=pt)
Favorito
8 28.878
Y 98
Postado em:
Dez 11, 2011
visualizaes
Licena:
favoritos
blinkyblinky
(/pt/member/blinkyblinky/)
()
Seguir
(/pt/member/blinkyblinky/)
Bio: If you want me to build
something...I'm open to ideas. I like to
hack with electronics, mix with chemicals
and play with ideas ... Mais
(/pt/member/blinkyblinky/)
(/file/FGGGG3RGVZOHZF6/)
I am not a big fan of programming. I may like it but, I try to keep it down to a 555
timer like in this ible (http://www.instructables.com/id/The-Versatile-555-Timer/).
However, when it comes to synths, well, I just NEED programming. One day,
while exploring Synthesizers, I came across something known as chiptunes.
I decided to listen and found the music just totally awesome. And so I tried to
make it with Arduino. Unfortunately, it didn't fit the Arduino code. Fortunately,
Stimmer in the Arduino Forums had ported Linus kesson's Hardware Chiptune
Project and made it to fit the Arduino.
UPDATE: THERE HAS BEEN AN UPDATE TO THE CODE. REPROGRAM
THE ARDUINO WITH THE NEW CODE AND PUT AN LED ON PIN 12 AND
PIN 10 (WITH RESISTORS) AND THEY WILL PLAY ALONG WITH THE
"DRUMS"
(/id/How-to-Tie-
Your-Shoes-Cool-So-they-Dont-
Undo/?lang=pt)
(/id/Valentines-Pulse-Sensor/?lang=pt)
(/id/10-Minute-
Sunglass-Neutral-Density-Filter/?
lang=pt)
Tags:
Chiptunes (/pt/explore/?keywords=Chiptunes)
Arduino (/pt/explore/?keywords=Arduino)
Arduino (/pt/explore/?keywords=Arduino)
Relacionado
Dual POKEY Synth (/id/DualPOKEY-Synth/?lang=pt)
por brianpeters
(/pt/member/brianpeters/)
(/id/Dual-
(/id/Arduino-
(/id/TIA-
(/id/Quad-
(/id/Teensy-
(/file/FCQHN6QGVZPGZOH/)
(/file/FLVSBXFGVZP1MTV/)(/file/FDXTDI6GVZP1MTW/)
Arduino Chiptunes-Yet
Again...Install an Arduino
Library (/id/ArduinoChiptunes-Yet-AgainInstallan-Arduino-L/?lang=pt)
TIA Synth (/id/TIA-Synth/?
lang=pt)
por brianpeters
(/pt/member/brianpeters/)
Quad SN76489 Synth
(/id/Quad-SN76489-Synth/?
lang=pt)
por brianpeters
(/pt/member/brianpeters/)
Teensy Synth (/id/TeensySynth/?lang=pt)
por brianpeters
(/pt/member/brianpeters/)
SID Synth (/id/SID-Synth/?
lang=pt)
por brianpeters
(/pt/member/brianpeters/)
if(!trackpos)
{
Even
headphones
woud work!
if(playsong) {
if(songpos >= SONGLEN) {
Now I'm sure you want to use the one with a built in amplifier and so, I am
playsong = 0;
developing
} else { a way so that you won't have to cut the cable on your expensive
amp. for(ch = 0; ch < 4; ch++) {
u8 gottransp;
u8 transp;
Passo
3: Programming.
gottransp
= readchunk(&songup, 1);
channel[ch].tnum = readchunk(&songup, 6);
if(gottransp) {
transp = readchunk(&songup, 4);
if(transp & 0x8) transp |= 0xf0;
} else {
transp = 0;
}
channel[ch].transp = (s8) transp;
if(channel[ch].tnum) {
initup(&channel[ch].trackup, resources[16 + channel[ch].tnum - 1]);
}
}
songpos++;
}
}
}
if(playsong) {
for(ch = 0; ch < 4; ch++) {
if(channel[ch].tnum) {
u8 note, instr, cmd, param;
(/file/F9STWW0GU1UZ8K3/)
u8 fields;
fields = readchunk(&channel[ch].trackup, 3);
note = 0;
instr = 0;
cmd = 0;
param = 0;
(/file/F3EZLJZGW0HROR7/)
(/file/F51PW4DGU4MC72T/)
if(fields & 1) note = readchunk(&channel[ch].trackup, 7);
if(fields & 2) instr = readchunk(&channel[ch].trackup, 4);
if(fields & 4) {
Start by
cmd
downloading
= readchunk(&channel[ch].trackup,
the code from below.4);
param = readchunk(&channel[ch].trackup, 8);
Then,} copy and paste the code into the Arduino editor and compile, then hit
if(note) {
upload.
channel[ch].tnote = note + channel[ch].transp;
if(!instr) instr = channel[ch].lastinstr;
You're done with the software!
}
if(instr) {
Here isif(instr
the code
case=the
== 2) in
light[1]
5; download is unsuccessful:
if(instr == 1) {
light[0] = 5;
if(channel[ch].tnum == 4) {
light[0] = light[1] = 3;
}
}
if(instr == 7) {
light[0] = light[1] = 30;
}
channel[ch].lastinstr = instr;
channel[ch].inum = instr;
channel[ch].iptr = 0;
channel[ch].iwait = 0;
channel[ch].bend = 0;
channel[ch].bendd = 0;
channel[ch].volumed = 0;
channel[ch].dutyd = 0;
channel[ch].vdepth = 0;
}
Passo 4: Assembly.
(/file/FCQHN6QGVZPGZOH/)
You may be done with the software but the hardware is not finished.
Now, take one of your speaker wires, and then plug it into pin 3 which is a PWM
pin. Then, plug it into ground or power (5 volts or you bust you Arduino. )
You should hear music playing.
Now, hit the reset button to here it from the beginning.
Everytime you hit the reset button, it will play.
Passo 5: Done.
(/file/FGGGG3RGVZOHZF6/)
(/file/FOZFSWFGVZP1MTT/)
(/file/FDXTDI6GVZP1MTW/)
0x90, 0x4d, 0x02, 0x89, 0xd9, 0x24, 0x90, 0xa0, 0x51, 0x02, 0x89, 0xd8,
0xe5, 0x90, 0x90, 0x4d, 0x82, 0xef, 0x74, 0xe6, 0x34, 0x82, 0xf0, 0x7c,
0x26, 0x35, 0x84, 0xf1, 0x64, 0x66, 0x35, 0x82, 0xf2, 0x6c, 0xe6, 0x34,
0x82, 0xc9, 0x84, 0xe6, 0x34, 0x82, 0xc9, 0x84, 0x26, 0x35, 0x84, 0xc9,
0x8c, 0x66, 0x35, 0x8e, 0xc9, 0x8c, 0xe6, 0x34, 0x8c, 0xf8, 0xcc, 0xe7,
0x34, 0x8c, 0xf8, 0xcc, 0x27, 0x35, 0x8c, 0xf8, 0xcc, 0x67, 0x35, 0x8c,
0xf8, 0xcc, 0xe7, 0x34, 0x8c, 0xf8, 0xcc, 0xe7, 0x34, 0x8c, 0xf8, 0xcc,
0x27, 0x35, 0x88, 0xed, 0xcc, 0xe7, 0x35, 0x90, 0xee, 0x28, 0x5a, 0x03,
0x09, 0x03, 0x08, 0xff, 0x07, 0x01, 0x09, 0x02, 0x01, 0x90, 0x0b, 0x31,
0x05, 0xa0, 0x02, 0xf0, 0x00, 0x08, 0xff, 0x09, 0x03, 0x07, 0x02, 0x09,
0x02, 0x0b, 0x31, 0x01, 0x70, 0x05, 0xd0, 0x07, 0x02, 0x02, 0xf8, 0x04,
0x01, 0x00, 0x09, 0x02, 0x06, 0x05, 0x0b, 0x31, 0x08, 0xff, 0x02, 0xf0,
0x07, 0x06, 0x02, 0x00, 0x07, 0x16, 0x0a, 0x25, 0x00, 0x09, 0x03, 0x08,
0xff, 0x07, 0x01, 0x09, 0x00, 0x06, 0x05, 0x0b, 0x3d, 0x02, 0xf0, 0x07,
0x06, 0x02, 0x00, 0x07, 0x20, 0x02, 0xf0, 0x00, 0x09, 0x03, 0x08, 0xff,
0x07, 0x01, 0x09, 0x02, 0x01, 0x50, 0x06, 0x01, 0x0b, 0x31, 0x07, 0x05,
0x02, 0xfe, 0x00, 0x09, 0x02, 0x01, 0x80, 0x0b, 0x3d, 0x08, 0xc0, 0x02,
0x08, 0x07, 0x02, 0x02, 0xf0, 0x07, 0x02, 0x02, 0x00, 0x07, 0x16, 0x0a,
0x34, 0x00, 0x09, 0x03, 0x08, 0xff, 0x02, 0xfc, 0x00, 0x03, 0x00, 0x09,
0x03, 0x08, 0xff, 0x07, 0x01, 0x09, 0x02, 0x06, 0x05, 0x02, 0xff, 0x0b,
0x3d, 0x07, 0x03, 0x0b, 0x38, 0x07, 0x03, 0x0b, 0x34, 0x07, 0x03, 0x0b,
0x31, 0x07, 0x03, 0x04, 0x07, 0x00, 0x03, 0x00, 0x09, 0x03, 0x08, 0xff,
0x07, 0x01, 0x09, 0x02, 0x06, 0x05, 0x02, 0xff, 0x0b, 0x3d, 0x07, 0x03,
0x0b, 0x38, 0x07, 0x03, 0x0b, 0x35, 0x07, 0x03, 0x0b, 0x31, 0x07, 0x03,
0x04, 0x07, 0x00, 0x03, 0x00, 0x09, 0x03, 0x08, 0xff, 0x07, 0x01, 0x09,
0x02, 0x06, 0x05, 0x02, 0xff, 0x0b, 0x3d, 0x07, 0x03, 0x0b, 0x38, 0x07,
0x03, 0x0b, 0x36, 0x07, 0x03, 0x0b, 0x31, 0x07, 0x03, 0x04, 0x07, 0x00,
0x09, 0x03, 0x08, 0xff, 0x07, 0x01, 0x09, 0x00, 0x06, 0x05, 0x0b, 0x3d,
0x02, 0xf0, 0x07, 0x06, 0x02, 0x00, 0x07, 0x06, 0x0a, 0x25, 0x00, 0x09,
0x03, 0x08, 0xff, 0x02, 0xf0, 0x00, 0x08, 0xc4, 0x09, 0x00, 0x06, 0x05,
0x0b, 0x3d, 0x02, 0xf0, 0x07, 0x06, 0x02, 0x00, 0x07, 0x06, 0x0a, 0x25,
0x00, 0x00, 0x00, 0x6b, 0x04, 0x00, 0x20, 0x0d, 0x2c, 0x23, 0x58, 0x23,
0x00, 0xb4, 0x81, 0x80, 0x44, 0xc0, 0x34, 0x90, 0x06, 0xd2, 0xc0, 0x32,
0x02, 0x60, 0x8d, 0x40, 0x1a, 0x00, 0x11, 0x00, 0x6b, 0x04, 0xd2, 0x00,
0x00, 0x2c, 0x23, 0x00, 0x80, 0x35, 0x02, 0x00, 0x90, 0x06, 0x80, 0x65,
0x04, 0x00, 0x00, 0x00, 0x94, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x38, 0x00, 0x8b, 0x45, 0x62,
0x89, 0x25, 0x96, 0x18, 0x12, 0x03, 0x90, 0x18, 0xc2, 0x42, 0x58, 0x00,
0xc2, 0x42, 0x4a, 0x48, 0x09, 0x01, 0x21, 0x20, 0x00, 0x2b, 0x1d, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xcb,
0x08, 0x11, 0x6a, 0x8d, 0x48, 0x23, 0x0d, 0xa4, 0x81, 0x65, 0x84, 0x08,
0xd0, 0x0c, 0x42, 0x11, 0x01, 0xd6, 0x08, 0xa4, 0x81, 0x65, 0x84, 0x08,
0xb5, 0x46, 0x20, 0x0d, 0xa4, 0x81, 0x65, 0x84, 0x08, 0xb5, 0x46, 0x20,
0x8d, 0x34, 0xd2, 0x48, 0x03, 0x6b, 0x04, 0x00, 0x20, 0x0d, 0x2c, 0x23,
0x44, 0x80, 0x35, 0x02, 0x40, 0x1b, 0x08, 0x98, 0xc6, 0x32, 0x42, 0x04,
0x58, 0x23, 0x90, 0x06, 0xd2, 0xc0, 0x32, 0x82, 0x35, 0x02, 0xcb, 0x08,
0x11, 0x20, 0x19, 0x22, 0x00, 0x6b, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xa7, 0xd1, 0x00, 0x20, 0x25,
0x84, 0x86, 0xcc, 0x90, 0x12, 0x12, 0x43, 0x6c, 0xc8, 0x0c, 0xa1, 0x21,
0x25, 0x84, 0x86, 0xcc, 0x90, 0x12, 0x12, 0x43, 0x66, 0xc8, 0x0b, 0xc7,
0xcd, 0x00, 0x00, 0x44, 0x60, 0x00, 0x48, 0x0c, 0x20, 0x02, 0x03, 0x40,
0x70, 0x44, 0x20, 0x22, 0x00, 0x82, 0x23, 0x02, 0x24, 0x07, 0x10, 0x01,
0x62, 0x23, 0x02, 0xa4, 0x87, 0xdc, 0x00, 0xc3, 0x0d, 0x40, 0x04, 0x06,
0x80, 0xc4, 0x00, 0x22, 0x30, 0x00, 0x04, 0x87, 0xd8, 0x10, 0x1a, 0x11,
0x20, 0x31, 0x80, 0x08, 0x10, 0x1a, 0x11, 0x20, 0xb8, 0xe4, 0xb2, 0x4b,
0x0f, 0x03, 0x0e, 0x80, 0x00, 0x91, 0x1e, 0x80, 0xe4, 0x10, 0x21, 0x02,
0x44, 0x7e, 0x08, 0x10, 0x11, 0x22, 0x3b, 0x00, 0xc1, 0x21, 0x33, 0xc4,
0x06, 0x03, 0x0e, 0xf2, 0x03, 0x11, 0x00, 0xe9, 0x01, 0x00, 0x00, 0x00,
0x00, 0x28, 0xfe, 0x00, 0x00, 0x00, 0x00, 0x00, 0x8b, 0x0d, 0x11, 0x20,
0x33, 0x22, 0x30, 0x10, 0x1a, 0x88, 0x00, 0x48, 0x8c, 0x08, 0x1c, 0x1b,
0x11, 0x20, 0x31, 0x22, 0x40, 0x70, 0xb1, 0x85, 0x86, 0xe0, 0x88, 0x00,
0xb1, 0x21, 0x34, 0x22, 0x40, 0x66, 0x44, 0x80, 0xc4, 0x00, 0x00, 0x63,
0x0d, 0xe7, 0x3f, 0x25, 0x24, 0x86, 0x94, 0x10, 0x16, 0x52, 0x42, 0x62,
0x0d, 0xe7, 0x3f, 0x25, 0x24, 0x86, 0x94, 0x10, 0x16, 0x52, 0x42, 0x62,
0x1c, 0x80, 0x94, 0x10, 0x5a, 0x66, 0x89, 0x85, 0x15, 0x55, 0x50, 0x29,
0x05, 0x14, 0x4e, 0x3c, 0xf9, 0x04, 0x94, 0x52, 0x5a, 0x89, 0x05, 0x07,
0x2b, 0x0d, 0xe7, 0x3f, 0x19, 0x24, 0x83, 0xa0, 0x60, 0x0c, 0x52, 0x42,
0x58, 0xc8, 0x08, 0x29, 0x21, 0x19, 0x24, 0x83, 0xa0, 0x90, 0x17, 0xc2,
0xe2, 0x00, 0xa4, 0x94, 0x53, 0x50, 0x61, 0x01, 0x63, 0x0d, 0xe7, 0x3f,
0x31, 0x24, 0x83, 0xb0, 0x90, 0x12, 0x92, 0x41, 0x58, 0x44, 0x80, 0xc6,
0x06, 0x80, 0x08, 0x90, 0x0c, 0xe7, 0x3f, 0x2c, 0xa4, 0x84, 0x64, 0x90,
0x12, 0x92, 0xe1, 0x00, 0x84, 0x45, 0x04, 0xc8, 0x8b, 0x08, 0x00, 0xa3,
0x0d, 0x11, 0x20, 0x36, 0x00, 0xc1, 0x11, 0x01, 0x81, 0xd0, 0x90, 0x5d,
0x72, 0xc1, 0x21, 0x3b, 0xa4, 0x87, 0xfc, 0x88, 0x00, 0x11, 0x02, 0x08,
0x0e, 0x99, 0x21, 0x36, 0x00, 0x6b, 0x14, 0x12, 0x00, 0x00, 0x80, 0x08,
0x00, 0xc4, 0x10, 0x44, 0x16, 0x48, 0x03, 0x09, 0x20, 0x01, 0x00, 0x20,
0x02, 0x00, 0x00, 0x00, 0x00, 0xb0, 0x46, 0x01, 0x44, 0x40, 0x20, 0x0d,
0x10, 0x01, 0x90, 0x06, 0x12, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x4b,
0x14, 0x00, 0x20, 0x15, 0x10, 0x01, 0x10, 0x08, 0x92, 0x40, 0x0c, 0xc8,
0x02, 0x59, 0x00, 0x44, 0x80, 0x20, 0x88, 0xc0, 0x40, 0x06, 0x44, 0x60,
0x20, 0x08, 0x00, 0x0b, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x4b, 0x14, 0x00, 0x20, 0x15, 0x10, 0x01,
0x10, 0x08, 0x92, 0x40, 0x0c, 0x08, 0x02, 0x41, 0x00, 0x44, 0x80, 0x20,
0x88, 0xc0, 0x40, 0x06, 0x44, 0x60, 0x20, 0x08, 0x00, 0x43, 0x19, 0x00,
0x00, 0x00, 0x80, 0x8c, 0x40, 0x04, 0x40, 0x56, 0x00, 0x40, 0x04, 0x88,
0x0a, 0x00, 0x88, 0x00, 0x41, 0x01, 0x44, 0x00, 0x3b, 0x19, 0x00, 0x10,
0x01, 0x82, 0x22, 0x02, 0x44, 0x05, 0x00, 0x00, 0x00, 0x4a, 0x3f, 0x00,
0x00, 0x00, 0x00, 0x00, 0x23, 0x19, 0x00, 0x00, 0x00, 0x80, 0x98, 0x00,
0x04, 0x05, 0x00, 0x00, 0x42, 0x02, 0x58, 0xf8, 0x00, 0x00, 0x1b, 0x19,
0x00, 0x00, 0xa0, 0xfc, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x3b, 0x19, 0x80, 0x9c, 0x10, 0x14, 0x80, 0xa0, 0x10, 0x15, 0x00,
0x0a, 0x3e, 0x80, 0xb4, 0x00, 0xa4, 0x85, 0xa8, 0x88, 0x00, 0x21, 0x11,
0x01, 0x32, 0x22, 0x02, 0x00, 0x43, 0x19, 0x00, 0x0a, 0x3f, 0x80, 0xac,
0x00, 0x50, 0xf8, 0x01, 0x44, 0x05, 0x80, 0xc2, 0x0f, 0x20, 0x26, 0xb0,
0x06, 0x00, 0x00, 0x43, 0x19, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x23, 0x14, 0x80, 0x10, 0x10, 0x08, 0x80,
0x2c, 0x10, 0x07, 0xf2, 0x40, 0x08, 0x00, 0x42, 0x40, 0x20, 0x00, 0xb2,
0x40, 0x20, 0x81, 0x64, 0x11, 0x02, 0x5b, 0x14, 0x80, 0x2c, 0x90, 0x0b,
0x80, 0x18, 0x90, 0x04, 0xa2, 0x40, 0x16, 0x00, 0xd2, 0x00, 0x10, 0x07,
0x80, 0x3c, 0x58, 0xe0, 0x00, 0x63, 0x14, 0xc2, 0x00, 0x11, 0x00, 0x39,
0x20, 0x0a, 0x84, 0x01, 0x22, 0x00, 0xa2, 0x40, 0x18, 0x08, 0x03, 0x44,
0x00, 0xe4, 0x80, 0x3c, 0x10, 0x07, 0xc2, 0x40, 0x0a, 0x00, 0x3b, 0x14,
0x72, 0x00, 0x90, 0x09, 0x80, 0x40, 0x10, 0x07, 0xb2, 0x40, 0x12, 0x39,
0xe4, 0x92, 0x4a, 0x26, 0x81, 0xc4, 0x91, 0x44, 0x0e, 0x00, 0x92, 0x00,
0x00, 0x5b, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x63, 0x14, 0x00, 0x00, 0x00, 0x80, 0x30, 0x00, 0xc4,
0x01, 0x00, 0x00, 0x00, 0x20, 0x0e, 0x00, 0x83, 0x14, 0x00, 0x20, 0x10,
0x10, 0x01, 0x00, 0x84, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x2b, 0x1d, 0x00, 0x00, 0x00, 0x86, 0x42, 0x00, 0x41, 0x11, 0x01, 0x82,
0x02, 0x00, 0x84, 0x46, 0x04, 0x04, 0x42, 0x23, 0x02, 0x04, 0x05, 0x00,
0x1b, 0x25, 0x00, 0x10, 0x01, 0xf2, 0x22, 0x02, 0x02, 0x19, 0x01, 0xc8,
0x88, 0x08, 0x90, 0x17, 0x80, 0x8c, 0x00, 0x64, 0x84, 0xbc, 0x90, 0x11,
0x00, 0x23, 0x25, 0x00, 0x10, 0x01, 0x02, 0x23, 0x02, 0x02, 0x21, 0x01,
0x08, 0x89, 0x08, 0x10, 0x12, 0x00, 0x20, 0x30, 0x22, 0x20, 0x10, 0x18,
0x11, 0x20, 0x24, 0x00, 0x5b, 0x25, 0x11, 0x20, 0x1f, 0x80, 0x08, 0x90,
0x15, 0x11, 0x20, 0x2b, 0x22, 0x40, 0x3e, 0x00, 0x11, 0x20, 0x2b, 0x22,
0x40, 0x56, 0x44, 0x80, 0x7c, 0x00, 0x22, 0x40, 0x3e, 0x00, 0xb2, 0x22,
0x02, 0x02, 0xf9, 0x10, 0x01, 0x00, 0x23, 0x25, 0x80, 0x90, 0x88, 0x00,
0x81, 0x81, 0x08, 0x80, 0xc0, 0x88, 0x00, 0x21, 0x01, 0x88, 0x09, 0x44,
0x00, 0xc4, 0x44, 0x04, 0x88, 0x0c, 0x20, 0x02, 0x44, 0x46, 0x04, 0x88,
0x89, 0x08, 0x10, 0x19, 0x11, 0x00, 0xa3, 0x25, 0x42, 0x0b, 0x2d, 0x34,
0x22, 0x40, 0x50, 0x20, 0x02, 0x20, 0x28, 0x22, 0x40, 0x50, 0x08, 0x0d,
0x41, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0xa3, 0x29, 0x42, 0x0b, 0x2a,
0x34, 0x22, 0x40, 0x50, 0x20, 0x02, 0x20, 0x28, 0x22, 0x40, 0x50, 0x00,
0x42, 0x43, 0x68, 0xa1, 0x85, 0x46, 0x04, 0x08, 0x0a, 0x44, 0x00, 0x04,
0x45, 0x04, 0x08, 0x0a, 0xa1, 0x01, 0x0b, 0x25, 0x00, 0x00, 0x00, 0x00,
0x00, 0xc8, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x2b, 0x21, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x2b,
0x1d, 0x00, 0x00, 0x18, 0x6b, 0x91, 0x12, 0x80, 0xb0, 0x90, 0x18, 0xc2,
0x42, 0x4a, 0x08, 0x8d, 0x02, 0x90, 0x19, 0xc2, 0x42, 0x4a, 0x88, 0x0d,
0xc3, 0x2d, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x48, 0x0c,
0xa1, 0xc5, 0x96, 0x5b, 0x70, 0xd9, 0xa5, 0x07, 0x03, 0x2e, 0x00, 0x00,
0x48, 0x0f, 0x40, 0x80, 0x00, 0xf2, 0x23, 0x02, 0x64, 0x07, 0x22, 0x00,
0x82, 0x03, 0x10, 0x1c, 0x11, 0x20, 0x3f, 0x64, 0x07, 0x03, 0x6e, 0x7e,
0xe9, 0x05, 0x17, 0x5a, 0x66, 0xb1, 0x65, 0x16, 0x5a, 0x66, 0x89, 0x85,
0x95, 0x57, 0x54, 0x99, 0xe5, 0x95, 0x18, 0x11, 0x20, 0x31, 0x22, 0x40,
0x62, 0x44, 0x80, 0xc4, 0x00, 0x22, 0x40, 0x62, 0x44, 0x80, 0xf4, 0x88,
0x00, 0x89, 0x11, 0x01, 0x00, 0x03, 0x2e, 0x12, 0x43, 0x62, 0x48, 0x0f,
0x89, 0x21, 0x3d, 0x44, 0x18, 0x60, 0x7e, 0x08, 0x10, 0x89, 0x21, 0x31,
0xa4, 0x87, 0xc4, 0x90, 0x1e, 0x22, 0x0c, 0x30, 0x3f, 0x00, 0xfb, 0x2d,
0x02, 0x24, 0x02, 0x84, 0x48, 0x04, 0x48, 0x6f, 0xc4, 0x9e, 0x70, 0xd7,
0xeb, 0xc5, 0x76, 0xc2, 0x1e, 0x70, 0x17, 0xeb, 0xe1, 0x76, 0xc0, 0xde,
0x6f, 0xd7, 0xeb, 0xc5, 0x76, 0xbf, 0xde, 0x6e, 0x17, 0xeb, 0xe1, 0x76,
0xbb, 0x1e, 0x6e, 0x87, 0xeb, 0xc5, 0x76, 0xc4, 0xde, 0x6e, 0x17, 0xeb,
0xf5, 0x36, 0x3f, 0xa3, 0x0d, 0x00, 0x00, 0x48, 0x0c, 0x40, 0x68, 0x00,
0x32, 0x03, 0x00, 0x00, 0x89, 0x01, 0xc8, 0x0b, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xbd, 0x26, 0xb1, 0xcc,
0x00, 0x7f, 0x4d, 0x41, 0x00, 0x48, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x2b, 0x21, 0x11, 0x20, 0x25, 0x80, 0x08,
0x90, 0x58, 0x62, 0x29, 0x11, 0x01, 0x52, 0x22, 0x02, 0x00, 0x29, 0x11,
0x01, 0x56, 0x52, 0x22, 0x00, 0x90, 0x12, 0x11, 0x60, 0x25, 0x24, 0x02,
0x00, 0x29, 0x11, 0x01, 0x52, 0x22, 0x02, 0xa4, 0x44, 0x04, 0x00, 0xcf,
0xcc, 0xc0, 0x11, 0x01, 0x52, 0x22, 0x02, 0xa4, 0x44, 0x04, 0x48, 0x86,
0x08, 0x90, 0x12, 0x11, 0x20, 0x19, 0x22, 0x40, 0x4a, 0x44, 0x80, 0x94,
0x88, 0x00, 0xc9, 0x10, 0x01, 0x52, 0x22, 0x02, 0xa4, 0x44, 0x04, 0x48,
0x86, 0x08, 0x90, 0x12, 0x11, 0xa0, 0x99, 0x01, 0x68, 0x46, 0x80, 0x53,
0x22, 0x02, 0xa4, 0x44, 0x04
};
volatile u8 callbackwait;
volatile u8 lastsample;
volatile u8 timetoplay;
volatile u8 test;
volatile u8 testwait;
u8 trackwait;
u8 trackpos;
u8 playsong;
u8 songpos;
u32 noiseseed = 1;
u8 light[2];
/*const u16 freqtable[] = {
0x010b, 0x011b, 0x012c, 0x013e, 0x0151, 0x0165, 0x017a, 0x0191, 0x01a9,
0x01c2, 0x01dd, 0x01f9, 0x0217, 0x0237, 0x0259, 0x027d, 0x02a3, 0x02cb,
0x02f5, 0x0322, 0x0352, 0x0385, 0x03ba, 0x03f3, 0x042f, 0x046f, 0x04b2,
0x04fa, 0x0546, 0x0596, 0x05eb, 0x0645, 0x06a5, 0x070a, 0x0775, 0x07e6,
0x085f, 0x08de, 0x0965, 0x09f4, 0x0a8c, 0x0b2c, 0x0bd6, 0x0c8b, 0x0d4a,
0x0e14, 0x0eea, 0x0fcd, 0x10be, 0x11bd, 0x12cb, 0x13e9, 0x1518, 0x1659,
0x17ad, 0x1916, 0x1a94, 0x1c28, 0x1dd5, 0x1f9b, 0x217c, 0x237a, 0x2596,
0x27d3, 0x2a31, 0x2cb3, 0x2f5b, 0x322c, 0x3528, 0x3851, 0x3bab, 0x3f37,
0x42f9, 0x46f5, 0x4b2d, 0x4fa6, 0x5462, 0x5967, 0x5eb7, 0x6459, 0x6a51,
0x70a3, 0x7756, 0x7e6f
u8 tnote;
u8 lastinstr;
u8 inum;
u16 iptr;
u8 iwait;
u8 inote;
s8 bendd;
s16 bend;
s8 volumed;
s16 dutyd;
u8 vdepth;
u8 vrate;
u8 vpos;
s16 inertia;
u16 slur;
} channel[4];
u16 resources[16 + MAXTRACK];
struct unpacker songup;
byte readsongbyte(u16 offset)
{
return pgm_read_byte_near(&songdata[0] + offset);
}
void watchdogoff()
{
}
void initup(struct unpacker *up, u16 offset) {
up->nextbyte = offset;
up->bits = 0;
}
u8 readbit(struct unpacker *up) {
u8 val;
if(!up->bits) {
up->buffer = readsongbyte(up->nextbyte++);
up->bits = 8;
}
up->bits--;
val = up->buffer & 1;
up->buffer >>= 1;
return val;
}
u16 readchunk(struct unpacker *up, u8 n) {
u16 val = 0;
u8 i;
for(i = 0; i < n; i++) {
if(readbit(up)) {
val |= (1 << i);
}
}
return val;
}
void readinstr(byte num, byte pos, byte *dest) {
dest[0] = readsongbyte(resources[num] + 2 * pos + 0);
dest[1] = readsongbyte(resources[num] + 2 * pos + 1);
}
void runcmd(u8 ch, u8 cmd, u8 param) {
switch(validcmds[cmd]) {
case '0':
channel[ch].inum = 0;
break;
case 'd':
osc[ch].duty = param << 8;
break;
case 'f':
channel[ch].volumed = param;
break;
case 'i':
channel[ch].inertia = param << 1;
break;
case 'j':
channel[ch].iptr = param;
break;
case 'l':
channel[ch].bendd = param;
break;
case 'm':
channel[ch].dutyd = param << 6;
break;
case 't':
channel[ch].iwait = param;
break;
case 'v':
osc[ch].volume = param;
break;
case 'w':
osc[ch].waveform = param;
break;
case '+':
channel[ch].inote = param + channel[ch].tnote - 12 * 4;
break;
case '=':
channel[ch].inote = param;
break;
case '~':
if(channel[ch].vdepth != (param >> 4)) {
channel[ch].vpos = 0;
}
channel[ch].vdepth = param >> 4;
channel[ch].vrate = param & 15;
break;
}
}
void playroutine() { // called at 50 Hz
u8 ch;
u8 lights;
if(playsong) {
if(trackwait) {
if(trackwait) {
trackwait--;
} else {
trackwait = 4;
if(!trackpos) {
if(playsong) {
if(songpos >= SONGLEN) {
playsong = 0;
} else {
for(ch = 0; ch < 4; ch++) {
u8 gottransp;
u8 transp;
gottransp = readchunk(&songup, 1);
channel[ch].tnum = readchunk(&songup, 6);
if(gottransp) {
transp = readchunk(&songup, 4);
if(transp & 0x8) transp |= 0xf0;
} else {
transp = 0;
}
channel[ch].transp = (s8) transp;
if(channel[ch].tnum) {
initup(&channel[ch].trackup, resources[16 + channel[ch].tnum - 1]);
}
}
songpos++;
}
}
}
if(playsong) {
for(ch = 0; ch < 4; ch++) {
if(channel[ch].tnum) {
u8 note, instr, cmd, param;
u8 fields;
fields = readchunk(&channel[ch].trackup, 3);
note = 0;
instr = 0;
cmd = 0;
param = 0;
if(fields & 1) note = readchunk(&channel[ch].trackup, 7);
if(fields & 2) instr = readchunk(&channel[ch].trackup, 4);
if(fields & 4) {
cmd = readchunk(&channel[ch].trackup, 4);
param = readchunk(&channel[ch].trackup, 8);
}
if(note) {
channel[ch].tnote = note + channel[ch].transp;
if(!instr) instr = channel[ch].lastinstr;
}
if(instr) {
if(instr == 2) light[1] = 5;
if(instr == 1) {
light[0] = 5;
if(channel[ch].tnum == 4) {
light[0] = light[1] = 3;
}
}
if(instr == 7) {
light[0] = light[1] = 30;
TCCR0A = 0x02;
TCCR0B = 0x02; // clkIO/8, so 1/8 MHz
OCR0A = 125;//125; // 8 KHz
TCCR2A=0b10100011;
TCCR2B=0b00000001;
TIMSK0 = 0x02;
asm("sei");
for(;;) {
while(!timetoplay);
timetoplay--;
playroutine();
}
}
default:
value = 0;
break;
}
osc[i].phase += osc[i].freq;
acc += value * osc[i].volume; // rhs = [-8160,7905]
}
// acc [-32640,31620]
lastsample = 128 + (acc >> 8); // [1,251]
}
}
Now, in the longest data table, you can change the numbers...to get random
blips and bleeps. Have FUN!!!
editar imagem
Postar Comentrio
(/pt/member/Jean_Rolszt/)
Very cool :D
(http://cdn.instructables.com/F1A/Z2WQ/HVXE0SAD/F1AZ2WQHVXE0SAD.LARGE.jpg)
Flag
X
8
Responder
(http://cdn.instructables.com/FRH/QZ2M/HV80IK2W/FRHQZ2MHV80IK2W.LARGE.jpg)
(http://cdn.instructables.com/FIY/R5UM/HV850FFL/FIYR5UMHV850FFL.LARGE.jpg)
Flag
Responder
Responder
Responder
Responder
the code did not work.it plays for out 3 seconds the makes a fuzzy sound
(/pt/member/aaronXtreme/)
that doesnt end.
is he code mesed up or what. help.
Flag
Responder
Hi, I just wanted to thank you for this, and say that the leds are on pin 12
(/pt/member/freakbyte/)
and 10 if you didn't know already. Just found out while looking trough the
code :)
Flag
Responder
How do you generate the data for the songs? I have a great Idea for storing
(/pt/member/powerman666/)
them on an SD card for playback.
Flag
X
8
Responder
Flag
Responder
Responder
Couldn't you just plug in a 1/4in guitar cable with the wire exposed on one
(/pt/member/tim127/)
end for an amp?
Flag
Responder
X
|
8
Responder
this was very cool. I cannot imagine having to write out all of the code.
(/pt/member/Higgs+Boson/)
Thank god for copy paste.
Flag
Responder
Responder
I instantly recognized the song the second it started in the video. I've been
(/pt/member/Axlzero451/)
wanting to build one of those for years now. For all those who haven't heard
of this before: http://www.youtube.com/watch?v=_uU4BzSQQmY
Flag
Responder
Flag
|
8
Responder
neat
(/pt/member/Bongmaster/)
where did u get the code?
Flag
Responder
|
8
Responder
kool.
(/pt/member/Bongmaster/)
linky?
Flag
Responder
|
8
Responder
Flag
Responder
Responder
Cool.
(/pt/member/therobomaker/)
Flag
Responder
Flag
X
|
8
Responder
Very awesome.
(/pt/member/randofo/)
You need to add a VCF next or at least a simple low pass filter. Check out
the right side of this schematic
(http://www.musicfromouterspace.com/analogsynth_new/THE_CAVE/Your%20First%20Synth/Your%20First%20Synth_files/your_first_synth.g
You can simply make buy an 1/8" plug from Radioshack and solder two
wires onto it. Then, get a small test amp from Radioshack (about $15) and
plug the jack into that.
Also, check out the book Handmade Electronic Music
(http://books.google.com/books/about/Handmade_electronic_music.html?
id=P1yEOTci8DMC) if you have not done so already.
Flag
Responder
Responder
Flag
Responder
Responder
Responder
Flag
Responder
Vamos fazer:
Responder
Portugus