Tuesday, October 4, 2016

Mini Project Process 2/5 10.4.2016

So I thought changing the numbers around would make  Gameboy sound but that didn't work so I decided to see what actually made the sound so I opened up a Gameboy.

The base code for an alarm:

float sinVal;
int toneVal;
void setup() {
pinMode(8, OUTPUT);
}
void loop() {
for (int x=0; x<180; x++) {
// convert degrees to radians then obtain sin value
sinVal = (sin(x*(3.1412/180)));

// generate a frequency from the sin value
toneVal = 2000+(int(sinVal*1000));
tone(8, toneVal);
delay(2);
}
}

I opened the Gameboy up which I never have done before. Didn't realize I have played with sensors most of my life looking at the components of it. Found the speaker but still can't find what component makes the noise. I conclude that it's programmed into cpu itself. So I'm changing the sound to something else but sticking to the concept of nostalgia. 

2 comments:

  1. Alberto,

    I'm certain the noise comes from the speaker and you're right, the "on" sound comes from the CPU. Music for games, however, would be compressed on the actual cartridge board for each individual game.

    Not sure why you're thinking you can't emulate the sound? You can use the tone library and piezo speaker to figure it out by ear. Look at Project 12 in the Apress Beginning Arduino book.

    ReplyDelete
  2. Alberto,

    I'm certain the noise comes from the speaker and you're right, the "on" sound comes from the CPU. Music for games, however, would be compressed on the actual cartridge board for each individual game.

    Not sure why you're thinking you can't emulate the sound? You can use the tone library and piezo speaker to figure it out by ear. Look at Project 12 in the Apress Beginning Arduino book.

    ReplyDelete