Implementing a Synthesizer in an FPGA

I started implementing a synthesizer in a low end FPGA board**.

This is the proof-of-concept video.
It is my first YouTube video ever and the first time I “edit” a video, so please be kind.
(But do let me know if I did something stupid, I really don’t know how YouTube works.)

If there is interest, I will post updates.
(I will probably post updates anyways, just to keep myself motivated.)

** That is not the actual vendor I bought mine from a couple of years ago, that store no longer exists.

12 Likes

wow! thats neato!

I never thought about using something like that digital to analog audio converter. I always assumed youd need some sorta DAC / Opamp dealie.

I laughed out loud at the outro.

4 Likes

Yes, please! So much interest!

5 Likes

Nice work! Have you seen the work from https://www.futur3soundz.com/ ? He’s done 2 FPGA based FM synths and has a separate 32 voice analog synth that runs on the same hardware as his latest FM. I built the FM one but haven’t played with it too much or tried the analog synth on it yet…too many projects not enough time!

1 Like

Yeah, using S/PDIF output and MIDI input lets you make a 100% digital synth.
(And both are relatively simple protocols to implement.)
Unfortunately not all mixers have an S/PDIF input. (!)
So I’ll have to use something else, eventually.

Also, I cannot recommend that particular cheap S/PDIF to Analog converter, as it starts distorting significantly in a weird, visible, not quite clipping, way when the digital signal exceeds 50% so you lose 1-bit of usable resolution and for an analog synth emulation project, every bit counts.

4 Likes

Thanks.
Yes, I vaguely remember seeing that project at some point, but as I am more into Altera/Intel FPGAs I didn’t look into much. (Altera vs Xilinx is a religious war of sorts, think EMACS vs vi but much bloodier.)
The board he uses is based on a more modern but also more expensive FPGA.
The Cyclone IV FPGA family that I use here is quite inexpensive but has all the required basic necessities such as hardware multipliers and block RAM which some other low cost FPGAs like the ICE series don’t all have.

I also made an FPGA based FM synth** a few years ago.

It was a quick and dirty project that I made to demo at Maker Faire.
It worked fine and had 8 oscillator per voice, 96-note polyphony and 4 simultaneous timbres, but was still missing some key features (velocity sensitivity, pitch bend, etc) and I never got around to record a video of it.

I will probably re-use some parts of that project for this one, but I decided to re-start from scratch to have a clean slate and maybe write cleaner, more maintainable code with better scalability.

** You’ll probably get a security warning if you try to access that web site as my Lets Encrypt SSL certificate has expired and I haven’t found the time to update it (and I am currently unable to access cPanel from my Godaddy web hosting account).
As you say, too many projects, not enough time.

6 Likes

You are better than me, all of my web projects just use self-signed certs because i cant be bothered.

He also doesn’t share his source - which I only noticed after ordering the board :frowning: I was hoping to learn a lot from him implementations only to be disappointed to see he only releases binaries so you can re-create it but not learn from it or modify it.

I have an old Cyclone II based board (https://openhpsdr.org/ozy.php) from a project that didn’t wind up progressing the way I had hoped it would. And the cheaper Spartan 6 based board his earlier FM synth was based on. I’ve played around a few times with them but just can’t seem to get my head around HDL enough to implement any ideas. Or more accurately - I have a hard time thinking up ideas that are best solved with HDL rather than software because I’m so used to thinking that way and am so inexperienced with designing from a hardware point of view.

Definitely looking forward to more updates!

1 Like

I was nodding vigorously. It’s the perfect length for a video presentation.

2 Likes

Ditto to both of you. Refreshing.

1 Like

Thanks for noticing and commenting.
It’s been a pet peeve of mine for a while - we all know how to subscribe and get notifications.

And don’t get me started on 10+ minutes long movie credits and the stupid little animations for each producer, sub-producer, co-producer, etc.
Do they think we’re impressed by those? /rant

OK, I’m taking my own topic, off topic.

Now I have to decide whether to make it my catchphrase to spread the word or to really abide by it.

3 Likes

Nice ! I hope you will publish more on the subject.

I’ve got 2 FPLA boards here (DECA Altera Max 10, and Earth People Altera Max 10) I want to use to run some DSP-code on but so far have found it easier to either implement stuff in analog electronics or take the escape route via Von Neumann devices like the Electrosmith Daisy Seed or the Teensy with accompanying ADDA-boards that I can program in C / C++.

The learning curve for FPGA programming is said to be quite steep so I think it would be very valuable to learn from someone with experience in the field.

Will you publish the code as examples somewhere?

3 Likes

I’ll be honest, aside from asic bitcoin mining, I haven’t given fpga much thought. But just hearing about other applications makes me excited as hell. Also hearing I can program an ic seems more friendly than building out the circuit itself.

1 Like

I wasn’t familiar with the boards you mention, but the MAX 10 family is certainly interesting, it’s the first FPGA family from Altera with built-in Analog to Digital converters.

The DECA board you mention is significantly more expensive than the one I am currently playing with, but it has everything you need to built a whole synthesizer, including a 24-bit audio CODEC for high quality audio input and output, ADCs and USB for control and its FPGA is more than eight time larger. With the RAM it also provides, some effects such as echo and reverb could also potentially be implemented, and its Flash memory could be used to store samples for a combined wav trigger and Big Button like drum machine.

The possibilities are endless, but as you say, a lot of that can also be implemented with Teensy or Daisy boards, the latter being particularly interesting with its built-in hardware support for audio.

The learning curve for FPGAs is indeed steep, but not insurmountable, there are more and more on-ramps for software engineers, but I am not too familiar with them. They are very useful to make it easier for AI people to use FPGAs, but that is more applicable to the high end FPGAs that sell for thousands of dollars.

I love the parallel mindset you have to get into when programming in HDLs (being in North America and not in the military, I use SystemVerilog). To this day, I still find exhilarating the idea that the hundreds or even thousands of lines of code that you write all execute every clock cycle, not sequentially one at a time, all at the same time.

As for sharing source code, I haven’t decided yet how much, if any, I will make public. I still have hopes of some day making a semi-commercial product out of some of this work. I have spent years jumping through encryption hoops for my employer to make sure we protected our intellectual property, it’s a hard mindset to get out of.

I admire the generosity of Sam and the Free Open Source community but I also respect people like the Electric Druid who provide interesting product at fairly low cost while keeping their source code private.

There is a huge benefit of getting the community to contribute to improve your products, but there is also an enormous support cost when people start poking around into your code.

2 Likes

For digital logic that is so true!
It is fun to put 4000 series and 7400 series DIP ICs on a breadboard and wire them up, but it is so much more efficient to write a few lines of Verilog.

Exploring alternatives is also much faster.

And you always have the gates you need, no need to wait days for Tayda (or week for AliExpress) to send you the three input NOR gate that you didn’t know ahead of time you would need.

1 Like

It is now about 146 USD, but I got one when they were first released for 65 USD. So not too bad. The earth people max pro logic development system was a kickstarter project I backed in 2017 which cost 63 USD.

That is what made me interested in FPGA’s in the first place. I’ve got a filtering application in mind that uses quite a few filters in parallel and most cpu’s would not be able to handle that without hick ups but an fpga should be able to run it easily. But first I need to finish a few other projects.

I’m not sure I understand what you mean by this. Can you elaborate on that a bit?

1 Like

That parallel nature is what trips me up. I have the same problem with synchronous javascript. My mind just gets lost thinking in parallel rather than series :smiley: I keep hoping that one of these days it will click for me but so far it hasn’t.

BTW - Electric Druid does release their code…they just don’t go out of their way to draw attention to it, make it easy to find, or keep it in a VCS like git. This post for example: https://electricdruid.net/electric-druid-chips-the-next-generation/ has the raw (and very nicely commented) ASM code for the TAPLFO3C, STOMPLFO, VCLFO10, and ENVGEN8C. Their VCDO source is on this page: https://electricdruid.net/voltage-controlled-digital-oscillator-vcdo1/

I’ve been able to find code for all of their chips if I dig enough. Basically they tend to post it in their blog posts when the announce something, but don’t link it from the product detail pages so you have to put in a bit of effort to find it. And it’s a great learning resource (along with their details posts about circuits, there’s some GREAT stuff in their blog.)

But…even though I have 3 PIC programmers I’d still rather buy the chips from them. I don’t have the correct raw PIC’s on hand for most of their chips and frankly flashing/burning PIC’s has always been hit or miss for me and drives me crazy :smiley:

Bottom line - it’s your code and your choice there’s no debating or denying that. I personally tend to share everything I can since there’s so much I wouldn’t have learned if it wasn’t for others doing the same. And it’s probably one of the reasons why I haven’t done much with the FPGA boards I have…I just haven’t found enough complete examples of HDL to learn from. I’ve found lots of bits and pieces…and a few very simple things…but nothing that helps me bring it together to the point of implementing something much beyond the “hello world” level.

2 Likes

Same here!

Same here. The course that altera gives is too high level, does everything in macro’s and to show the power of the fpga shows that you can implement a real CPU in an fpga and you can then write your C-code and even upload that code to it and run that. That is a nice way of showing what an fpga can do, but it is worthless in another sense: it does not teach you how to write the cpu, that would be way too complex and example nor do you end up with a usable and hackable piece of code. This all adds up to the learning curve or maybe, this is the learning curve.

So if anyone knows about a reference to a good tutorial ( please don’t google now, I can do that myself ), let me (and others here) know.

1 Like

You mean “asynchronous”, right? Synchronous would be in series.

1 Like

I haven’t looked at FPGAs. I’m a software expert so in principle this should be a doddle. I’ll take a look at Wikipedia on this and see what I think.

2 Likes