AnotherJohnH / picoX7

Software simulation of the Yamaha DX7 with a MIDI interface for the Raspberry Pi Pico

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

picoX7

picox7

A software simulation of the Yamaha DX7 with a MIDI interface for the Raspberry Pi Pico

Slightly boring video of the picoX7 playing the Yamaha DX7 ROM cartrdige 1A patches...

picoX7 rom1A

Software dependencies

Both Pico and native targets should build on MacOS or Linux.

Hardware information

prototype

For more information on the circuit above see the schematic and the hardware blog

  • Currently building for an I2S DAC based around the Cirrus Logic CS4344 from WaveShare (see below) Works well but notice Cirrus Logic have discontinued this device. Should be easy to switch to another I2S DAC
  • The Pico is significantly overclocked to 191.08 MHz to support 6 voices and generate a jitter free sample rate of 49096 Hz.
  • UART-0 used as a debug console (TX) and alternate MIDIish-IN from the host (115200 baud)
  • UART-1 (RX) implements the MIDI-IN interface
  • Two PIO state machines are used to generate I2S and MCLK for the DAC module
Pin Peripheral Allocation
1 UART-0 Debug console out (UART) TX
2 UART-0 Extra MIDI IN (not MIDI baud rate)
3 GND UART GND
6 UART-1 MIDI IN
28 GND DAC GND
29 PIO I2S DATA
31 => 27 PIO MCLK (for I2S DAC chip)
31 ADC Data entry pot
32 PIO I2S LR CLK
33 GND DAC GND
34 PIO I2S DATA CLK
38 GND DAC GND
39 VSYS DAC VSYS

Alternative hardware targets

Software builds for the following hardware targets...

  • WAVESHARE_BREAD_BOARD - The hardware described above
  • WAVESHARE_PIGGY_BACK - Similar to the hardware described above but with the WaveShare module mounted piggy-back. The ADC0 input is not usable.
  • PIMORONI_VGA_DEMO - Support for the Pimoroni Pico VGA Demo Base (!!!! untested !!!!)

NOTE: The LCD and LED displays are optional and will nto block operation if not fitted

Components

Name Description Source
Raspberry Pi Pico DIP module hosting an RP2040 MCU and 2 MiB Flash PiHut
Waveshare Pico Audio I2S DAC module that directly mounts under the Pico PiHut
MIDI controller Music keyboard with actual MIDI out (not MIDI over USB) Old Roland PC-200 works for me
MIDI-in adapter An optically isolated 5-pin DIN to UART interface 3 resistors, a diode and an op-amp work well if the controller is battery powered ;-)
Reset button Reset the Pico and allow Flashing Why not included on the Pico module ?!@#
Raspberry Pi Debug probe Not essential but very helpful PiHut

NOTE No particular affiliation with PiHut but they have a nice selection and good service

Status

Incomplete but starting to work.

Done...

  • I2S (via PIO) 16-bit stereo DAC interface at 49096 Hz
  • Basic MIDI in support via UART
  • Voice allocator
  • YM21280 OPS simulation
  • Basic YM21290 EGS simulation
  • DX7 voice patches are starting to sound recognisble

To do, (at least)...

  • Tune EGS simulation
  • Pitch envelope
  • LFO
  • Rate and level scaling
  • Mod and key sensitivity
  • Maybe a logarithmic OPS implementation
  • Optimise to squeeze in more voices
  • Use the 2nd Arm Cortex-M0 (currently idle!)

Limitations...

  • DAC implementation is quite different to the original. Suspect dynamic range is reduced
  • Hitachi 6303 (~MC6803) CPU controller and firmware is not being emulated
  • not using logs for sine amplitude modulation in the OPS => almost certainly not bit accurate
  • 8 voices (not 16!) - Running on just one arm core at ~85% CPU usage

See the software blog and hardware blog for more detailed progress updates.

How to build

Checkout

This repo uses git sub-modules, so checkout using --recurse to clone all the dependent source...

git clone --recurse https://github.com/AnotherJohnH/picoX7.git

or

git clone --recurse ssh://git@github.com/AnotherJohnH/picoX7.git

Build

Being developed on MacOS but should build fine on Linux too.

Indirect build of all supported targets (with cmake and ninja)...

make

Build directly using cmake...

mkdir build
cd build
cmake -DCMAKE_BUILD_TYPE=Release -DPLT_TARGET=rpipico -DCMAKE_TOOLCHAIN_FILE=Platform/MTL/rpipico/toolchain.cmake ..
make

Flashable image will be found under the build sub directory here...

.../Source/picoX7_WAVESHARE_BREAD_BOARD.uf2
.../Source/picoX7_WAVESHARE_PIGGY_BACK.uf2
.../Source/picoX7_PIMORONI_VGA_DEMO.uf2

License

This project is licensed under the MIT License - see the LICENSE file for details

Acknowledgements

  • Ken Shirriff for his very helpful series of blogs reverse engineering the YM21280
  • AJXS for their annotated disassembly of the DX7 firmware ROM
  • The Dexed developers for providing an easily accessible DX7 audio reference
  • The raspberry-pi foundation for the innovative RP2040
  • The engineers at Yamaha

About

Software simulation of the Yamaha DX7 with a MIDI interface for the Raspberry Pi Pico

License:MIT License


Languages

Language:C++ 86.5%Language:CMake 6.9%Language:Python 6.5%Language:Makefile 0.0%