YM2149F Arduino Chiptunes

2017-12-22 20:04:00 +0000, 9 months and 3 weeks ago

Installing Arduino software

Went to https://www.elegoo.com/download/, download Linux IDE.

7z x Linux.zip
tar -xJf arduino-1.8.4-ARCHITECTURE.tar.xz

Apparently I had to add myself to the dialout group, tried to do that with sudo usermod -aG dialout USERNAME, didn’t work.

Instead I opted just to use root since it just works :tm:.

In order to upload code to the Uno, I had to change my Serial Port over to /dev/ TTYACM0 (Tools > Serial Port).

void setup() {
  pinMode(13, OUTPUT);
}

void loop() {
  digitalWrite(13, HIGH);
  delay(100);
  digitalWrite(13, LOW);
  delay(100);
}

ctrl+U and bam, it’s flashing. Nice.

The circuit

Simply wire up as shown in the below diagram:

I ran out of 100Ohm resistors so I opted for 120ohm instead.

Flashing the code

FlorentFlament uses C code to run the ym1249f, so we need to install some libs and compile it, simply

sudo apt-get install avr-gcc avr-libc avrdude

FlorentFlament’s Makefile uses a different output port to what’s shown on mine, so changing over /dev/ttyUSB0 to /dev/ttyAMC0 solves any problems that would arise.

Then sudo make flash.

What a lovely output.

Does it work?

Smash that mfing power cable into the USB port and I ever so slowly put my ear to the snowboard earphone.

Heck yeah it works my dudes, that nice and familiar ascending C scale plays its tune.

However, it’s quite quiet. I want loud chiptunes, I want to hear them in all their glory. As you can tell in the diagram, there’s a passive mixer on the output (like a summing amplifier), which is essentially a potential divider. I want more sound, therefore I just increase the resistance of the bottom resistor such that less current is dropped over it, $V=IR$, therefore we have move voltage output. In order to keep the ratios the same I opted for a 120kOhm resistor.

Lovely songs

I’m not sure about you, but the C scale loses its luster after about 20 times on repeat. It’s time to stream .YM files to this arduino!

That cool guy FlorentFlament also made a ym2149f streamer, so let’s check it out.

https://github.com/FlorentFlament/ym2149-streamer

Looks pretty similar build process as the test case, still gotta switch over that USB0 to ACM0 though, simple enough.

git clone https://github.com/FlorentFlament/ym2149-streamer.git
cd ym1249f-streamer
nano Makefile
make
sudo make flash

sudo is needed to access /dev/ttyACM0, you can probably add yourself for some group but for now I don’t care. Flash those .ym tunes over…

aaaaand goddamnit it doesn’t work.

So this was a failure, oh well. I’ll look into this and return later maybe, or not.

Return?


Comments

there's some rate-limiting going on with my comment provider atm, so i'd reccommend copying your message incase it gets blocked and retrying