Author |
Message |
stekern
Joined: Aug 06, 2010 Posts: 14 Location: Finland
Audio files: 5
|
Posted: Fri Aug 06, 2010 9:54 pm Post subject:
SK-Synth: A subtractive FPGA synthesizer |
 |
|
This is a project I have been working on for a while.
It is a subtractive synthesizer implemented in an FPGA.
Features:
* 2 DCO's with sawtooth, square, triangle and sine waveform generation
* LFO that can be modulate the filter, amplitude or pitch. Possible waveforms are: sawtooth, square and triangle.
* LP-12 filter with adjustable frequency and resonance.
* Filter envelope
* Amplitude envelope.
I have been using a Avnet spartan 3A devboard with a breakoutboard with midi connector and a I2S DA-converter.
In this device the polyphony is set to 8 voices, but it is easily adjustable in the VHDL-source code. I also have received reports that it is easy to implement several SK-Synths to achieve multitimbrality (on a spartan-3e board).
Here is a picture of the devboard with the breakout-board connected:
The synth is controlled by a computer application written in Qt and it runs on both Linux and Windows.
Here is a picture of the application:
The source code for the synth and the controller application and schematics for the breakoutboard can be found in my SVN-repository here:
http://www.sk-electronics.com/svn/repos/SK-Synth/trunk/
Here is a zipped SVN-snapshot from 2010-08-05:
http://www.sk-electronics.com/sk-synth/SK-Synth-20100805.zip
A couple of samples is attached.
Description: |
|
 Download (listen) |
Filename: |
bass-sample.mp3 |
Filesize: |
439.62 KB |
Downloaded: |
974 Time(s) |
Description: |
|
 Download (listen) |
Filename: |
pad-sample.mp3 |
Filesize: |
83.29 KB |
Downloaded: |
935 Time(s) |
Description: |
|
 Download (listen) |
Filename: |
60scifi-sample.mp3 |
Filesize: |
74.31 KB |
Downloaded: |
944 Time(s) |
|
|
Back to top
|
|
 |
wooster

Joined: Jul 25, 2007 Posts: 63 Location: Austin, TX
|
Posted: Fri Aug 06, 2010 10:34 pm Post subject:
|
 |
|
Nice job!
Does your application communicate with the synth over MIDI? _________________ Check out woosteraudio.com |
|
Back to top
|
|
 |
wooster

Joined: Jul 25, 2007 Posts: 63 Location: Austin, TX
|
Posted: Fri Aug 06, 2010 10:36 pm Post subject:
|
 |
|
p.s. I am waiting for my own FPGA synth to finish synthesizing right now - takes so loooong _________________ Check out woosteraudio.com |
|
Back to top
|
|
 |
stekern
Joined: Aug 06, 2010 Posts: 14 Location: Finland
Audio files: 5
|
Posted: Fri Aug 06, 2010 10:58 pm Post subject:
|
 |
|
Yes, the application is communicating with the synth using MIDI messages.
It is using the RtMidi library (http://www.music.mcgill.ca/~gary/rtmidi/) to interface with the computers MIDI-hardware.
The synths midi-control messages can be found here:
http://www.sk-electronics.com/svn/repos/SK-Synth/trunk/midi_ctrl.txt |
|
Back to top
|
|
 |
JovianPyx

Joined: Nov 20, 2007 Posts: 1988 Location: West Red Spot, Jupiter
Audio files: 224
|
Posted: Sat Aug 07, 2010 6:07 am Post subject:
|
 |
|
Nice!
Where did you get the green board with the MIDI sockets?
For MIDI, are you using an embedded microcontroller such as PicoBlaze or a hardware IC (on the green board)? _________________ FPGA, dsPIC and Fatman Synth Stuff
Time flies like a banana. Fruit flies when you're having fun. BTW, Do these genes make my ass look fat? corruptio optimi pessima
|
|
Back to top
|
|
 |
stekern
Joined: Aug 06, 2010 Posts: 14 Location: Finland
Audio files: 5
|
|
Back to top
|
|
 |
JovianPyx

Joined: Nov 20, 2007 Posts: 1988 Location: West Red Spot, Jupiter
Audio files: 224
|
Posted: Sat Aug 07, 2010 7:37 am Post subject:
|
 |
|
Heh, I do Verilog, I read VHDL poorly - so did you simply create a state machine using VHDL to handle MIDI then? I know someone else who did that.
I use PicoBlaze for MIDI including sysex, the reason is that I find that I need to change the MIDI controller from one synth to another (for example, polysynth vs monosynth) and it's easy in assembly code. The PicoBlaze is said to consume about 90 slices, so it's pretty small. The PicoBlaze also handles controlling the LCD for a Spartan-3E Starter Kit. _________________ FPGA, dsPIC and Fatman Synth Stuff
Time flies like a banana. Fruit flies when you're having fun. BTW, Do these genes make my ass look fat? corruptio optimi pessima
|
|
Back to top
|
|
 |
wooster

Joined: Jul 25, 2007 Posts: 63 Location: Austin, TX
|
Posted: Sat Aug 07, 2010 7:49 am Post subject:
|
 |
|
I also did a hardware MIDI parser - the state machine is not that complicated, but I can see the benefit of using an embedded uC. How do you find out how many slices a module uses? This is the synthesis report for my midi_parser module:
Summary:
inferred 1 Finite State Machine(s).
inferred 1 RAM(s).
inferred 3 Counter(s).
inferred 52 D-type flip-flop(s).
inferred 1 Comparator(s).
...but I don't see a slice count _________________ Check out woosteraudio.com |
|
Back to top
|
|
 |
stekern
Joined: Aug 06, 2010 Posts: 14 Location: Finland
Audio files: 5
|
Posted: Sat Aug 07, 2010 7:57 am Post subject:
|
 |
|
Heh, well I have the same problem but the other way around, I do VHDL but read verilog poorly
As a sidenote I can say that your (Jovian Pyx) FPGA-synths were a big inspiration when I started out this project.
Yes, it is basically a state machine that handles the midi.
I'm not using sysex, so it was pretty simple to implement it like that.
There was some other reasons for not including a mcu in the design.
One reason was that I haven't found a softcore small enough except PicoBlaze and I wanted to keep the design as non-xlilinx specific as possible.
The whole project started out when I bought the spartan-3a devboard to freshen up my VHDL-skills that I hadn't been using for nearly four years.
Since I have alot more experience with mcus and programming them than FPGAs I wanted to try to stay away from them in this design to not be lured into "cheating" to much
If I make another FPGA-synth design I will probably include a mcu and some SRAM, that is a bit of a dissapointment with the avnet spartan-3 board. |
|
Back to top
|
|
 |
JovianPyx

Joined: Nov 20, 2007 Posts: 1988 Location: West Red Spot, Jupiter
Audio files: 224
|
Posted: Sat Aug 07, 2010 8:27 am Post subject:
|
 |
|
wooster wrote: | I also did a hardware MIDI parser - the state machine is not that complicated, but I can see the benefit of using an embedded uC. How do you find out how many slices a module uses? This is the synthesis report for my midi_parser module:
Summary:
inferred 1 Finite State Machine(s).
inferred 1 RAM(s).
inferred 3 Counter(s).
inferred 52 D-type flip-flop(s).
inferred 1 Comparator(s).
...but I don't see a slice count |
I wish I knew the answer to that! It would be nice to be able to know that so that one could identify "fat" parts of a design and work to reduce it.
The 90 slice figure for PicoBlaze comes from the Xilinx page where I downloaded the code. _________________ FPGA, dsPIC and Fatman Synth Stuff
Time flies like a banana. Fruit flies when you're having fun. BTW, Do these genes make my ass look fat? corruptio optimi pessima
|
|
Back to top
|
|
 |
stekern
Joined: Aug 06, 2010 Posts: 14 Location: Finland
Audio files: 5
|
Posted: Sat Aug 07, 2010 8:46 am Post subject:
|
 |
|
If you press Module Level Utilization under Design Overview in webISE (11.2) you will get what every module is occupying (Slices, Slice Reg, LUTs, LUTRAM, BUFG and DCM).
Generate detailed report under Implement Design->Map->Process Properties have to be checked for this to be visible though.
My MIDI-implementation is occupying 53 slices (EDIT: excluding the uart). |
|
Back to top
|
|
 |
JovianPyx

Joined: Nov 20, 2007 Posts: 1988 Location: West Red Spot, Jupiter
Audio files: 224
|
Posted: Sat Aug 07, 2010 9:00 am Post subject:
|
 |
|
Another reason I like an embedded microcontroller for a synth is that the assembly code when compiled generates a block RAM module with initialization.
This means that the assembly code and the Verilog code become "married" in the project and the code is loaded along with the project logic with the bit file. It is thus very easy to organize the project so that the code for a specific synth is always "tightly coupled" to the project as a whole.
When using a separate hardware device, one must push the code into it as a separate process and one must be sure to push the right version of code into it. Surely however, this becomes less of a problem as the code stabilizes (assuming it sits in Flash RAM or EEPROM).
In my case, however, my synths are currently all built on dev boards and I like to change the synth that runs on that board on a whim, so using a hardware uC would present at least an inconvenience to me.
YMMV.  _________________ FPGA, dsPIC and Fatman Synth Stuff
Time flies like a banana. Fruit flies when you're having fun. BTW, Do these genes make my ass look fat? corruptio optimi pessima
|
|
Back to top
|
|
 |
JovianPyx

Joined: Nov 20, 2007 Posts: 1988 Location: West Red Spot, Jupiter
Audio files: 224
|
Posted: Sat Aug 07, 2010 9:04 am Post subject:
|
 |
|
stekern wrote: | If you press Module Level Utilization under Design Overview in webISE (11.2) you will get what every module is occupying (Slices, Slice Reg, LUTs, LUTRAM, BUFG and DCM).
Generate detailed report under Implement Design->Map->Process Properties have to be checked for this to be visible though.
My MIDI-implementation is occupying 53 slices (EDIT: excluding the uart). |
Thank you! That works in 10.1 (WebPACK ISE) as well. _________________ FPGA, dsPIC and Fatman Synth Stuff
Time flies like a banana. Fruit flies when you're having fun. BTW, Do these genes make my ass look fat? corruptio optimi pessima
|
|
Back to top
|
|
 |
wooster

Joined: Jul 25, 2007 Posts: 63 Location: Austin, TX
|
Posted: Sat Aug 07, 2010 9:48 am Post subject:
|
 |
|
Works in 12.1 too. Funny, my midi parser is also 53 slices.
stekern, are you going to add a detune control for the DCO's? _________________ Check out woosteraudio.com |
|
Back to top
|
|
 |
stekern
Joined: Aug 06, 2010 Posts: 14 Location: Finland
Audio files: 5
|
Posted: Sat Aug 07, 2010 11:55 am Post subject:
|
 |
|
wooster: yep that is definitely on the todo-list, along with some other stuff like legato.
JovianPyx: I get what you are saying. The main reason why I would like an external processor is that I would like to be able pull different FPGA images from, for example an SD-card. |
|
Back to top
|
|
 |
JovianPyx

Joined: Nov 20, 2007 Posts: 1988 Location: West Red Spot, Jupiter
Audio files: 224
|
Posted: Sat Aug 07, 2010 12:58 pm Post subject:
|
 |
|
What is an "LP-12" filter? _________________ FPGA, dsPIC and Fatman Synth Stuff
Time flies like a banana. Fruit flies when you're having fun. BTW, Do these genes make my ass look fat? corruptio optimi pessima
|
|
Back to top
|
|
 |
stekern
Joined: Aug 06, 2010 Posts: 14 Location: Finland
Audio files: 5
|
Posted: Sat Aug 07, 2010 8:35 pm Post subject:
|
 |
|
I was just trying to say that it is a low-pass filter with a cutoff slope at 12dB/octave. |
|
Back to top
|
|
 |
stekern
Joined: Aug 06, 2010 Posts: 14 Location: Finland
Audio files: 5
|
Posted: Wed Aug 11, 2010 10:26 am Post subject:
|
 |
|
Detuning of each oscillator down to 1 cent is now implemented and updated in SVN.
I had to rewrite the pitch generation stuff a bit, but it was mostly for the good, since it is a lot more flexible now. |
|
Back to top
|
|
 |
laserbeak43
Joined: Aug 12, 2010 Posts: 3 Location: Columbia, Maryland, USA
|
|
Back to top
|
|
 |
stekern
Joined: Aug 06, 2010 Posts: 14 Location: Finland
Audio files: 5
|
Posted: Fri Aug 13, 2010 9:01 am Post subject:
|
 |
|
Yes, that should work.
I just noticed that I haven't updated a change to the schematic that is necessary. If you will be using an EL817 the resistor R11 should be 1kohm instead of 280ohm.
The EL817 optocoupler is actually not optimal in MIDI-applications, for example HCPL-0701 is a better choice.
I am not actually using the MIDI-out (at the moment), so if you won't need that you can skip that too. |
|
Back to top
|
|
 |
laserbeak43
Joined: Aug 12, 2010 Posts: 3 Location: Columbia, Maryland, USA
|
Posted: Fri Aug 13, 2010 11:19 am Post subject:
|
 |
|
great!! That's really good news, but I hope i have a nice model opto-coupler at my disposal, cause i'd hate to wait on an order.
i have a CNY4-4, would that be ok? |
|
Back to top
|
|
 |
stekern
Joined: Aug 06, 2010 Posts: 14 Location: Finland
Audio files: 5
|
Posted: Fri Aug 13, 2010 10:53 pm Post subject:
|
 |
|
The problem with the EL817 is that when the pullup resistance is to low, VCE will be to high and the FPGA won't notice the 'low' input.
If the pullup resistance is to high the signals slew rates will be to slow.
My UART implementation is pretty forgiving to slow slew rates, but experiment with R11 if problems arise. |
|
Back to top
|
|
 |
laserbeak43
Joined: Aug 12, 2010 Posts: 3 Location: Columbia, Maryland, USA
|
Posted: Fri Aug 13, 2010 11:02 pm Post subject:
|
 |
|
ok I will  |
|
Back to top
|
|
 |
stekern
Joined: Aug 06, 2010 Posts: 14 Location: Finland
Audio files: 5
|
|
Back to top
|
|
 |
stekern
Joined: Aug 06, 2010 Posts: 14 Location: Finland
Audio files: 5
|
|
Back to top
|
|
 |
|