Join us on Discord!
You can help CodeWalrus stay online by donating here.

SID + midi on Arduino and YM2149 emulator on atmega8

Started by garvalf, July 03, 2016, 12:50:24 PM

Previous topic - Next topic

0 Members and 4 Guests are viewing this topic.

garvalf

As said in this thread, I'm working a SID sound chip simulator on Arduino. I'm not responsible for most of the code, but I've assembled some parts, a SID emulator, a midi library, and some settings for modifing the chip.


Here is a better sample:

https://soundcloud.com/memento-somniare/sidarduino-test

The last part has some kind of hard bass sound (sawtooth).

and the code (w.i.p.):

https://github.com/farvardin/C64-music/tree/master/sid_arduino/sid_midi

Now I want to make it polyphonic and be able to adjust correctly the filters (if it's possible/implemented) so it will sound more like SID chip...

The same setup can play sid file using a different arduino sketch: https://github.com/farvardin/C64-music/tree/master/sid_arduino/sid_player
But because of the memory limitation, it can't play a whole tune. It should be adapted to be able to read from an sd card.

  • Calculators owned: TI-83+ fr, TI-82
  • Consoles, mobile devices and vintage computers owned: c64, zx spectrum, atari st, sega megadrive, sega master system, nintendo NES, gameboy...

Yuki

Ah nice. I did that the other day, I had something that recognized the serial port as a MIDI device, so I could use any DAW that supports it and send some MIDI signals, so I could play full songs, but the SID is only limited to 3 channels at a time... Still sounds good. Could probably upload the sketch I have, if that helps.
  • Calculators owned: TI-83+ (dead?), Casio Prizm (also dead???)
  • Consoles, mobile devices and vintage computers owned: A lot
Read Zarmina!
YUKI-CHAAAANNNN
In the beginning there was walrii. In the end there will be walrii. All hail our supreme leader :walrii: --Snektron

if you wanna throw money at me and/or CodeWalrus monthly it's here

Dream of Omnimaga

Cool project Garvalf, and I just listened to the track and it sounds cool. :D
  • Calculators owned: TI-82 Advanced Edition Python TI-84+ TI-84+CSE TI-84+CE TI-84+CEP TI-86 TI-89T cfx-9940GT fx-7400G+ fx 1.0+ fx-9750G+ fx-9860G fx-CG10 HP 49g+ HP 39g+ HP 39gs (bricked) HP 39gII HP Prime G1 HP Prime G2 Sharp EL-9600C
  • Consoles, mobile devices and vintage computers owned: Huawei P30 Lite, Moto G 5G, Nintendo 64 (broken), Playstation, Wii U

garvalf

Yes, i'd like to see your code Juju
  • Calculators owned: TI-83+ fr, TI-82
  • Consoles, mobile devices and vintage computers owned: c64, zx spectrum, atari st, sega megadrive, sega master system, nintendo NES, gameboy...

DarkestEx

@Juju @garvalf
What is the license on your project(s)?
We are working on a game console and we want to use an emulated C64 SID synthesizer for the optional audio.
Would you be interested in helping us. We would like to make it an external module. And yes, we would make an actual PCB for this.
The communication between the main CPU and the SID would be SPI. The sound-CPU could be an ATmega328p @ 8 MHz.
  • Calculators owned: TI-84+, Casio 101-S, RPN-Calc, Hewlett-Packard 100LX, Hewlett-Packard 95LX
  • Consoles, mobile devices and vintage computers owned: Original Commodore 64C, C64 DTV, Nintendo GameBoy Color, Nintendo GameCube, Xbox 360, PlayStation 2

garvalf

@DarkestEx : cool idea! 99% of the code I'm using is not mine, and it seems it's GPLv2 (look at the headers), so you can use it under this licence. I'm still curious to look at @Juju 's one, which is probably more advanced!
Will you use 2 arduinos for this project, or something else?
  • Calculators owned: TI-83+ fr, TI-82
  • Consoles, mobile devices and vintage computers owned: c64, zx spectrum, atari st, sega megadrive, sega master system, nintendo NES, gameboy...

DarkestEx

#6
Quote from: garvalf on September 05, 2016, 04:40:23 PM
@DarkestEx : cool idea! 99% of the code I'm using is not mine, and it seems it's GPLv2 (look at the headers), so you can use it under this licence. I'm still curious to look at @Juju 's one, which is probably more advanced!
Will you use 2 arduinos for this project, or something else?
Oh dammit :(
No GPL code is permitted in our main project, but luckily the Audio is a separate add-on, so this will work fine :)
The external add-on SID processor will be using an Arduino-compatible CPU, but the main CPU (while it theoretically could run Arduino) won't.
It's a 32-bit Tensilica CPU running at 160 MHz. The system also has WiFi, a USB interface and a SD card slot for loading the UI, games and programs from.
Here is an image of the prototype PCB I am working on:
[spoiler=Prototype][/spoiler]
The system called Microcat will be running my own Claw operating system (which is BSD licensed and therefore incompatible). It can be programmed in my custom assembly language or in Cumred_Snektrons high level compiler for it. The operating system supports multitasking.

EDIT:
I think we will integrate Audio into the main board anyways. It's quite mean to have a console that can't even beep.
So here we go:

We will integrate audio into this little puppy ^, an ATtiny84.
The SPI will be used for communication, one pin will be Chip Select. The reset pin is routed to the main CPU as well to allow updating it's firmware.
Most of the other pins will be used for generating polyphonic sound.
  • Calculators owned: TI-84+, Casio 101-S, RPN-Calc, Hewlett-Packard 100LX, Hewlett-Packard 95LX
  • Consoles, mobile devices and vintage computers owned: Original Commodore 64C, C64 DTV, Nintendo GameBoy Color, Nintendo GameCube, Xbox 360, PlayStation 2

Yuki

I remember I took a SID emulation library and a MIDI over serial library and I just stitched them together, I didn't wrote a lot of lines of code and I have no idea if it's GPL. I'll look at this tonight and send the source. The libraries I used are likely somewhere on GitHub.
  • Calculators owned: TI-83+ (dead?), Casio Prizm (also dead???)
  • Consoles, mobile devices and vintage computers owned: A lot
Read Zarmina!
YUKI-CHAAAANNNN
In the beginning there was walrii. In the end there will be walrii. All hail our supreme leader :walrii: --Snektron

if you wanna throw money at me and/or CodeWalrus monthly it's here

Dream of Omnimaga

I would definitively like C64 SID emulation in Microcat :)
  • Calculators owned: TI-82 Advanced Edition Python TI-84+ TI-84+CSE TI-84+CE TI-84+CEP TI-86 TI-89T cfx-9940GT fx-7400G+ fx 1.0+ fx-9750G+ fx-9860G fx-CG10 HP 49g+ HP 39g+ HP 39gs (bricked) HP 39gII HP Prime G1 HP Prime G2 Sharp EL-9600C
  • Consoles, mobile devices and vintage computers owned: Huawei P30 Lite, Moto G 5G, Nintendo 64 (broken), Playstation, Wii U

garvalf

#9
It's cool if you use an external (arduino) chip for making the music! It can maybe be complicated to make it communicate with the main CPU, can't it?
The arduino sketch can replay some psid files quite accurately, but the psid has to be converted to special data and embeded as .h file from the arduino ide, like this: https://github.com/farvardin/C64-music/blob/master/sid_arduino/sid_player/Alternative_Fuel_dmp.h
And because of the arduino memory, you can't add much music (around 10-15 seconds). But it should be possible to stream the data from sd card or other storage (the only examples I can find are from a read SID, not with the arduino emulator)

There are also other projects using for example the ym2149 chip (AY), for example this one: http://www.avray.ru/
You can use arduino sketches with it for playing Sinclair Spectrum or Atari St music. Look at this: http://www.avray.ru/playing-yrg-rsf-files-from-sd-card-with-emulator/comment-page-1/#comment-205
It could be cool to integrate into your console project.

I've worked a bit more on the Sid emulator. It can handle multi voices (3 like original SID, but it should be also possible to create more register and add more voices), the only problem is on midi I can't separate the voice, i.e. play a voice on channel 1, play another voice (sound) on channel 2 etc, I can mix the voices together but I have to select the midi channel. I've tried to modify the midi part but it's beyond my knowledge, for example I'm using some code which should theorically work, but don't practically (http://arduinomidilib.fortyseveneffects.com/a00025.html#ga4c50a2be0160dfb169126c7d9e6d1458)

I've discovered the "arduino pro mini" are even smaller than arduino nano. You can find some clones for a very cheap price (around 2 €). You only need a programmer / usb interface because they don't have this, so it's not practical for designing, it's more for final stuff. Fun fact: it has almost the same size as a real SID chip.

I'm attaching a picture of the whole family, from left to right: the ftdi programmer, the arduino pro mini, the arduino nano.
  • Calculators owned: TI-83+ fr, TI-82
  • Consoles, mobile devices and vintage computers owned: c64, zx spectrum, atari st, sega megadrive, sega master system, nintendo NES, gameboy...

garvalf

I've managed to make the AY emulator from http://www.avray.ru/ work, it sounds really great! I still need to adjust a few things, and I'd like to program it for using midi, if it's possible. I'll post a little video in a few days or weeks.
  • Calculators owned: TI-83+ fr, TI-82
  • Consoles, mobile devices and vintage computers owned: c64, zx spectrum, atari st, sega megadrive, sega master system, nintendo NES, gameboy...

Dream of Omnimaga

Awesome :D. I can't wait to see it in action Garvalf :)
  • Calculators owned: TI-82 Advanced Edition Python TI-84+ TI-84+CSE TI-84+CE TI-84+CEP TI-86 TI-89T cfx-9940GT fx-7400G+ fx 1.0+ fx-9750G+ fx-9860G fx-CG10 HP 49g+ HP 39g+ HP 39gs (bricked) HP 39gII HP Prime G1 HP Prime G2 Sharp EL-9600C
  • Consoles, mobile devices and vintage computers owned: Huawei P30 Lite, Moto G 5G, Nintendo 64 (broken), Playstation, Wii U

garvalf

It's quite short and not very well recorded, but here is the avr-ay emulator in action:


  • Calculators owned: TI-83+ fr, TI-82
  • Consoles, mobile devices and vintage computers owned: c64, zx spectrum, atari st, sega megadrive, sega master system, nintendo NES, gameboy...

Dream of Omnimaga

That is awesome and old-school. Glad to see it working :)

:walrii:
  • Calculators owned: TI-82 Advanced Edition Python TI-84+ TI-84+CSE TI-84+CE TI-84+CEP TI-86 TI-89T cfx-9940GT fx-7400G+ fx 1.0+ fx-9750G+ fx-9860G fx-CG10 HP 49g+ HP 39g+ HP 39gs (bricked) HP 39gII HP Prime G1 HP Prime G2 Sharp EL-9600C
  • Consoles, mobile devices and vintage computers owned: Huawei P30 Lite, Moto G 5G, Nintendo 64 (broken), Playstation, Wii U

garvalf

#14
Thank you.

I've finally soldered a cleaner version on a board last week-end. Damn it was long. There is almost nothing on the board, but under it there are quite many wires. I've put the atmega8 chip under the arduino nano. I'd like to make a PCB for making more boards like this.

Here is a new video with my new toy:


and a picture of the board:



So there is a sd card reader connected to the arduino which read the data, then pass it to the atmega8 which is the sound chip recreating the ym2148.
  • Calculators owned: TI-83+ fr, TI-82
  • Consoles, mobile devices and vintage computers owned: c64, zx spectrum, atari st, sega megadrive, sega master system, nintendo NES, gameboy...

Powered by EzPortal