So, welcome Sebastian Holtzab, the stage is yours.
Okay, thank you.
Hi everybody, my name is Sebastian, I'm an embedded systems engineer, usually in kind
of the automotive, functional safety, autonomous vehicle space, but today I want to talk about
one of my side projects that's completely unrelated to what I do at work, and I hope
you guys enjoy it, so just kind of, because I'm curious, who actually knows what Eurorack
is?
Oh, that's amazing, okay, I wasn't really sure what to expect, okay, that makes me really
happy.
Who actually has a Eurorack system at home, and plays with it?
Oh, okay, four or five, okay, actually after this talk, if you have a Eurorack system and
you like playing with FPGAs, I have a couple of these boards, so please talk to me, I'm
willing to give them away if you have cool ideas, but we can get back to that at the
end.
So, basically, Eurorack is a modular system for building your own kind of hardware electronic
music synthesizers, and it was kind of created in the 90s and standardised by Dopefar, it's
a little bit of a rough standard because it's a little bit rough around the edges and imprecise,
but basically what the Eurorack standard is, is it's a description for what the dimensions
of these modules should look like, and kind of roughly what the signals look like that
flow between these modules, and so there are a whole bunch of different manufacturers,
thousands of manufacturers, tens of thousands of different modules that you can buy from
all sorts of boutiques, small and big manufacturers, and you can kind of buy these things, put
them together into a system like this, and then use this to create music, that's kind
of what Eurorack system is.
And just to give you a small idea of what a typical module looks like, here is kind
of the input and output jacks on a mutable instruments module, it's basically an oscillator
module, and you can see there is an output jack where basically audio frequency signals
come out of the oscillator, and then you can kind of change the properties of these signals
by plugging in different kinds of input signals, that for example the V-Oct input jack that
actually changes the pitch of the output signal, so you can choose which note the oscillator
is playing, if you want to change the volume of the oscillator then you would send signals
into the level input for example, but that's kind of what the input and output jacks on
one of these individual modules actually looks like.
But where did this project actually come from?
So I had a crazy idea for a weird high performance granular sampling device that I wanted to
make using FPGAs, and I didn't really know where to start in terms of okay, you can buy
an FPGA development platform, you can buy development boards for audio codec ICs, you
can put it together but then you need to do some conditioning on the signal to make it
work with Eurorack, and potentially you also need to calibrate it as well, and I couldn't
find examples for this kind of thing, so that's why I started playing in this world, because
I couldn't find anything that really combined the hardware synthesizer world of Eurorack,
and this PMOD interface, and PMOD is basically, I think it was something that was originally
standardized by Digiland, and there's a whole bunch of FPGA development boards that you
can buy that have this interface, so basically if you have the Eurorack PMOD hardware that
you can see above there, you can plug it into an FPGA development board, you can synthesize
one of the example designs, you can use that in your Eurorack system and start making weird
music.
So this project is a hardware design, so this board designing QICAD that you can find in
the GitHub repository, it's a bunch of system very log that implements kind of drivers for
the codec and the calibration, online calibration, some example DSP cores, and a bunch of simulation
infrastructure, that's not just test benches for the FPGA gateway, but also allows you
to simulate an entire modular system on your machine with like this little bit of FPGA
code that you wrote for your module, and I'll show you what that looks like in a bit.
So just to give you a look at what this looks like, so the Icebreak is a fantastic FPGA
development board that I highly recommend, supports all the open source tool chains,
you can purchase it from one bit squared, and this is what it looks like plugged into
the hardware here, I wouldn't necessarily recommend that you plug it in this way because
most Eurorack cases won't actually fit something this deep, so I would actually recommend that
you use a ribbon cable to connect the FPGA board to your, to this kind of expansion module
here, but it doesn't have to be this development board, it could be a different one.
Just to give you an idea, the Icebreaker I think right now is 70 or 80 U.S. dollars,
I think, or so, and what I actually wanted to show was a demo video, but I don't have
any audio, so if you're curious to see this thing in action, then I encourage you to go
to the GitHub repository for these slides, and in the GitHub repository are two movie
files, maybe go and look at these after the talk, that includes like a video example of
a couple of example calls running and what audio sounds like.
So yeah, just leave that there for a second.
So why might you want to play with Eurorack P-Mode?
Well, maybe you want to start playing with DSP, maybe you want to try doing things that
are difficult on an MCU-based platform, and what do I mean by that?
So, if you want to do super low latency operations on a microcontroller-based platform, and there
are a few microcontroller-based development platforms for Eurorack, very quickly if you
want very low latency, you have to start dealing with DMA, you have to start dealing
with some pretty sophisticated real-time operating system concepts, for example, and actually
there are quite a few things that are easier to do in the FPGA world, especially when it
comes to DSP than in the MCU-based world, but even if that wasn't the case, it's still
kind of cool in my opinion to, it's a cool learning platform to play with FPGAs.
If you have kind of this world where you can just play with sound, plug arbitrary things
in, make a module that implements a tiny little piece of functionality and see how it is affected
by all different effect modules and different oscillators they have in your system and it
makes it very easy to discover things.
So in the GitHub repository for this project, you can find a whole bunch of examples for
different DSP cores, and you can load these onto your FPGA development platform, you can
try them out and see how they sound, and that's just to give you a picture, there's going
to be more coming, but just to give you a very simple example of what one of these cores
looks like, and to be clear, this is just the DSP core, there's a whole bunch of driver
cores that you don't see that you don't have to worry about if you're making a design
like this.
This is Verilog, and this is implementing something called a voltage control amplifier,
what does that mean?
We're just multiplying one channel by another channel and sending that to an output channel.
That's basically what a voltage control amplifier is, and in Verilog that looks like this.
We take basically the output is input 0 multiplied by input 1, we have to shift it otherwise,
because basically in this case it's a 16-bit sample, then we have a 32-bit result, this
is to convert it back into a 16-bit sample so that we can send it to the output, but
why is this cool?
This is very simple, but what's cool is with this very, very simple piece of code in Verilog,
you achieve something that is ridiculously low latency, so here we're achieving just
with that example, like basically 120 microseconds of latency, if you're sampling at 192 kHz that's
24 samples of latency from the input to the output, just with this small bit of code.
If you are going to try and do that on a microcontroller, not easy, you can do it, but it's not easy.
In this case, I actually think that the latency on an FPGA-based system should have been a
bit lower, but what's actually going on here, why are we getting 24 samples of latency from
the input to the output with a simple implementation like this?
It's because the audio codec on this piece of hardware itself has a bunch of internal
filters that kind of pipeline the input, it uses this for like, I think some kind of pre-emphasis
function or something that you can partially disable but not entirely disable, but that's
kind of where this is coming from.
In this plot up here, you can see, kind of in red, a signal coming into both the URAC
PMOD and another MCU-based module, the DISTing, and then the yellow trace is what's coming
out of the URAC PMOD and then the blue trace is what's coming out of the microcontroller-based
module, so you can kind of see the difference in latency there, and both of them are both
acting as the same thing in this case.
So the hardware, I went through a few different revisions, I made some mistakes in revision
one and two, as you can see here by the Bodge wires, but as of right now, if you were to
go ahead and download the Kaikai design files for revision 2.2, which is this one on the
right here, which I have in front of me here, it works without any modification, so you
can just build it.
But there is a revision 3 coming and I'll talk about that in a second.
So what does this hardware design actually look like?
Basically there are eight channels, we have four input channels, four output channels,
a bunch of LED indicators so you can see what's going on, but then the heart of this whole
system is the audio codec, and what's interesting about this audio codec is it's a chip that's
kind of intended for the automotive industry, and some other Eurorack modules for this kind
of purpose will not use kind of a normal audio codec, they'll use instrumentation amplifiers
or some other type of ADC or DAC, and the reason for that is because in Eurorack we're
not just dealing with audio frequency AC coupled signals, in Eurorack we're also dealing with
sometimes extremely fast DC signals that need to be accurate, for example if you are controlling
an oscillator and you need to control the pitch very precisely, the absolute DC accuracy
is important because if you shift by a few millivolts then suddenly your song is not
in tune anymore, and that's why DC accuracy is important, and basically audio codec IC
is often not designed for DC accuracy, but the benefit of an audio codec IC is that it's
cheap, so you might pay three or four euros per unit instead of, I don't know for instrumentation
quality converter you're paying tens of euros perhaps, but the cool thing is, the main difference
here and at least in the case of this codec that I was playing with in this hardware,
there is kind of a fixed DC bias in the codec input and output when you get it from the
factory and you can calibrate this out just using a simple, like you can basically calibrate
it out using a simple linear regression, kind of feed five volts into the codec, measure
what it gives you, send minus five volts in, measure what it gives you, do that for the
inputs as well as the outputs, and then on the FPGA itself account for this DC bias that's
present in the codec after it's manufactured, and after doing it going through this calibration
process, and there are scripts to do this calibration in the GitHub repository, you
can actually achieve kind of sub five millivolt level, absolute DC accuracy between minus
ten and ten volts using an audio codec chip, which is awesome because it brings manufacturing
cost down if you decide to kind of create your own FPGA based instrument and it means
that this thing doesn't cost so much, and it also means you can use I2S which is kind
of a standard-dish audio interface protocol, embedded audio interface protocol instead
of some other interface protocol, so basically the datasheet strongly, it does not suggest
that you do this, but if you do it, it works really well, so like explicitly ignoring what
it says to do in the recommended external circuits, and I've tested the crap out of
this, even over temperature and so on, it seems to work, and I mean fortunately we're
not dealing with automotive and functional safety, so no one's going to complain if we
don't do things the way the datasheet suggests that we do them.
So this is kind of just a simplified overview of what the FPGA gateway looks like for the
example project here, and basically the part that you write yourself is this user-defined
DSP core, and then between that and the rest of the world is a driver for the codec IC,
a driver for the I2C interface that initializes the codec IC, a calibration routine that basically
does this online calibration of the codec that I was mentioning before, and yeah, I
mean that's what it looks like.
So that's kind of the hardware, and I also described a bit about how the gateway works,
but if you have no hardware at all, you can still play with this stuff, because I actually
wrote a plug-in for a BCV rack, which is an open source simulator for modular synthesis
system, basically, Eurorack, and what this plug-in does is it actually simulates with
varilator, like here I can show you, oh, got one minute, okay, so here's a varilog implementation
of a clock divider, and this is sitting inside a plug-in for BCV rack, and it's compiled
with varilator to C++ so that you can run it inside an entire modular synthesis system
simulation, and so now we have basically this simulation of the hardware with the varilog
that would be running on your FPGA, actually running through varilator in translated C++
linked to the BCV rack binary so that you can actually run your FPGA code inside a modular
synthesis system, which is kind of crazy, and it makes me happy that you clapped then,
but that was actually the easiest thing to do out of everything that I described before,
like literally that was about four hours of work, I was surprised that it was so easy,
but I encourage you to play with this stuff if you're interested in it, so, oh, okay,
that's time for me, I was almost done, thank you for listening, so two things I would like
to note, I am thinking of going through with a manufacturing run for the revision three
of these boards, so if you are interested in the hardware here, if this is your niche,
start a GitHub repository so I know how many people will be interested, that's my only
request, because if I manufacture a hundred of these things and they just hang around
in my apartment, then I won't know what to do with them, so thank you. Thank you.