ay-3-8910
Folders and files
Name | Name | Last commit date | ||
---|---|---|---|---|
parent directory.. | ||||
****** Raspberry Pi AY-3-8910 YM chiptune player ****** by Vince Weaver (vince@deater.net) Hardware: See the full details and build instructions in ./build_instructions As a summary, it's two AY-3-8910 chips, with 3 channels each. One is for right, one for left. The pi talks to the AY-3-8910 via SPI and GPIOs. In addition there is a MAX 98306 amplifier, which the Pi controls the volume of using GPIO. Also a line-out jack. Pi Connections: Pi to 74HC595 (through level converter) DS (serial in) MOSI SHCP (serial clock) CLK STCP (output clock) CE0 Pi to AY-3-8910 (through level converter) BC1 GPIO18 BDIR GPIO23 |RESET GPIO24 Software Installing: + Install the bcm2835 library The raw Linux GPIO interface just isn't fast enough. wget http://www.airspayce.com/mikem/bcm2835/bcm2835-1.50.tar.gz uncompress/cd into directory ./configure make make install + Install the liblhasa-dev library This lets you play LHA compressed ym5 files which is pretty much any you find. apt-get install liblhasa-dev If you compile liblhasa from scratch (or are not on Debian) you might need to change the settings at the top of the Makefile. Alternately you could not use liblhasa at all and manually use the "lhasa" utility to decompress files before playing them. lhasa -e INTRO2.ym + Then just run "make" in this dir to create "ym_play" + There are various command line arguments. See "ym_play -h" Playing music: ./ym_play YM_FILE Keybindings: ' ' (space) pause/play , rewind song to beginning . fastforward 5s < skip to previous song > skip to next song l toggle looping of current song r toggle repeating playlist when done m switch 8x16 display mode + volume up - volume down a/b/c/n toggle channel More info on the YM file format: YM file format http://leonard.oxg.free.fr/ymformat.html To play ymfiles on Linux: apt-get install stymulator ymplayer YM_FILE To convert PT2 or AY files to YM: Install the Linux Ayemul player Load the file Click on "pl" then right click on the file to save as. I have not included any YM files here because most of the ones you find are ripped from old Atari/Spectrum games so the copyright situation is a bit complex. Performance: In general, to play 50Hz sound files (typical) need to update the AY-3-8910 every 20ms. We need libbcm2835 for this, as the Linux sysfs GPIO interface is nowhere near fast enough. We use a serial->parallel shift register to avoid using too many GPIOs (and a similar number of 3.3V to 5V level converters) Initially had problems with SPI so was bitbanging everything: ym_play_frame: 14ms display_update (bars+waterfall): 1-3ms display_read_keypad: 0.5ms display_string (14seg): 5ms ======= 23ms You can see that was too much delay and we couldn't hit 50Hz. I did finally get SPI working and now it is much better: ym_play_frame: 8ms display_update (bars+waterfall): 1-3ms display_read_keypad: 0.5ms display_string (14seg): 5ms ======== 17ms Probably could get much better performance if running w/o Linux on my own OS, but this is probably good enough for now. Funny it's so hard to get Linux on a high-end ARM chip to keep up, as the 1MHz Apple II can manage with a similar Mockingboard sound card (see the French Touch "Pure Noise" Demo) Recording from line out: This is needlessly tricky on Linux. One solution I found, when using a USB sound card for input, was "audacity" Related work: Examples of AY-3-8910/1/2 projects on Embedded Boards Pi (Japenese?): https://www.youtube.com/watch?v=eKZwqabdrj0 http://www.retropc.net/mm/archives/1254 Arduino shield: https://www.youtube.com/watch?v=UVcwc-0i5QU Arduino passthrough from PC via serial: https://www.youtube.com/watch?v=pS_lj1RmK2E Pi discussion: https://www.raspberrypi.org/forums/viewtopic.php?t=11592&p=128255 6502 discussion: http://forum.6502.org/viewtopic.php?t=958 http://bulba.untergrund.net/main_e.htm Arduino project: http://www.986-studio.com/category/electronic/ay-3-3910/ code: https://github.com/986-Studio/AY-3-3910-Player