You can help CodeWalrus stay online by donating here. | New CodeWalrus | Old (dark mode) | Old (light) | Discord server

SID + midi on Arduino and YM2149 emulator on atmega8

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

0
b/Hardware publicado por u/garvalf July 03, 2016, 12:50:24 PM
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.

Last Edit: November 04, 2016, 09:15:51 PM by garvalf
Inicia sesión o crea una cuenta para dejar un comentario
u/Yuki July 03, 2016, 06:32:09 PM
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.
u/Dream of Omnimaga July 04, 2016, 04:36:12 AM
Cool project Garvalf, and I just listened to the track and it sounds cool. :D
u/garvalf July 04, 2016, 11:48:16 AM
Yes, i'd like to see your code Juju
u/DarkestEx September 05, 2016, 04:19:00 PM
@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.
u/garvalf 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?
u/DarkestEx September 05, 2016, 04:45:21 PM
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:
Prototype
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.
Last Edit: September 05, 2016, 05:19:22 PM by DarkestEx
u/Yuki September 05, 2016, 05:33:29 PM
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.
u/Dream of Omnimaga September 20, 2016, 08:29:23 PM
I would definitively like C64 SID emulation in Microcat :)
u/garvalf September 22, 2016, 08:30:41 AM
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.
Last Edit: September 22, 2016, 10:24:22 PM by garvalf
u/garvalf September 28, 2016, 07:39:01 PM
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.
u/Dream of Omnimaga September 29, 2016, 04:30:04 PM
Awesome :D. I can't wait to see it in action Garvalf :)
u/garvalf October 13, 2016, 08:41:48 PM
It's quite short and not very well recorded, but here is the avr-ay emulator in action:


u/Dream of Omnimaga November 03, 2016, 05:55:30 PM
That is awesome and old-school. Glad to see it working :)

:walrii:
u/garvalf November 04, 2016, 09:20:05 PM
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.
Last Edit: November 04, 2016, 09:25:21 PM by garvalf
Start a Discussion

b/Hardware

Building a robot, some old-school handheld or other piece of hardware? This is the section to showcase it.

56
Topics
Explore Board
Website statistics


MyCalcs | Ticalc.org | Cemetech | Omnimaga | TI-Basic Developer | MaxCoderz | TI-Story | Casiocalc.org | Casiopeia | The Museum of HP Calculators | HPCalc.org | CnCalc.org | Music 2000 Community | TI Education | Casio Education | HP Calcs | NumWorks | SwissMicros | Sharp Calculators
Powered by EzPortal