Giter Site home page Giter Site logo

ramazik / esp8266_vgm_player Goto Github PK

View Code? Open in Web Editor NEW

This project forked from aidanhockey5/esp8266_vgm_player

0.0 0.0 0.0 411 KB

A basic shift-register-based VGM player for the SN76489 PSG chip.

License: GNU Affero General Public License v3.0

C 99.85% C++ 0.15%

esp8266_vgm_player's Introduction

ESP8266 VGM Player

https://youtu.be/DToXdymGX3Q

A basic shift-register-based VGM player for the SN76489 PSG chip.

This reads VGM data from uint8 arrays stored in the ESP8266 flash memory and plays them back on a SN76489 PSG sound chip via a SN74HC595 shift register. A ~3.58 MHz clock signal to drive the PSG is generated by an externally controlled LTC6903 programmable oscillator. The PSG can also accept a 4 MHz signal (mainly for BBC Micro songs), but will produce tones out-of-pitch with Sega Master system games.

The ESP8266 was chosen for this project for its incredibly fast processor and enormous RAM/ROM (64k, 4M respectively). This eliminates the need for a slower and more complicated system that uses external storage like an SD card or EEPROM.

This project is still early in it's lifespan, so there are still lots of improvements to make!

As of right now, the pinout is:

ESP SHIFT REGISTER
ESP D0 latch (12)
ESP D1 SRclock (11)
ESP D2 SERdata (14)
(SKIP D3)
ESP D4 SRCLR (10)
ESP SN76489 PSG
ESP D3 WE (5)
SN76489 PSG SHIFT REGISTER & clock
PSG Clock Clock out LTC6903 (external part, you must supply a 3.58 MHz clock signal)
PSG D0-D7 Shift Register QA-QH
PSG OE GND

Shift register OE must be grounded too.

SN-OUT can be directly hooked up to low-powered speakers without amplification. This chip is pretty loud by itself. I reccomend a 10 uF cap connecting SN-OUT to GROUND.

Prepackaged VGM music in array format can be found in music.h. Just uncomment the track you would like to hear. Arrays of VGM music can be made by first extracting the uncompressed VGM file from a VGZ with 7zip. (If you have a VGM file that isn't playing properly, try opening it in 7zip anyways and extracting.) Then, take your uncompressed VGM file and head over to a linux PC and use the

xxd -i YOURTRACK.VGM OUTPUTFILE.txt

command to automatically create an array-friendly format. Change the array length int to "music_length" and the array data type to "uint8 ICACHE_RODATA_ATTR music_data[]"

Right now, there seems to be minor timing issues and there is no support for dynamic clock speeds.


I'm using an external PIC16F690 microcontroller to set the output clock of the LTC6903. I've included the CCS C code and the compiled HEX should you want to use it. You could easily setup the LTC6903 using SPI from the ESP8266, but since it's a bit limited for pins and I already had a chip programmed for this specific use, I went that route.

Schematic

Schematic

Vector version here

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.