 Hello and welcome to Beeps and Boops, a synthio panel discussion. I'm Paul Cutler and I'll be your moderator today. I'd like to invite you to join the discussion in the Adafruit Discord at adafruit.it-slash-discord. We'll even have some time for Q&A at the end, so join in and drop your questions in the live broadcast chat channel. And if you're shopping today, use the code SirPieDay, all one word, for a discount in the Adafruit shop. We've got some great discussion topics planned today, but first, let's do introductions. I'll start and then we'll go around alphabetically by first name, and I have a short icebreaker question for each of you. What is your background with music and or synths? So let me bring everyone in. And as I mentioned, I'm Paul Cutler. I'm host of the podcast, The Circuit Python Show. My background with music is I took piano lessons for eight or nine years as a kid and learned all the classical composers and played them. But it's been years since I've played and I've forgotten pretty much everything I know. I have had fun the last few months getting back into it with the MIDI project and now synth IO. Jeff? So all through junior high and high school, I was in vocal music choir did a year of madrigals, which is like European old music. It's pretty fun, acapella stuff. And I did a semester of music theory. So when you talk about scales and chords, I have some idea of what you're talking about. But I'm not a person who creates music kind of every day. And that meant I got to learn a lot during the synth IO project. Thanks, Jeff. What about you, JP? So I took lessons in like piano and clarinet and things and was terrible at reading music. But I loved our organ because it was mostly a sound design machine for making weird sounds. And then I studied voice through college and sang in a bunch of groups and did some acapella albums and things like that. And even did some professional beatboxing at one point. So I've always been kind of around making funny sounds and then... Prove it, prove it. I haven't done it on these streams accidentally, but on the synth side of things, I kind of got into them hardcore just about four or five years ago starting with modular synthesis and then that got me interested in just synthesis in general. So I'll actually do a little demo in a bit using some modular synths that I really like being able to pick apart the individual pieces and put them together. Very cool. I had no idea that you did so much voice work as well. Right on. How about you, Katny? So, same thing with the piano lessons. I didn't remember much. There's like two songs I can still play. One of them relatively complicated, but that's about it. I did music theater at university. I also did voice training as well throughout pretty much every degree I ever switched to. I was still doing voice training. And then I also did that in high school. I was in choir. I was always in choir through uni. And then one of my favorite things I did was got started with an electronic music degree. It was actually like a degree for electronic music, as it sounds like. And it was something that was an actual music degree in the sense that you still went through the ten hour days of ear training and piano lessons and music theory and working your instrument, which for me was my voice. But then also added in getting to have fun with digital sound, essentially. And that was tons of fun, which for various reasons didn't end up working out for me to stick with it. But that was kind of the first time I really got into making electronic music myself. I was always very into listening to it, but that was the first time I put myself. Short of that, I also had guitar lessons. And I try to stick with things like I sing regularly. That's about it. Certainly not professionally. And I have this new guitar that I still haven't really got back into playing. So I have the things around. I have a piano in my living room, et cetera, for when I'm ready. We'll see. It's when I have time. Yeah, and we all have so much time these days. Todd, what about you? Well, I don't think I can beat like professional music degree or professional beatboxer. But I've tried and failed over the years to take piano lessons and guitar lessons multiple times. In college, it was kind of close to a music minor, but it was very vague. But that was when I got my first synthesizer via a sort of scholarship mix-up. A little bit extra money. But yeah, then I've just been just doing all the synths kind of since then. So I've went through the 90s virtual analog era of synthesizers where people were throwing away the digital sounds of the late 80s and going back to analog but with DSP chips in the 90s. And then I went full hardware synths and no computers to sequence stuff in the early 2000s. Then I went full DAW using just Ableton Live in the mid-2000s. And then I just kind of put it away for a long time. And then JP was like, hey, I'm getting into modular synths. And so I've gotten back into music these last five years. It's been really fun. And it's totally different because modular synths is all evil scientist layer knobs and crazy wires and strange noises. And so synth IO very much fits into that for me. It's like this next level. It's like Python wires instead of physical wires. Well, that's great. It sounds like when it comes to synths, we have a whole range of experience. I know I'm very basic all the way up to modular synths. So I thought we might start at the beginning. JP, could you explain to us what exactly music synthesis is? I can try. I didn't look up Webster's definition or anything like that. But one of the definitions that comes to mind is using electronics to create sound, period. So the word synthesis, some people actually early on were like, this is a bad word for this because we're not trying to synthesize existing sounds. We're trying to make new sounds that had never existed before. So the sort of bad rap that synths, especially like crappy little like Yamaha piano keyboards from the toy store is that they have a bad piano sound and they have a bad violin sound and they have a bad flute sound. So synthesizers really can cover the range of electronic instruments that generate sound without striking some physical object, which is kind of every other instrument. The distinction we kind of make, I think here particularly when discussing synth IO, is that we're building electronic instruments that generate sound rather than playback sampled sound. And those things can kind of blend into each other. There are certainly synths that will combine a sample and a synthesized wave of some kind for sounds. But we're with synthesizers talking about an electronic instrument that can generate sound using either analog circuitry, digital circuitry, a combination of them, and in our case code. So there are synthesizers, if you look up like an Atari punk console, which I wish I brought an example. It's a pair of A-stable 555 oscillator chips that sound really sort of raunchy and early 80s sounding and a lot of fun, the steps they make sound very Atari video game music like. So that's a case of no microcontroller involved. The more modern era we use microcontrollers and we code in typically things like C, Arduino, and now thanks to the work on synth IO inside of Circuit Python. So, I don't know if that's, if you want me to stop there or if you'd like me to go into a little bit of what we consider to be a fairly typical set of building blocks to make sound. I can jump into that or I can save that. Oh, I think that would be great. That's a great next step as we understand what those building blocks are. I think it will be easier to understand how synth IO uses those. Okay, cool. Yeah, so and we were chatting a little bit before the show and Jeff was like, huh, is that really, is that an analog to what we have going on? So we'll find out. I think it's somewhat close to what synth IO is doing in code is what I'm going to show over here on a little modular synth I put together. Switch to or actually, yeah, perfect. We'll switch to that. I'm going to run over there and let me know actually I'm going to turn off my fan here so I can hear a little better. Let me know how the levels are because I'm going to play some sounds and I'm going to try to also talk at the same time. So what you see here, I have this little chart and this talks about sort of building blocks of synthesis come together to make what is sometimes called a synth voice. The first one we have here, this is VCO V stands for voltage. So voltage controlled this voltage controlled that is a throwback to the early 1960s approach from Bob Mogue and Don Bukla to use a certain voltage to tell a piece of equipment what note to play or what amplification to modulate something at. So voltage controlled oscillator, oscillator is kind of the key part here for this one. This one makes audio. This one oscillates at a high enough frequency that we can hear it. It's in the audible range. And so what I'm going to do is I'm actually going to very dangerously for myself un-patch everything here and do this from scratch. So if all we have is an oscillator, this is a great place to start because this thing makes sound. It has this particular module has a few different waveforms that we can play. So I'm going to start with a saw wave. And let me know if that level is pretty good. If you can hear that and you can hear me, I see thumbs up. Okay, that's good. Raise the level actually. We'll raise that level up. That was a thumb raise, not a thumb up. Yes. How about that? That's good. Okay. So that is a fixed pitch of this what's called a sawtooth wave. It's a shape that you see right here is the shape of that wave. So it's got a lot of harmonics to it. If I go to a triangle wave, it sounds a little smoother. It doesn't have all that rich harmonic content. It's a little more of the fundamental note is what we're hearing. If I do a type of square wave that's called pulse width modulated. It's got lots of cool harmonics and it has the ability to emphasize certain harmonics over others. So I'm going to go back to this square wave here. And I'm going to mess around with a pitch. So just with your hands on knobs, I can say let's send different voltage to that oscillator. And now we're playing a different note. You can hear this one can sweep continuously. It's not fixed to something like semitones. We can kind of play any pitch within a fairly large range. So with this fine control knob, this is considered the fine control knob on this one. We can play an octave or we can jump an octave lower. That is low as we can get this big flabby sounding thing. And we can get higher and higher. Okay. So that's super annoying, right? I want to probably go to our gig and try to get people onto the dance floor with that. So we want to be able to send specific pitches to it. There are a lot of ways to do that. And if you look at this chart here, you can see I've got my oscillator. And then I have something I'm calling user input, which in this case does happen to be a keyboard. But this could be a sequencer. This could be a theremin like light interface. It could be motion control. There's a lot of ways to send pitch information to this oscillator. And the sort of message that is sent is voltage. So you see here CV control voltage. And just up here it's kind of inverted voltage controlled oscillator. So I'm going to send one volt, 1.5 volts, 2 volts and so on. And actually this system is based on a volt per octave. So I can jump an octave by sending 2 volts, 4 volts or 3 volts, 4 volts, 5 volts and so on. So what I'll do is I'm going to give us that same output. But now I'm going to tell my keyboard to send voltage depending on what note I play. So that's pretty good. The input device, like I said, could be something like a sequencer. It could be an arpeggiator. So if I send, I'm just going to play. So now I'm sending a preset sequence of notes that I told it earlier I wanted to be able to play. One thing you'll notice, however, is that it's always on, right? It's just going to play a note. It's never going to stop. It's a little bit tiring. So what we'd like to be able to do is listen to that oscillator after it has gone through what's called somewhat confusingly a voltage controlled amplifier. It's actually more of a voltage controlled attenuator. It doesn't really amplify in the sense of some in other areas of music, like in guitars, amplifications really gone. These are really just from the zero, it's off to its at its full volume at one. Sometimes they have a little overdrive to them. But anyway, this is a thing that can essentially mute and unmute in gradations the sound coming from that VCO. So what I'm going to do is I'm going to send my output from the VCA to my little amplifier, my little speaker. I should call it over here. And now I'm going to patch what's coming out of, what color did I use? I think white, what's coming out of that VCO? There's that saw wave again. And that's going to be an input signal going into the VCA. You don't hear anything. And that's because I have a volume or a level knob that's at zero. So now I can start turning that level up and down if I set my voltage controlled pitch information from the keyboard over here. And then... So now I'm hand playing when the notes should happen, which is also awkward and confusing. So the next idea is to say, okay, there's actually a second signal coming out of this keyboard. So let's control the amplification level or the attenuation level of this VCA from the keyboard. So again, we have voltage coming out of the keyboard. When I press a note, it's both sending out the pitch information and now it's going to be sending out the... Should we open or close this amplification or this attenuation? Where do I want that? I want that here. Yay. So now we have both the gate of open or close that gate of sound and the pitch. And you'll notice it stays open. I know you can't really see the keyboard here. Sorry, but it stays open, opens that gate of sound for as long as I have something held. Which is nice, except it's a very square sort of abrupt thing. It's on or it's off. It's very sort of digital. So the next thing we want to introduce is a concept of an envelope. And that is rather than a square shape of gate open, gate closed, we want to be able to maybe smoothly ramp up to having it open over time. So it's a swell or we want immediately on, but when I release the key, it's going to taper off. So what I'm going to do now is still get gate information out of my keyboard, but I'm going to send it to a thing that is going to trigger a shape of that gate. And this is this envelope generator. So I will then take the output from this gate here. You can see on my chart back into the amplifier. So we'll send output from gate back to the VCA. So real fast envelope. I'm doing the same thing on the keyboard. You can see my finger up here. It'll stay open as long as I hold it. But now when I release, we get this fade out. So that's what this envelope does. And this is usually in a few stages. I won't get into that, but it can be as simple as open fully and then taper off to having a few stages of that envelope generation, which is similar to what we have in Synthio. And then that's really your basic voice. We then are just putting icing on the cake here with a thing called a filter. So this is a way to shape some of that harmonic content. So what I'll do is send my output from the amplification rather than straight out to my speaker. I'm going to send it through a thing that's going to filter that. So we can filter frequencies with it. We can also emphasize certain frequencies with it. Let's take the output from the VCA, which is being shaped by the envelope, and put that into the input of a filter. And I'm just going to hold a note here and play around with that filter frequency. And this is often one of the best things to control. You'll see like DJs DJing a show and you're like, what are they even doing? Usually they're touching a filter knob. It's something you can safely not screw things up, but it sounds cool. Same pitch is being played. We're just kind of changing the tone of it or the timbre of it. One thing you'll notice though is that I'm doing that by hand. So again, we want the machine to do it for us. And so this is really kind of the final piece of this subtractive synthesis voice chain that we have per note, which is a thing I have it off to the side here in a separate case. It's a low frequency oscillator, so it's really similar to this guy, this VCO. It's a wave. It's just running at subaudible rates. It's running kind of slowly. It can take a second. It can take 20 seconds. It's up to you how long that, let's see where do I have? Oh, here I have the output from that. How long that period is of it? You can see this is, it doesn't want to show up very nicely on screen, but I have a little sort of oscilloscope here showing the rise and fall of this LFO. So what I'm going to do is I'm going to speed that up a bit. So you can see I've got wah, wah, wah, wah, wah, wah going on there. I'm now going to plug that into my frequency knob here on the filter. So now I don't have to touch that. It's happening sort of automated. Right now I'm hands off. I've got the sequencer playing. I can twiddle the speed of that. Now one of the things that we have in Synth.io is we have, and Jeff can speak to this, hopefully I'm not telling too many lies. What we have in Synth.io is a chain similar to this. We do have the ability to create these low frequency oscillators. And in Synth.io we have patch points similar to these plugs here or these sockets. And we can plug our LFO, low frequency oscillator, into the pitch, pitch bend of an oscillator, and also into the ring modulation, which is an effect somewhat similar to a filter. So what I'm going to do is I'm going to run my output of this LFO, not to the filter, but instead to my pitch. So here I'm going to hold a note. Now I'm going to adjust the pitch a little bit. So this is similar to something like a Leslie effect on an organ or a tremolo. So we're just wavering the pitch up and down. You can get out of hand with this for special effects. And on top of that you could run the same LFO out to your filter. So we'll be doing both the pitch wobbles and that filter knob at the same time with the same output. I won't patch that up now because I think it's a good time to stop. So that's the sort of basics of this type of subtractive synthesis voice with these little components. And what I think is this represents in a lot of ways what each note in SynthIO can do. It has these components and we can adjust those in Circuit Python. So unless there's anything else you need to see or want to see or you're like, please do your God stop, I will stop and join back into the panel. That's great. No, thank you for the explanation. I think it's great to have that level setting. And that's all we have time for today. Well, we're still at the beginning. So Jeff, I understand there was a SynthIO module before you picked it up earlier this year just to start reworking it. What's a little bit of that history? That's right. So we had a community member by the name of Artyom Skirubov who contributed this thing called SynthIO. And it was a pretty simple thing for playing MIDI files and it just would play a square wave. There wasn't any control over envelope or volume or filters. But it did give like a basis for, you know, how do you create an audio signal over time, which is what you do at the low level. It's like for, you know, if your audio is 44 kilohertz, then 44,000 times per second, you're going to have a different audio value. And it had the bones of that. And I just built on that when LaMore gave me the project. And yeah, basically LaMore said, hey, take a look at this because we had the Metro 1011 board on the way with the M7 microcontroller. And the thought was, well, that's probably powerful enough to do synthesizer stuff. So go see what you can do with this existing code to take advantage of more things. And I started working on it. And then as folks like Todd started discovering, this actually ran really well, like way down the line of microcontrollers. So we're running it on RP2040s. We're running it on Sandy 51s, which this little demo, I'll show a little bit later. So actually it runs off a wide range, but the impetus was that we wanted to do this with the Metro M7 microcontroller, which has more CPU megahertz and things like that. And yeah, so I worked on it on and off for about two months, interspersed with other side projects. And as I think we're going to talk about in a minute, I'm like, John Park and Todd Bot, you know about this stuff. And I need to hear from you how it's going and where it needs to go. It was so fascinating watching this happen with Jeff having limited synth understanding. And like, well, it was, I mean, you were the perfect person for it in my opinion. Like to come to it from a code standpoint was an interesting and obviously very successful choice. And to watch the development happen with Jeff knowing what the code was doing, but not necessarily how it applied to, you know, synth usage was really interesting. And obviously it was all available on GitHub and Discord. And so we all got to anybody who cared to anywhere. I certainly kept up with it. Got to watch this whole development cycle with everybody involved. And I found that really interesting. Well, and I asked myself, you know, why did I get this project? And I'm not 100% sure this is a real memory, but I remember a long time ago in an internal meeting, somebody said, I want to do a synthesizer project. And the more said, if I give you that project, you'll never come back. It'll just go on forever. And I wonder if she chose me because I was somebody who would be able to set that down because it's not like totally my jam. It's just, you know, intellectually it's interesting, but I don't want to do it every minute. Whereas I get the impression that some of you maybe would just do that forever if it was your option. So during this... Oh, go ahead, Ty. It is really cool to have you who's not synth-oriented working on this because you're making these choices and I'm like, that's not how things go. Then I'm like, wait, but this is interesting. And a lot of times the way things are done and synthesizers are, just because that was the way it was done before, we still call oscillators VCOs even in code libraries or call that, and there's no voltage, there's no real oscillation. And so let's see how this is going because it's interesting. So a lot of those things in John's picture, they're lumped in this object called note. A note has a frequency. It has an envelope. It has a bunch of other properties. And that's, I guess, a different way of thinking, but it made sense to me. So it's what I did. So there really is an adapting your world view from other systems into synth.io. And I really appreciate about you two that you're like, yeah, we're going to roll with this and see where it takes us. And no, you shall go back and make it be exactly like an existing system. I appreciated how open you were to the outsider viewpoint. Yeah, I'll speak to that. The notion of you creating a thing called note that has essentially every piece of that chain that I just showed there, in the real synthesizer world, typically, if you wanted to have a poly... That was a monophonic synth. I was never playing two notes at once. No, you'd need 12 of those if you wanted to do what synth.io does. 12 of all that stuff. Yeah, and you would replicate all of it. And everyone's like, well, that's silly. Even in an integrated synth, you wouldn't do that. You would say, I have multiple oscillators and maybe I have multiple envelopes and VCA's. But I'm going to, at the end of it, route them all through one filter. And so you run into this term parafani. So this polyfani, which is what you've got with synth.io, which is what I would happen if I had eight systems just like that. I would have eight note polyphony. Every note has its own sort of full signal chain. That's expensive in the old days. So people got used to this notion of, well, I can play eight notes, but they all route through one filter because it would be so expensive to do eight filters. So by you not knowing that that's not how it's done, you went and made kind of the really high-end idea of, no, no, no, we have the full signal chain per note, which, again, Todd and I going, wait, why is he doing it this way? We would have probably shaped things if we'd written out a design document to look exactly like everything else looks, which is kind of boring. That's not quite true, particularly about the filtering because initially I did research on filtering and I came across the term of, I think it's FIR, finite impulse response filtering. And it's like a really versatile kind of filter, but it does a lot of mathematical operations for every sample. And so I did implement it as there's one of these filters for all of the notes. And Todd Bot said, you're using the wrong math and he directed me at bi-quad filtering, which instead of doing like a hundred mathematical operations per sample does like six, six multiplications or something. And so then it became technically feasible to have a different one for each note. So that was one of these things that came out of the dialogue. I didn't realize that that's awesome. Yeah, I just was like, you know, I've seen the filters that I use on my cheapy arduinos and they're not FIR filters. Yeah. Well, that's great. Jeff, you started to touch on it a little bit about the chipsets that Cynthia was supported on. What is kind of the minimum hardware that you would need to get started? So I would say, you know, if you want to get started, pick up an RP2040 prop maker because it has the built-in I2S amplifier and you can just hook a speaker to it. Is that that there? Yeah. And oh, that is nice. Is that a 3D print? No, no, it's just a VHB taped. Oh, okay. That whole thing is the... That encloses the speaker, yeah. Yeah, yeah. That's great. And then you can put, like if you want to use it with a keyboard, you can put a second board on it for your MIDI input and then you can, you know, key your keyboard and have the sounds come out. It also has a accelerometer, which is kind of the core of this project idea of mine. This is the badge I wore at Picon two years ago and I was working on Cynthia when I was heading to Picon and I'm like, I have this idea. I want personal area wind chimes. And the accelerometer in here, every time you bump it, it's going to like trigger a note. And at the time, well, even now I can't get the volume from the tiny little speaker in here to go as high as I wanted to like annoy everyone around me at the conference. But I'll just kind of pull my microphone into frame here. Whoa, okay. Hold on. Uh-uh. That's the mic dude doing it live. Yeah. And play this guy. It's a strange little instrument because you have no control over it other than... But it's using some tricks I learned from Todd, like play several copies of a note to make it sound richer and all these other things. So maybe next year at Picon I'll like have the boom box version of this and be walking around and... I have a question for you, Jeff. How did you feel that working on Synthio on that board was limited? Um, no, it was... Relative to say the RP-2040. The reason I ask is I gave a lot of thought to that same question about what is the minimal hardware you need. And the feather RP-20, the feather prop maker RP-2040 was like the first thing I came up with, it occurred to me that using something like the Pi Gamer or the Pi Bad also gives you a bunch of buttons and stuff all built in. That's true, yeah. Which then lets you interact with it without wiring extra stuff to it. Right. So I wonder if that really worked well enough? Um, so I think if I tap this enough times, it'll play the 12 notes. It's not using filtering. It's not using ring modulation, both of which increase the amount of computation. And I have no idea what sample rate it's working at. But if you've got something... If you've got a same D51, if you've got a RP-2040, those both work pretty well. I tried with the NRF of the the circuit playground and I found that if you were trying to use the touch inputs, the audio would stutter a little bit and I never did discover why that was. But really a lot of boards, somebody did it, Todd, you did one with ESP32. What ESP32 was that? The S3? Both the S3 and the S2. So I mean the answer is a lot of stuff works really well. I think I would look for something that works with the I2S, which seems to be the best quality of audio. So RP-2040 will do that. The Espresso will do that. The same D51 will do that. So what do you got there, Todd? So this is the ESP32 TFT Feather hooked up to an I2S DAC and when I plug the cable in later, you'll hear the boops as the balls hit the edges of the screen. But yeah, it runs great while driving the screen. Yeah, we should talk more about like how how you best make that work together because I know you've had some trouble with display and with audio at the same time. So the thing is that it's awesome that it works on RP-2040 which is sort of the lowest class like to me it's sort of the lowest class chip for CircuitPython currently. The SAMD-21 is pretty much which is on the Circuit Playground Express and stuff in the original QDPy. To me that's a little bit too low of a minimum platform for CircuitPython these days because there's not much room for loading extra libraries and stuff. But the RP-2040 has more RAM, has more flash and even though it's almost the same class of chip as the SAMD-21 it's got some tricks up its sleeve to make it so it seems a lot faster and the fact that we can do the synth stuff on it like 12 voice polyphonic synth stuff with filtering and also drive the display you know with asterisks and also retouch inputs and also drive MIDI, receive MIDI like and doing USB to your computer while you're editing the file. It's amazing to do all this stuff at once honestly. It's like on a little four dollar microcontroller. It's like come on man. Come on. Yeah, I'll add to that since the QDPy RP-2040 is a really nice cheap one to work with. We also have the little Oh yes. i2s amplifier BFF now so you can plug those little speakers or get the little PicoBlade cable and kind of plug any speaker you want that's of the right size and impedance but that's just you know less than 15 bucks probably right there and is so tiny it's really amazing to start with something like that as your synth I even with a speaker and cable you're still under 20. Yeah. Yeah, so I was sent off today Yeah. So it's a high day. It's an extra circuit pie. Yeah. CIRCDAY CIRCPY DAY Oh yeah right I got to write this down. So speaking of the ESP32 chips this is a question I think for Todd I was looking at a lot of the sample code that you've posted you use audio PWMIO and a lot of the code which is available on the RP2040 but not the ESP32 family of chips is there an advantage to using audio PWMIO? Only that it's very very simple like here here's the entire get started with SynthIO circuit that I use all the time and it is a Raspberry Pi Pico and a little oops a little spark fun breakout board for the eighth inch jack to your speakers and then a resistor and a capacitor and a couple of wires and you know that's kind of cheap and super super repeatable so if you ever want to do it do it like multiple times which is what I often do and that is great you get 10-bit quality audio I think that's what the PWM is at and you can run the RP2040 at about a sample rate of around 30 kilohertz which is not CD quality but it's still pretty good but the advantage of going to something like an I2S where's the other one I had I can't find it with a this is an ESP32 oh that's right this is this one ESP32 with I2S is that now you're in stereo the other one was in mono this can go up to 44 kilohertz at 16-bit so it's higher quality like it's actual CD quality in theory and I think the ESP32 can do 44 kilohertz SynthIO I've not tried it yet though I'm kind of a lo-fi guy so but you know these things are pretty cheap also on Amazon and so all it requires is three wires instead of one and you get stereo so yeah so my current sort of suggestion of people are into this is that well if you already got a Pi Gamer or a Pi Badge just use that because that's got all the audio stuff hooked up for you or a Neo Trellis that also has an audio circuit in it otherwise you probably have a Pico line around so just hook this up real quick I mean granted this all plugs into a like the audio comes out of this blue this bluetooth speaker pro tip I get all my speakers all my bluetooth speakers to be blue so I can always think of bluetooth blue yeah Hey Todd what's the purpose of the resistor in the capacitor in that small circuit so the clever trick in microcontrollers is how do you get an analog value out of a digital circuit and this goes all the way back to Arduino since the very beginning before and so when you do analog write in Arduino or if you do a similar thing in circuit python and you say oh I want an analog write you know half the value it's not actually sending an analog value out on most chips it sends this PWM value which is a high low high low but the proportion of what is high is the analog value and so if it's high 90% of the time and low 10% of the time then it's like 90% of whatever your voltage range is but how do you convert that digital signal to an analog signal if you use a resistor capacitor you create a very simple low pass filter which essentially smooths out that PWM and turns it into an analog signal and it works really well it's most of how we do things with analog to do analog out the alternation between high and low is like at many times the maximum frequency that humans hear so I don't know what the specific number is but it might be 10 or something in that range I think it might be like even 100 kHz on the RP2040 a lot of times these PWM filters have to be kind of clever because they need to be good enough to filter out the PWM frequency but low enough to filter out the PWM frequency but high enough that it doesn't filter out the audio we want to hear and that's usually pretty hard because the PWM frequency is kind of on the verge of human hearing but I think on the RP2040 it's like 10 times higher so you just have to pick the correct two values and if you were like at EE you could figure it out from scratch otherwise you'd just follow Todd's just use the cookbook and the nice thing is that the input circuits of most bluetooth speakers also have a filter in it for this kind of stuff for different reasons for noise rejection and stuff but it also acts as a bit of a low pass filter to help filter out the PWM so you don't have to be that good with your filtering because there's another problem with converting microcontroller PWM to audio is audio is centered around zero volts where it goes above and below the zero volt line all the voltages coming out of microcontroller are between zero and say three volts and so you got this offset of one and a half volts or so and how do you deal with that? It's like we deal with that with another capacitor and I leave that out of most of my circuits because most of my audio inputs have definitionally this audio, this inline capacitor that filters out the DC offset it's called Interesting One resistor, one capacitor and a 0.1 microfarad you're done Good to know Todd or JP could you potentially share one of your screens and walk us through how you would set up a synthio in circuit python how do you instantiate some of the synthio objects? I can do that, I've got a screen I've got a screen ready here well except my keyboard is dead here we go can you hold please? Live demo gremlins sorry I'm not a very regular presenter of things ok let's see there we go can I make this bigger somehow big alright so here's a really simple I will show you what this sounds like right now so you can get an idea of what the end goal is and it's this also need audio so hopefully soon there we go this is all it's doing just that bit of stuff and so what is this so first we have the standard imports in python that you do to get the objects you want to deal with and the very first stage is you want to instantiate some sort of audio output and different circuit python devices support different types of audio outputs one of the ones that works on the actually the RP2040 has I think the most support of the different kinds of audio outputs and PWM audio out is one of the easiest ones because it only uses one pin and so that's what we're using here and now you got an audio output and at this point you can say play away file through that audio output which is the things we all did before to do audio stuff in circuit python but now we can create a synth IO synthesizer and you have to give a sample rate the default sample rate I think is 8000 which is like pretty low 22 to 33,000 sorry 30,000 and now you got a synthesizer object and then you just hook it up to the audio output by doing audio.play and at this point your synth is ready to go you can start playing notes with a synth.press event and you can give it either a midi note number or you can give it a note object in this example we're just doing midi note numbers because they're really simple I like to have the more sort of slow envelope on most of my synths so what this does is it creates a synth IO envelope and gives it all the different parameters and so this is sort of expanding on the idea that JP showed about the little envelope that would control the volume of the note over time and so what this says is that in 0.2 seconds the note volume will rise up to the attack level which is 0.9 so like almost full volume and then at that point it will then start to decay down to sustain level in 0.3 seconds so it does this sort of like wow and then it will hold at that sustain level for as long as you keep holding the note and then once you release the note then it will fade to off and it will take 0.9 seconds in release time and so this this synth IO envelope is like the standard ADSR envelope you might have seen in any other synthesizers there's usually like four little sliders on a synthesizer for ADSR and that's pretty much what exactly we have here and at this point where we've got our synthesizer all set up we attach that envelope to the synth we get also if we're using note objects we get attached the envelope to each individual note which would allow us to have different notes have different envelopes which could be really useful if you're doing say velocity sensitive note playing where if you press the note really hard it will play a sharper or it will play louder or something and so I've created two little functions here they just do the press and release we could do something more here like maybe we're doing also sending out MIDI as well as making audio and then the while loop is just pressing those notes with a little with a little random song that plays and so the result is you can hear that envelope kind of rising and falling so that's the real basic 30 line synthio program pretty easy to get started on a say it does look like it is fairly easy to get started and the other nice thing about this is this is standard circuit python there's nothing odd about this in terms of how you import instantiate and set up any other circuit python program which gives people the benefit not only of the ease of using circuit python but if you already know circuit python this is going to look very similar to you and it will make it much easier to jump into learning about synthio this is trying to also figure out a very different setup when in fact it is very the same yeah and it's so great because with the exception of this one line that has a board specific call out to which pin do I want to use to use this audio everything else of this piece of code will work on all circuit python devices that have synthio you just have to say what pin you want to use or which particular audio output style like the US DAC or some other technique and so I've got some files somewhere where I just have a bunch of if statements for like if I'm on a cutie pie do this if I'm on an rp2040 do that for a couple of different wiring setups that I normally have because you can choose a bunch of different wires you're not usually fixed to one particular set of pins for a bunch of this stuff and yeah so it's amazing that we can have this one piece that is great Todd you've been maintaining a synthio tips and tricks list as well on github and as I was preparing for this I was going through it and one of the things that you called out is you can control a waveform in real time with synthio and you had an exclamation point after that like you were really excited about that why is that cool alright so this is one of these choices that that jebler made that I was so tickled and surprised that this was even possible so in in the I don't know late 80's early 90's there was this idea of wavetable synthesis of like oh instead of having a filter where you do that wow with a filter what if we instead have a bunch of little waveforms that sort of are a movie of that filter noise and then in our computer controlled synthesizer we play back that little wave movie to emulate what a filter sounds like and so there's a company called waldorf that made the ppg synth and then like later waldorf sorry there's a company called ppg that made the ppg synth and then they later became waldorf that made a similar sort of synth and and it's a way it opens up it opens you up to so many different types of sounds than just standard synthesis where you're doing the sort of let's take a basic waveform like a square wave or triangle wave and then filter it in various ways instead it's like let's take a rich set of waveforms and let's morph through that space of different waves and the type of sounds you can get out of that are just unlike anything you get with normal synthesis and so we kind of got that for free almost as a implementation after effect of how jubbler decided to do do synth I have so it's almost almost like a like a sprite sheet for animations except it's like kind of like with yeah merging cycles like animation cycles together if you've ever seen like how mocap works you end up with like a little cycle that's a walk and a little cycle to run and you can morph between them it's kind of like that like we have these endlessly looping tiny little waves and then you can say but what if we go over to the differently shaped wave and it can be crazy looking you know you can make a wave that looks like Batman and it sounds awesome like his little beard like that's a cool sounding wave so you end up with people online trading these like these collections of weird little waves for wave yeah let me let me let me share a different little page here to show you one of these repositories if you could share my screen so this is this is a site called wave edit online and it's for other synthesis other synthesizers that can load in wave tables and so I've been using some of these and what's really interesting is it it's a little visual representation of the waves look like let me give you an example so this one here called braids 3 this is a this is 64 different little waves and so what you can do in synthio is you can say hey just play this way this is like one wave right here say one but then later you can say okay now play the wave that's 10 over which maybe is this wave but the cool thing is is you can also just sort of play wave 0 then wave 1 then wave 2 then wave 3 and they slowly morph from this sort of squiggly wave to this very smooth sine wave almost thing and so you can get this these really interesting sort of texture as it goes goes like really hype sort of a high sound like and then goes you know just by just by doing index math on a buffer you know and so you have to do all these complicated filter calculations you just do move around in a memory space that you've loaded off of a off of the disc and so that's what I've been playing with a lot lately with synthio is that oh I can do all these crazy sounds from the all this huge repository of all these crazy waveforms and I have to do very little work to actually do that and like synthio has to do very little work because all it's doing is keep playing the buffer that you tell it to tell us to play and so you just got to keep feeding it different little buffers every so often and am I right that in synthio the the definition of the shape of the wave that you're playing can be you know like a sine wave that's mathematically formulated or it can be essentially a lookup table which is what these end up being right a lookup table of wave points over time am I right you actually jump to probably speak to this better than I can it's always just a buffer of memory there's some modest cap of how many elements it can be I think maybe it's 1024 and you can use like microlab to populate that with a sine wave or whatever mathematical function you want or you can create a very simple square wave just with one of them that has two numbers the smallest number and the most positive number and that's a square wave and then you can do any kind of math you want so like Todd bought your favorite function I think is Lerp and you discovered that Lerp can work on these buffers and you can say I want 50% of this sound and 50% of this sound or 25% and 75% and so it's a whole different way to to choose the timbre of the sound that you're playing you can fill the buffer with just noise just random numbers and that is like a starting point for doing percussion which I think Mark Gambler did some of and I'm not sure where that's gone but ask Mark over in the discord chat about that I think he might be around so yeah there's these really cool drum sounds you can make with synthio and unlike playing back drum samples which is what I've done before with circuit python these drum synthesis bits are fully parameterized so you can like oh I like this drum sound but it should have a bit higher pitch because normally like drums kind of go boo they kind of like started a high pitch and then go down maybe I want it to go slower as the pitch decay like boo boo and you can do that you can just change a couple parameters and or if you want oh the snare drum goes kss kss but I want that kss to be like bassier you can you know do a little filter of the noise beforehand or just in real time with the filter controls and synthio and now it goes kss kss and so it's cool that we can do sort of real time drum modulation not just making you know bloops and boops there's synthy sounding drums instead of real sounding drums but I think that's what a lot of us here are looking for yeah you can play back samples and they'll be exactly drum like but these can get much more creative but also the cool thing is because thank you Jeppler for the data fruit wave library because now it's very easy to load up a wave file as a buffer and then you can feed a section of that buffer to synthio as a waveform and then you can move that buffer along and send it to synthio and now you're doing something called granular synthesis where you sort of you take an original wave file that's playing a sound like maybe it's just you talking and you're taking little chunks of it using that as an oscillator so you can't really play back the wave that's not really how synthio works but you can make it sort of sounds like you are a little bit if you scan through the wave as just a buffer and keep feeding that new little copy of the buffer to synthio you can make and change the pitch of a sound without adjusting speed or vice versa you can change the speed without adjusting the pitch it doesn't sound perfect but it sounds really cool because you can get a sense of me saying the khh word for like a millisecond and turn that into an oscillator for a synthesizer how does circuit python synthio compare to other synth APIs that are out there anyone? well somebody who's used more than one should answer I guess we're all looking at you Todd I can talk briefly and then go to Todd for the real story but what exists out there that I've played with I think I've used the most and I think most people have used the most as in more projects than the other is the Teen C Audio Library for Arduino written by PJRC it's kind of two things so one is it's an audio library that does synthesis of many kinds we've forwarded it to the M4 initially to do Neotrelis M4 but I think you can run on other M4 boards now so that library is very fully featured and the I think not only does it do things well but it's also very user friendly because of the second piece of it which is a graphical user interface for designing the patch so if you look at this thing that I printed out here that's something that you can build in the audio library's graphical interface and you can say oh I want to plug this into that into that but I want three different modulation sources adjusting this but I'm going to do it visually with a little flow graph which is great and then please spit out a few chunks of code that I'll go and dump over in Arduino so I say that because I would love to see if anyone is interested in tackling that sort of a GUI this sort of approachable input into Synth.io also like make code I've used make code a lot on the show something where you have a GUI because we know the pieces and parts we kind of know which connections we likely want to use and then we can go and noodle around with some specifics over in the code but I think there's something to have having even more artists and makers and creators who think they want to build this thing they have an idea for but don't think of themselves as a DSP coder synthesizer coder maybe they don't even think of themselves as a coder so I feel like the anyway that's an API that exists that's very fully featured and part two of it is that it's super approachable for that reason of the GUI and it looked only at like the C Arduino code aspect of that and felt really intimidated and it sounds like when you get into using the GUI that helps with the intimidation factor of the of that library agreed yeah the both the teensie audio library and mazzi and daisy have this almost modular sort of setup where you have these objects that you essentially hook up attach cable objects between them to wire up the synthesizer and so there's no set flow the way there is in the note objects of synthio you have to wire it all up yourself and then you have to make the decision of like well do I wire up six of these or ten of these just like in JP's modular synth it's like you have to wire up all those things and then you have to worry about assigning notes incoming note events to those signal flows and do that resource management and so it's much more powerful but it's also it puts a lot more effort on you the writer of things to get it all set up correctly and just to get a noise out it's like a much more longer involved process I think some of that comes back to the origin of the code that I started with as a MIDI synthesizer that its source was MIDI notes and this mapping of the resources to the MIDI file where you have press and release events was really a core aspect of it that I kept rather than discarding and I think that's one of the main distinctions if people are coming to this new and they might have experience with some of these other things is all these other things they almost think of them more as a audio processing system that happens to be able to generate synthesis stuff and so it's like oh there's like audio that comes in and audio that flows out and maybe there's control is maybe changing the pitch of oscillators or something and so people might make guitar effects pedals with teensie audio library or with daisy yeah that's not really possible within the design of synthio exactly synthio the input is essentially note events and the output is audio and so if you want to do you know a guitar effects pedal circuit python it's like we're not there yet like synthio is not in that sort of mind that's that sort of set of that architecture I mentioned Todd's tips and tricks which is linked to in the live broadcast chat channel if anyone wants to check it out but when I was getting back into music a few months ago the MIDI for Makers learn guide became an essential learn guide can we expect a synthio learn guide in the near future yes Jeff put the learn guide he started the learn guide the bare bones they put the framework up and I'm going to be working on that it's actually the next guide I'm working on is filling out the hey here's the fundamentals of synthio with liberal thievery from Todd's synthio examples I keep calling it your synthio cookbook I don't know if that's what you call it but much like the circuit python tips and tricks that Todd has on his github that I refer to seven or eight times a day that's where I'll be grabbing a lot of examples but my plan is to have a guide that will help people when they're first getting into this all the way through to when they're trying to figure out some more advanced stuff particularly from code examples well that's great to hear I'd like to remind the audience too that we will have some time to take your questions if you want to drop them in the live broadcast chat channel on the adafruitdiscord at adafruit.it slash discord when you do your projects on synthio make sure that you put those on the social media tag it with circuit python submit it to the newsletter because we want to see the cool stuff that you're doing because that's really a thing that energizes me I'd make this stuff for you all to make awesome stuff out of yeah I learned so much by seeing other people's code just in general but especially with the synth stuff like I forget if it was you or gambler started using numpy to create some of the initial waveforms like let's make a sawtooth wave with numpy and I was like what cause I didn't really know numpy at all cause I'm not a normal python person and I was like what's numpy how are you using it to make synthesizer stuff turns out it's a really good tool for that so we started to chat about this but I wanted to actually ask the question too one of circuit pythons goals is to be easy to use what role can synthio play in maybe bringing people to circuit python or teaching pythonistas how to use synths what do you see in the future for synthio I can speak to that just being on the education side of things this is an amazing opportunity because there are there's a huge community obviously of synth folks and I don't know the extent to which like percentage wise people consider themselves to be programmers but there's obviously going to be a part of it where those folks don't consider themselves programmers and for me when I started like I tried to learn python just as base python and couldn't but making an LED blink was like the thing that hooked me you know and that was like I made that happen and that was I was suddenly I want to learn all this stuff and for someone who's super into synth stuff to be able to pick up a pygamer for example where there's not any soldering necessary which I mean since folks solder as well but like you don't have to do much to it to make it work and then you would be able to take this code and with not very many lines of code and also examples available already punch it in there and have a synth and now the angle that you're coming from with it is different from a programming standpoint which is to say you as a synth person you know what those sounds are you know what they mean and you know how they should be created and so you can then look at that code and say oh this is acting as the LFO this is acting as the original waveform and it applies it all in a very different way but it's still incredibly approachable because of the fact that you're you've already learned what the synth stuff sounds like and you've already learned how it's built and now this is just a new way to build it and so for folks that are interested in getting into programming this is a huge you know who are already in the synth stuff is a huge opportunity and then in general it's a huge opportunity for folks that want to get into synth stuff or programming which like I'm super new to all of this in terms of synth stuff programming not so much but I after an hour and a half long conversation I thought about synth basics and there's a application for iPad called Centorial where they kind of walk you through like different sounds and like you're supposed to by the end of each thing be able to like actually hear the sound and know what is happening to it I did one lesson so far and then when I loaded one of the demo examples onto this new hardware that Todd sent me I actually recognized that there were differences in the sound and had a vague idea of why and so that's maybe two hours of my time ahead of time to learn anything about synthesizers and then already CircuitPython has put me in a position where I'm able to say oh okay I can't see that obviously that waveform is being you know modulated or it's being modified in some way and like I can turn that knob and go okay I think it's this and then check the code and say oh I'm right or wrong but it's huge it's huge for that because CircuitPython is so approachable and SynthIO you can do very you can do synth stuff with not a lot of code which makes SynthIO approachable so conceptually whether or not you are new to programming new to synths or new to both you're still in a great place to use this as your hook you know I mean LEDs obviously this SynthIO wasn't around at the time but LEDs were my hook and that's a huge thing when people find that one thing that is the big aha moment synth stuff for a lot of people could be that aha moment it certainly would have been for me if that had been around when I started because I definitely was into making music and annoying noises to me count so yeah I would definitely say that this created a great situation for that whole group of people if I can have one thing to that too is the the ability for people to get into programming in CircuitPython with pretty low overhead like no IDE or compile or tool chain largely if you can get a USB to drive to show up use a text editor you can code on it and with a lot of these boards that have StemAQT connectors you can also add hardware like as an example I have here of one of our little mechanical keyboard for button things that again has a little StemAQT and seesaw connector so that plug into that little QTpy I showed earlier and suddenly someone can make controls knobs or this or displays like Todd has which are really easy wins early on to go like I'm building this machine and it does what I want and I haven't actually had to breadboard it I haven't had to solder it it's actually just kind of plug and play which I think for certain people these people like me get really excited once you start adding in some inputs to it and you're making cool sounding sounds exactly and that's the other side of it is the hardware side of it and the fact that we provide examples for everything it puts you in a position to now learn more programming because combining two things is actually really huge and that's also a very easy win to get in the beginning is to actually write your own code because not you're not just taking an existing example you now have taken an added to it and you've improved on it and now it's your example and now you wrote that and that's a really big deal yeah I like the idea of adding sensors to music projects I want to maybe create some environmental sounds so you know back to the idea of the personal area wind chimes they're not really wind chimes but they're using the accelerometer you know is there a reason to use I don't know totally randomly a humidity sensor to change the kind of ambient music you hear so if it's if it's raining out if it's a steamy day out you get one kind of sound and if it's dry you get another kind of sound I don't know but somebody out there should take this and do it a light sensor all of these things coming in to create an ambient soundscape those are projects that I think are really interesting one thing I haven't just riffing on that I haven't seen anyone do yet is using Adafruit IO which is a pretty quick and easy way to hook data coming in so if you've got Adafruit IO pointed into your synthio project you can build those kinds of things I think yeah including you can set stuff up where other folks can control your thing I did it with LEDs at Pycon this year your lights but for synthio yeah basically and so instead of just controlling the lights which is what was going on with my little project you could have other folks send in a MIDI note for example and then it plays a chord that includes that note or based on that note or just plays a note or whatever and you can kind of make it interactive like worldwide as well it's a great segue into my last question for each of you what projects are you excited to do with synthio next do you all have something in the back of your head that you want to work on I guess I'll start let's go ahead my first synth is yeah I it's now going to be my second synth thanks to Todd who was kind enough to send me a synth slash audio care package thank you again for that but I want to build I want to build my first synth and it's funny that John mentioned the stem of connectors the plan is to make a whole thing stem of QT friendly and just sort of attach some knobs some a little display and a speaker possibly a battery so I can take it with me places and just do something where I can make noises like that's basically like where I want to start and so I'm actually super excited about this project that I will be that I'll be able to do so Todd what about you I know you have the QT pie synth that you designed and I think are selling on your Tindy store oh yeah let me do a real quick camera swap so you can see it I was going to say I have it pulled up if you want me to pull it up hold on and see if this works oh it's upside down though hold on a sec of course the frame rate is killing me but so yeah so this is a little synthesizer that hopefully you can hear and and this is demoing the wavetable stuff so that knob is changing which waveform it's using which which waveform yeah so let me go to different waves this is the braids and of course you can use an LFO to do that knob change for you I understand that that also has a MIDI connection so you can actually plug a MIDI keyboard controller and of course USB it's currently running off a little USB battery but yeah so using the Tindy store they're without this and without the QT pie but but yeah add a QT pie, add a display and you too can make annoying noises in circuit python it's so much fun do not understate the amount of fun that this little board is I was so excited when I got audio stuff going on it was just I don't have my headphones on but they're still hooked up and it's still sitting on my desk and I don't know every 20 minutes or so I'm like well I think Scott actually beat me to this one but with the USB host feather you could plug in a USB MIDI keyboard and then have circuit python be the synth of it and then like that becomes similar using the actual MIDI cable because the circuit python device can power the keyboard as well creating a little portable synth without much wiring I tried that out and it didn't work for me for some reason and Scott tried it and it works for him so great job Scott now I just need the code to work for me but he did a little demo that he showed on a private chat just yesterday the USB host and the MIDI on top of that is a Stanley complex I'm surprised we can do USB host at all in a microcontroller so it's one of the things I want to try is so we've got all these like the fact that circuit python works on ESP32 so well means that we can start to implement hopefully OSC which is sort of a open sound control it's sort of a wireless MIDI in a way that goes over UDP and so that way we can make truly wireless little gizmos that just sit somewhere and are part of a little wireless orchestra with no visible connections between any of them so yeah so that'll have to research like what's the state of an OSC library for circuit python does it exist it's not very hard to implement in UDP I think does circuit python support multicast UDP maybe I don't know can I throw a camera on here Paul is that alright? Absolutely oops ah we both did it alright I got it so this was one I this is the prototype of a synth that I had done which was exactly what Todd was talking about before QT Pi and RC filter and a little headphone out this is also got these capacitive touch wires on it so that's what is actually the guts inside of this synth I built which was the Tyrell building from Blade Runner as a synthesizer I'll turn it up for a second so this was based on some code one second hear this sounds so good is that your code Todd or based on your code? yeah so that's based on Todd's dystopian dystopian 80s synth thing so it's got like 5 detuned oscillators playing notes at once and then kind of stepping through a little random note set so that that exists as a guide if you want to check it out that was really fun and that's kind of the reason I show this when you ask what I want to build next is I'm really excited about the prospect of building small unexpected synthesizers that no one in the world is going to make this or sell this but if you have an idea for some strange major doll that's a synthesizer those kinds of things are possible the one that I have planned a couple projects out from here is to do that sort of thing as a minimum viable MIDI synthesizer this has been done a few times before where people have built the synthesizer into the actual plug of a MIDI cable I've seen that project or one of those projects yeah and so I want to do something along those lines where it's basically the size of like a C cell battery and it plugs right into a MIDI keyboard to get its notes and then it just has an audio out jack on it and contained within this tiny little object is probably a cutie pie and a similar RC filter or stereo out but to basically go up to any MIDI because there's thousands and thousands even just here in my garage there's like so many MIDI synthesizers that just have that DIN5 plug on them if you could slug that into there and have a synth with no other outboard gear I think it would be a lot of fun so that's a future project I'm interested in. Very cool. Did it again. We're in sync. Well with that I'll wrap it up thank you to everyone who tuned into today's panel discussion and a special thank you to our panelist Jeff, JP, Katnien, Todd. I hope you learned something about synthio and circuit python and stay tuned next for a circuit python day game jam with FOMI guy coming up at 12.30pm eastern. Bye everyone thank you. Thanks Paul. Bye.