ElmGen DSP Development Tool for Spin FV-1
Software by Andrew Kilpatrick, founder of Kilpatrick Audio
Back in 2008 I got started designing effect units and one of the parts that I started using was the Spin Semiconductors FV-1 DSP. It's a great little chip that makes low-power, small effect units possible. I've used it in guitar effect designs as well as synthesizer reverb effects. It has limitations, but there is a great amount of awesome hacking potential possible with this simple chip.
Although the low-cost dev board from Spin is nice, the software that it uses for development is not. I gave up doing assembly a long time ago in favour of somewhat prettier languages that offer more advanced features. Unfortunately the Spin DSP tools are really basic, and although they do work, they only work on Windows, have no macro or conditional compilation features, and they require a device to be plugged in to hear what your effect sounds like.
Over the summer of 2008 I started working on a tool to replace the Spin tools. I used it with real hardware and then added the hardware simulator near the end of 2008. It can compile Spin programs and write them directly to an EEPROM using an Arduino. But it can also simulate the FV-1 hardware directly on a computer. I reverse engineered the FV-1 from docs and created a full hardware simulator which runs sample-accurate and bit-for-bit. (I hope) Some functions were only understood once I read the "ASIC Design in the Silicon Sandbox" book by the late great Keith Barr, designer of the FV-1. I also confirmed with Spin support people the proper working of the internal delay memory so that I could build a proper compression/decompression module that would simulate the sound of the memory. (which is 14 bit floating point)
It is assumed that users have a knowledge of programming in Java, and at least a bit of DSP knowledge. Specific FV-1 info can be found on the Spin Semiconductors website. These tools are not for beginners and I will not offer support for people who have obviously not done their homework. Read all the FV-1 docs, the SpinASM manual for instruction references, and use the Javadoc for ElmGen to see what's available in the API. Some sample programs and a sample main file are included for your reference.
Each algorithm is a program. Up to 8 programs can be loaded onto an FV-1 EEPROM at once. Each program supports up to 128 FV-1 instructions. These programs are made by subclassing ElmProgram and then calling the instructions in the order you want them in your program. The instructions each check their arguments, and they are stored in a list which cannot exceed 128 instructions. (feel free to hack this limit if you want longer programs for some reason) After all the programs are built, they can either be simulated (one at a time) or loaded onto an EEPROM to try on real hardware. The EEPPromHandler class takes care of building a ROM image and writing/verifying it. An Arduino sketch is included which can be used to make your Arduino into an EEPROM programmer. This is not designed to be general purpose and may not work for other projects without some changes to the code.
Arduino and EEPROMs
The EEPROM programmer uses one of the very popular Arduino microcontroller kits as a USB to I2C interface. A simple sketch is provided below which you should put on your Arduino. The COM port must be set correctly in your top level file. (see SimTest.java below for details)
The basic idea is the the FV-1 only uses the EEPROM when changing programs. The DSP instructions are cached in an internal RAM so that they can run at high speed. During this time the I2C bus is high-Z, so you can freely update the EEPROM without the FV-1 noticing. Just be sure not to switch the power on and off on the board or change programs while the programmer is running or you will interrupt the flash process. ElmGen reads back each program to verify it.
Getting Started as Quickly as Possible
The simulator is handy, but you should prepare some files to use that offer good sounds for testing the type of effect you're making. Also, you need to make sure the file is stereo 16bit WAV and recorded at the same samplerate as your program. By default programs are set to 32768Hz samplerate because the reference circuit from Spin uses this frequency. You can override the samplerate in the program by calling setSamplerate() from your progam. This doesn't affect the code generated, but does affect the simulator. Also, if you use the ElmProgram.SAMPLERATE variable in coefficient calculations this is a handy way to scale your formulas to work at different rates. You can use any value from 32kHz to 48kHz.
Record audio that doesn't peak at 0db. Most modern recordings are very loud and this will cause a lot of distortion on the audio when you're messing around with effects that layer sound like reverbs and delays. When starting it's nice to have audio that leaves a bit of headroom. Always test the final algorithms with a variety of sound sources to make sure they work properly with all timbres and input levels.
Bugs and Limitations
Support, Bug Fixes, Features
Please help by supporting this project with patches and new features. Much of this code works "well enough" for me, but there are many improvements that could make it more useful. I would like to see more cross-compiler type of output available to generate C code or DSP code for other platforms. As the FV-1 has very optimized instructions specially suited to audio effects, it would be nice to use this as a basis of creating effects in other more general purpose languages.
This software comes with no warranty. Commercial support is available by request.
Check out the ElmGen thread on electro-music.com.
All changes, feature requests, etc. should be directed to: email@example.com
© Copyright 2011 - Andrew Kilpatrick