ElmGen DSP Development Tool for Spin FV-1

Software by Andrew Kilpatrick, founder of Kilpatrick Audio

Key Features:

  • Cross-platform development tool for Spin FV-1 effects processor
  • Testing and production EEPROM programming capabiltiy
  • Built-in real-time hardware simulator of FV-1 DSP core - hear and test your algorithms digitally
  • Written in pure Java (requires RXTX for EEPROM programming)
  • Works on Windows, OS X and Linux (Linux not tested)
  • Advanced coefficent calculations or code manipulation possible with Java - e.g. conditional compilation, high-level code blocks, etc. not possible with SpinASM
  • Completely free and open source (GPL) - Users are asked to contribute their changes back to the project for everyone's benefit
  • Code generated can be used in commercial closed-source projects
  • Licensed as GPL3 - see: http://www.gnu.org/licenses/

Introduction

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)

Spin

Using ElmGen

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

  • Set up Java and an IDE - You need the Java SDK installed on your computer. You also might like to use Eclipse for development.
  • Set up your Project - Make a new project (assumes you are using Eclipse) and import the ElmGen JAR file into it. Go to Project > Properties > Java Build Path > Add JARs and add the ElmGen JAR file to the classpath.
  • Try the Examples - Some example algorithms as well as a main class are available in the source ZIP, as well as below. You need to set up your own class with a main() method as the JAR is just a library.
  • Build your Own - Try creating your own algorithms by using your own hardware or the simulator to test out your effects. Each project needs the following:
    • Main Class - Check out SimTest.java. This class instantiates each of the programs, adds them to a EEPROM image (if you're flashing hardware) and/or runs a program in the simulator. Comment out the EEPROM stuff if you don't have any hardware connected for faster startup.
    • Programs - Each algorithm is a separate program. These are made by subclassing ElmProgram and making method calls to add instructions. You can use standard Java language features to do handy things such as conditional compilation or coefficient calculations. But only the FV-1 instructions called will actually be run on the chip or in the simulator.

Simulator Tips

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

Version 0.5

  • chorus instructions simulations are not fully tested
  • EEPROM programming is slow - need tweaks to the Arduino code to up the baud rate
  • no configuration file or command-line support
  • GUI is very basic and should be improved
  • only stereo 16 bit WAVs are supported as input/output
  • SimTest.java doesn't read the programmerPort variable when calling the EEPROM routines
  • probably many bugs - but works for real production products!

elmGen Downloads

Usage Examples

Helpful Resources

  • Spin Semiconductors - makers of the FV-1
  • Arduino - makers of the Arduino development boards
  • Sparkfun - vendor of Arduinos and development tools
  • RXTX - java library required for EEPROM programmer

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: andrew@andrewkilpatrick.org


© Copyright 2011 - Andrew Kilpatrick

andrew@andrewkilpatrick.org