 It's me, John Park, and we are in my workshop. Thanks, everyone, for coming. It's time for the show, for John Park's workshop here on Thursday on Adafruit channels everywhere. Thanks for joining us over in the chats, checking out our YouTube chat, and we've got a bunch of people over in there. Hi, S. Kelvin Govindur, nice to see you. Dave Odessa, Lord Helix, Johnny Bergdahl. Welcome one and all. Lord Helix, dig in the music. Thank you, absolutely. And over in our Discord, if you're somewhere else and you're wondering where the chat is, like Twitch or somewhere like that, Facebook, you can come over to our Discord by heading to adafruit.it, adafruit.it, just to take the word adafruit, but put a dot, I guess we're Italian, and discord slash discord, adafruit.it slash discord. That will give you an instant invite. Click that link. Hop open Discord or a Discord-like webpage and you can jump onto the server and look for the live broadcast chat channel, that's it right there, and hang out. And we've got a whole bunch of channels. I cut them off on the side there, I cropped that, but there's a whole bunch of channels such as our general chat, live broadcast chat, which is this one right here, it's a pet photos channel. There are channels for help with CircuitPython, Arduino, adafruit.io, 3D printing, audio, Git, hardware design, Linux, single board computers, make code, projects, radio, robotics, wearables, and help with community, as well as the topics for CircuitPython development and more and more and more. So jump on over there, Mondo five, let's go. Okay, we're going, here we are. We've got some fun stuff to do together today, I think. I'm excited about it. I've got a coupon code for you that'll let you get 10% off in the store if you want to buy stuff and it's good until midnight tonight, I think roughly thereabouts, East Coast United States of America time. And I'll hand that code off to you in a second. What else do we have? I'll do a little wrap up of my product pick of the week this week, a couple of new cool little products. I've got a CircuitPython parsec for you that I'm very excited about. I kept sticking more and more features in it, but the central one is really simple. It's just the dressing and the icing and the things that got really fun and exciting. I worked on that most of the morning, in fact. I just couldn't stop adding fun features. And yet there's more I want to do with it. So yeah, not to hype it up too much, but that'll be a fun CircuitPython parsec, I think. And then I've got the melding of worlds. I've been working on this computer perfection project over here, this thing right here. This is the gutted one, but that's the computer perfection. Get these on eBay for anywhere from $25 to $40 or so shipped. And you can see mine doesn't have the parts in it because we're doing stuff with those. And I was working on the button code to use the original PCB, the original buttons from that and switches. And meld those into the SynthIO work that Jepler has been working on in the Metro M7 to get real synthesis happening, polyphonic synthesis happening right on the microcontroller in CircuitPython. My demo today, until we start poking around with it and maybe we'll do some coding, is actually just one note at a time. But it can do, I've done 12 notes at a time, which is really cool, really impressive. Lars is back there playing Frogger, I guess. And that'll be the stuff, the show. And of course, I'm always checking out the chat so let me know if you've got questions or thoughts, suggestions. And always looking for concepts and ideas to do, especially for the CircuitPython Parsec, but also projects. Let's see, do I have, oh, I'll do a little update. I was working on this guy last week, making a controller based on Robert Smith. Is it Robert Dale Smith? Sorry, I'm forgetting the middle name now. I'm gonna look that up, in fact. Robert Dale Smith, right? Right? Yes, Robert Dale Smith. Robert's gonna do a learn guide for us on this and he's got some cool tricks up his sleeve to share, but this is the conversion of a kid's toy controller into a proper USB-C game controller for Switch for direct input, which is modern computers as well as PS3, as well as a, what is it, X input? I can't remember, there's a sort of older controller type as well that works mostly, I think, on Windows. I've built a couple of these and I also, beyond the one from last week, I added a little button for killing the speaker, but I think we're gonna, let's talk a little more and I think we're gonna see if we can reuse one of the built-in slide switches to do some audio stuff, so that you don't have to cut into the case. So look for that, look forward to that. And I have some other controller ideas, some other possibly Bluetooth controller, as well as possibly a little retro gaming handheld, so some ideas in there coming up. All right, so much promised, we've got a coupon code. That's it right there, synth stuffing. That's your coupon code. Use that coupon code on the way out when you head on over to the store. There's the store, go to Adafruit.com, you'll be at the store, you can check out products, just click on the products link there and use a little link there for view all new products, view all featured products, as well as a bunch of categories. There's some new stuff in the store. Maybe pick up some floppy drive costumes, these are adorable, I haven't had any yet, but I want some, they're little stickers for your full-size SD cards that will make them look like floppy disks, adorable. As well as, this is exciting here, I ordered a couple of these, the Adafruit Feather RP2040 with USB type A host, which will allow you, I believe this is gonna be an Arduino probably only for the foreseeable futures because of the nature of how it's being done on a PIO to bit-bang USB host, but it will allow us to do some cool stuff, particularly plugging in USB devices that you can host such as MIDI controllers and probably mice, maybe keyboards, and then filter that and do things and massage that data and then send it out over, you aren't over serial through USB back to your computer after having done some stuff, so that's a cool one. 1750, use your coupon code SynthStuffing and you'll get 10% off on that. And if my math is correct, that'll be $1.75 less. I won't attempt the subtraction math necessary to tell you how much that'll be, but you can do that and you can use this coupon code, where'd it go, SynthStuffing. SynthStuffing, by the way, was one of the proposed names for this topic that Phil Turone, PT, had for cramming modern synthesizers or modern electronics into very cool retro futuristic 1970s and 80s consumer electronics toy shells and things like that. By the way, while I'm on the topic of this, I'll remind you again later about that coupon code, but while I'm on the topic of this, I had to show you this is a look familiar. That is the toy right there, the computer perfection, being used in an episode of Buck Rogers and I don't know if it's a 25th century bedpan or Ashtray or if it's his doctor. I actually don't know, if I saw this episode, I don't remember it. I probably saw this episode. I watched all these when I was a kid, but there's Buck Rogers. There's also a film, Ice Pirates, that made use of this gorgeous piece of design here. So look it up, look up the computer perfection. Just put that in quotes and you'll find all you want to find. All right, so let's see. The next thing I'll do is I'll mention I have a show on Tuesdays. That's it right there, JP's product pick of the week. And on that, I like to grab something from the store, maybe something new, cut the price in half with the help of the highly excellent new products team. Thank you everyone for doing that every week. We stash some in advance and then we deploy them when the show starts. So if you ever wondering by the way, if you figure out what the product is gonna be because you're watching the YouTube thumbnail or something like that or the name I think on the YouTube. And then it looks like it's not in stock. That's probably because the stock has entirely gone into stashage storage for deploying right when the show starts and then we cut that price usually in half if it's a native fruit product, sometimes less if it's something from a outside seller that we don't have those kind of margins on. But no coupon code necessary on that one. You just throw it in your cart and off you go. You get them at a deep discount. And I like to do some little demos with them, show you some code maybe, show you how they work this week. It was these two AT Tiny breakout boards that I am very fond of. And here is a little one minute recap. It is the AT Tiny 816 and the AT Tiny 616 breakout boards with Seesaw. I can program this AT Tiny just like it's a baby Arduino. I've simply coded something that is reading button presses on this little step switch and is writing out to that LED. I've got a QT Pi and it's plugged in using the STEM at QT cable to my AT Tiny 1616. I am running these seven potentiometers into seven of the ADC pins on the AT Tiny. So that's able to read all of those analog values and then report them back to my QT Pi. All I'm doing is adjusting values and showing them on this display here. You could use these up to nine of these analog inputs for anything you want on your project. The AT Tiny 816 and 1616 Seesaw breakout boards. 1616, that's the most awkward number I've ever said. But there it is. Go if you didn't get them during the show, I think we still have some in stock and you can use the synth stuff and coupon code on those. You won't get 50% off, but you will get 10% off. That's not nothing. I think they're $5 normal. Let's get 50 cents off again, me with my math. All right, so next up, the much hyped circuit Python parsec. Let's prepare ourselves emotionally. Here we go. Yes, circuit parsec. All right. Here we go. For the circuit Python parsec today, I wanted to show you how you can use a UDRAW peripheral with the WeChuck library. So you're familiar with the WeChuck, the little nunchuck for We. There is a community bundle library called WeChuck and it supports a whole lot more than just the nunchuck, including this drawing tablet. You can see here it comes with a wired pen. It has pressure sensitivity, a couple of buttons you can press. The tip is also a button besides being pressure sensitive and we can record the XY positioning of this as we press this down. Now, you can see at first what I'm doing here is I just have a little OLED display on the left here and I'm tracking a little dot there as I draw. But now check what happens when I press the button here, I can draw some neopixels here and I can change their color. So you can see what I'm doing is I'm mapping the X axis to which neopixel I'm lighting and the Y axis is the color. Do a little gradient there by going in a diagonal and I'm even doing pressure sensitivity for brightness. So I can press on that and change the brightness as I go. The way I'm doing this, if you look in the code window here is first of all, import from we chuck dot you draw, import you draw, that's this specific peripheral here. And then I'm setting up the controller as you draw on the STEMMQT I squared C port of the board. So it's plugged in over STEMMQT using one of our little we chuck adapters. And then the key thing that's happening in the main loop is I cast these variables, position buttons and pressure to be the controller dot values. Then I go and use those to extract the position X and remap that the position Y and remap that both to a position for my OLED as well as the position and color of my neopixels. And then I'm also reading buttons. So if a button gets pressed, it's true. So if the button is C, that's C is true. That's when I'm changing the color of my neopixels here. And if I press the Z button, I'm just turning them off. So that is how you can use the you draw class inside of the we chuck library from the community bundle inside of circuit Python. And that is your circuit Python Parsec. Whoa, whoa, whoa, whoa, whoa, whoa, whoa, whoa, whoa, whoa. That's circuit Python. Look at that, look at that. How cool is that? This is a kind of a just fun, let me lower the brightness a little there. This is kind of a just a fun toy for playing around with. It doesn't do anything in particular other than hey, I'm having fun. But you can imagine that you could use this for a fairly low resolution drawing. It doesn't have a ton of resolution. I think the range is about, I don't know, 1,200 or something in one axis and 900 in the other, something like that. So it's not super high res for drawing, but you could definitely use this for things like a kind of like a version of a chaos a later for adjusting a couple of synthesizer values for say reverb and delay or a filter. Those are typical uses for this kind of pad for non drawing stuff. You could use it as a mouse if you, especially if you had a smaller display like a 800 by 600 display for some reason. This would work pretty well. And I think it's just fun. Let me, let me show you here. This is the connections involved since I didn't show those before. You can see the key here is that all of these Nintendo peripherals for the Wii use I square C with this standardized connector. And that plugs right into our little WeChuck adapter board here over STEMIQT. And then I also got my little display added on there as well. But once you get that hooked up, you can use anything from the guitar to the controller, little classic controller to the, I believe the turntable. I haven't tried the DJ turntable on this in a long time, but I'm looking forward to trying that out. Guitars, I think any of the instruments that were available for rock band should work. Anyone have any drums? I got rid of mine, sadly. So that's the super, super fun UDRAW tablet. I think I might even have the game cartridge somewhere, but I don't think it was all that much fun, not as fun as this. This is just the best. All right. So that, that'll do it from our standpoint of our circuit Python parsec. And just heading over the chat. Oh, I was looking in the YouTube chat actually. CreativeEye says, hey JP, watching from Kenya Africa. I'm a big fan of your channel. Oh, thank you so much. We're glad to have you in the chat here today with us. Appreciate you stopping by. All right, let's see. What is this device? What is this device you're showing? Handicalla Way, what do you have there? Looks like it's a piece of industrial equipment that shows up in movies as a prop a lot of the time. There's a Reddit for that, subreddit for that. It's called, I think it's called something like that's a book light. I think that's what it is. That's a book light. And it's a Reddit for people who spot really common everyday things that have been used as sci-fi or high tech props in a TV show or a movie. A lot of fun. Yeah, oh, there's a whole YouTube video about it. Okay, I gotta check it out. It's great. What is the thing? Is it a lathe? What is that? Some kind of motor? Part of a generator? I don't know what it is. All right, so let's see, that brings us to working on our project here today. So, I'm gonna, let me jump over to the workbench here. And I'll show you where things are at, how things are getting connected together for this, what some of the goals are with this. So we've got, let me just pull open my Discord here. Hmm, there we go. So, starting off, we've got the computer perfection. And this is the circuit board that lives inside here. And you can see we have a whole bunch of these metal switches, sort of spring steel switches that get pressed by these plastic buttons. And if you flip this up, you can see while they kind of all move, cause they're joined together around the rim, it moves a lot more at this little point here that contacts one of the switches. So that one will go enough just to press that one. So, they do work independently. There is a piezo buzzer here that I'm not using. I left that, I desoldered the wires from that and left that in there. Otherwise, everything just came right out of there. Whoops. And it has a couple of nine volt battery connectors that were part of how it worked. Here's my speaker or piezo connector. And then there's also, I showed this before, there's also a switch built into the side here, which gets contacted when the clamshell is opened. So when this is in its normal position, when the clamshell goes all the way, it closes that switch. So that's actually how you turn it on. I may restore that functionality just cause that's neat and then I wouldn't need a separate power switch. And the way to do that, by the way, if you haven't before, one of the better ways to do that with especially a small switch is by grounding the enable pin on the microcontroller to the, to ground. So the switch just connects the enable pin to ground. That has the effect of turning off the microcontroller. Sorry, I'm just gonna zoom this camera out a little bit cause it was chopping my head off. So for now though, I have this out entirely because I've removed the four bit microcontrollers, Panasonic, Matsushita microcontroller that was there that ran the game. And I've been able to plug in, zoom in here. If you see here, this is a set of stacky header pins with 0.1 spacing. Those are really nice and thin compared to other headers. So they actually work really well for piggybacking on that little socket that the microcontroller went into. So I didn't have to desolder anything. I was able to just pull that microcontroller carefully and then put in a couple of sets of these stacky headers. And then I can put regular jumper cables, these nice deluxe DuPont connector jumper cables into there. So that works really well for being able to test out how I think the wiring should work and then test out how the microcontroller is gonna work with that. Eventually I could do anything from desoldering the socket and soldering wires into it from below because that's where I want all my electronics to be. This needs to be flat on top because it's gonna be sitting right underneath there, these buttons poke or rather these switches poke up through the little holes inside of the top there. Also these are, I forgot about these. Yeah, I'm glad we were looking at this. I forgot there were two more buttons that I haven't used for anything yet that I forgot to account for. These two little pegs, these are sort of extensions for buttons. So there's these 10, but there's actually two more I forgot all about until right now just cause they're kind of hidden the way I normally have this on my desk. I'm looking at these switches and they're blocking the fact that there's actually two more of these switches here. So I gotta add those later. This was my temporary on-off switch after desoldering those wires from the little lid switch there. So that'll be again helpful for testing before I put that all back together just to rewire that. So what I was doing is working with Jepler on the Synth.io library which has existed for a while now. I just had never used it inside of Circuit Python and it allows you to specify MIDI notes which will play synthesis. Originally it was just I believe square waves and now it's been extended to allow you to use single cycle wave forms. So Jepler added in a sine wave. I think there's pulse width modulation of some kind but we haven't dug into that too much yet. Todd Bott has been working on this. He sent me some code that had a nice sawtooth wave which gives you a much richer, grittier sound with a lot more harmonics in it. And so interestingly the way the library was written it expects you to send MIDI notes to it. So it takes in a value like 48 and then the library converts that to the proper frequency tone to play. So I'm not using MIDI but I am when I press these buttons saying okay we're gonna use Synth.io to play a note 60 and that's gonna correspond to a frequency that's a musical note. So on the M7 here I'd worked on just that synth code then on a separate Metro M4 which has the same pin out. I was working on the button code. I've now merged the two together. I also have an I2S amplifier and a nice little enclosed speaker here. And let's see with this thing on what I should get is when I press these it doesn't have to be metal or anything like that. In fact it probably shouldn't be. Let me use a piece of plastic here. When I press these we'll hear a tone and I have it just droning. So I press one it just plays. So part of my idea with this is to make sort of a moody drone synth of some kind. Right now I'm reading two of these switches and one of them allows me to just turn it off so that sends the turn off all notes that are playing. Even though I only have one right now it would turn off all notes that are playing. And I will, my goal is to stack these so that you can play chords up to, you can play up to 12 notes and in fact maybe I'll add those two and we'll get the full 12 note polyphony. I think that's the max that the library in synthio can handle on the M7. And the other thing I can do is flip the left switch here, that's the mode switch on the original there, so that's what it'll poke up out of there. And that'll change the wave type. So right now this is a sine wave and here's a sawtooth wave. And actually right now it's playing two at the same time. Just an artifact of my code. If I press a new note it'll drop the sine out and now it's just sawtooth and then turn them off. So interesting things I found out about this and I was looking at the circuit on the show I think it was last week or the week before. The four bit microcontroller that was in here and the way it was programmed did a whole bunch of interesting stuff without having a whole lot of IO. It does not have enough IO pins to handle all of these buttons, all of these switches and all of the LEDs. You can see there are 10 LEDs on there with just one pin per. It's not quite a matrix but what it did was I think it very rapidly switched pins from being inputs to outputs. So the LEDs are actually on the same pins as the buttons. And I started writing some code to try to do that in circuit Python and it got really messy really quick. So what I may do is concede defeat there and simply cut the traces that are connecting these LEDs and their resistors into the same circuit or same pins as the switches there and instead just I probably can add a little expander, a little PWM expander and handle all 10 of those LEDs really nicely and maybe be able to do some neat stuff with them like fading them instead of just on off. And the same goes for these switches. They're not all independent. They're actually kind of interdependent so that the position of this value will change as this four position switch value changes. So I need to dig into that more to see what the sort of easiest way to get the most use out of these is right now even though these are three position switches I'm using center for on, right for off and left for off on that one. Same with this one. This one's a sine wave in the middle or rather a sine wave on the right, a sawtooth in the middle and nothing on the left. So, and let's see if I, yeah, you can see this center one is also some of its positions are the same as this one here. So it's turning it off. So that's what I have running on this so far. I can't, unfortunately I can't test it inside of the cool enclosure yet, zoom out a little simply because I don't have the clearance to do that with all of that wiring in the way right now but eventually that'll run that much, much lower profile or underneath to get that to fit in there. I did just for a test of it, I had most of it inside of here if I just unplug, let's see, I do, I don't think this'll fit, will it? No, it's not gonna fit up in there but I did have the microcontroller since I didn't have this board on it yesterday I didn't have the microcontroller and the amp and speaker inside of it and it sounds good, it's kinda nice to have the sound emanating out of here. It's possible that using a non-closed speaker that's mounted to the plastic would act as a soundboard and give me a nice effect but these kinda do that by themselves these enclosed speakers and these also seem to run lower current. The enclosed speaker of this one runs a little lower current than this guy here so since I'm running the amp I think off of three volts that's a good thing I have less current to work with. So that's the state of that. I'll show you the code that's running on that. Mouse says over in the chat, if there weren't enough eye-opens they should have just bought a different feather there's plenty to choose from. This was 1979 I think that Ralph Baer made this and I read up some more on Ralph and there's a really great collection of his engineering notebooks, patents, photographs of his workshop photographs of his inventions in the Smithsonian as well as some other places so if you look up Ralph Baer, B-A-E-R the father of video games, created the Magnifox Odyssey really the first home video game system, prolific inventor and seems like a really interesting neat guy so he was doing, he did Simon, a little memory game I think a similar microcontroller is this one but not the same one but I think there were like three games that used the same microcontroller around that time and he worked for a lot of different toy manufacturers so his stuff is all over the place really interesting. So let's see, let me open up the code that's running on there and look at that, it is not this, this is confusing let me unplug that. By the way these Wii accessories unlike the Xbox guitars and PlayStation guitars the Wii ones always used the Wii Mote or rather the, yeah the Wii Mote as the wireless controller so they didn't have to, they were cheap because they didn't have to have, there's so much that this didn't have to have in it it was just the I2C sensor essentially plugged into that using this so they always are inexpensive and lightweight and lack, they always have a nice big space for you to put stuff in fact this one also has a little spot I think where you could just tuck this connector in seems like an unnecessary little box there you'd think there was like a battery or something in there but there's not, there's also by the way a spot for the pen there, kind of a space there. I got that one I think for a dollar at a yard sale or something like that, really cheap. Okay so code here for our computer perfection synth you can see here some of the key things going on I'm importing synth IO library and I'm importing keypad, I don't need random anymore the keypad library I'm setting up kind of two sets of things I've got the buttons and those you can see there on pins D0 through D8 and then A5 and then I have right now two switches and that's a sort of a different keypad object which just makes it easier for me for my code to do the same thing with all the buttons and then a different set of things with all the switches then I have the setup for my I square C or rather I2S amplifier and that's on these pins D9, 10 and 12 I'm setting up the I2S out here for the amplifier and then for the synthesizer I've got a sample size of 128 and your volume I think this goes up to 3600, 3200 so I have this fairly high, it could go higher and obviously you can hear there's a difference between the sine wave and the sawtooth and this is just kind of the nature of having a pure-ish sine wave versus lots of harmonics, square waves and saws they'll always sound louder than like a triangle or particularly a sine so it might be interesting to have that change along with the wave type just to make the relative perceived volume seem the same. Hem asks, the synth aisle looks amazing wonder if it'll work with an M4? I don't think it will, I think this synth stuff requires enough speed that it's really gonna work on the M7 only I don't think you'll have that work on the M4 maybe a RP2040, I think maybe Todd, did you, if you're in the chat Todd I think had some of this working on an RP2040 but I don't think it'll work on an M4 I could be wrong though the thing here is that it's not an Arduino and we did port the PJRC audio library which runs on teensy over to the M4 and that worked but just the overhead of having the interpreted language of circuit Python here gives us less speed to work with even though it's like a 500 megahertz chip on the M7 if I'm not mistaken so then here's our sine wave set up and sawtooth set up and you could create other wave types I've just got these two right now and then I've got the synth object here which is synth equals synth IO, synthesizer and then a sample rate and a wave form being used as the synth sound and then the synth is told to play so it starts playing but it can have notes running or not so it doesn't actually make any sound at first I tell it we're gonna be using a sine wave to begin with and then in my main loop here you can see I have two of these event loops for the keypad library the first one says event is button events get the other one is switch event get and I could probably call this first one button event and to differentiate it from switch event so if there is an event I'm giving the event key number to this variable i just makes the rest of my code sort of neater if the event is that something I pressed then the synth will do this which is release all notes and then press a new note so this is where I think I can start to look at the synth IO library which I know not at all look at that for the how I can do polyphony so one way to do it is to give it a list of notes so I could create a queue of maybe which notes are pressed all at once or just always add to it so we can build up that list because this command actually is expecting a list and you can see here synth IO release all and then press even though I'm pressing let's say the first button which is going to be this midi note 64 it has to be in the form of a list that's what this synth IO command expects so I give it the note list index I which would be zero for the first note but then I also have to put in a comma and make it like a tuple inside of quotes so two sets of quotes and a comma it didn't I didn't have that at first it was I was like why won't this work and then I started adding commas and parentheses until it worked which is my my basic approach to a list like thing is is throwing a type error about not being able to use the use the list object what is the command I wrote it down is yeah type error int object is not iterable so if I just give it an integer it's not happy throw in an extra set of parentheses in a comma it works so I'm printing the note letter press this is just part of debugging for me and then previously I was using this just as a I had a little function that would play midi notes when I was first testing this so that I can get rid of the released doesn't do anything right now so that's just an artifact since I want this to add notes what I think I might do is change these to be toggles so I can press something and it just toggles the state from being oh that note is one of the notes that playing press it a second time and it takes it out I think that'll be nice for just building up these big chords liked mouse's comment in the in the chat here uh parentheses comma parentheses parentheses ha ha parentheses comma parentheses it's appropriate all right the switch event is similar so uses keypad just checks for anything that happens on whatever objects were part of that keypad instance and then if there is an event I'm casting this variable s to be a key number of the switch event if it was pressed which meant it went from off to on if it is switch zero which is the one on the left on the computer perfection then I change the waveform to a sign if it's a one I change the waveform to a sawtooth and then you can see with the other switch all I'm doing right now is just release all so all that all that is likely to change if I start stacking up notes in polyphony there um so if you don't mind hanging around what I for a moment and watching me try something what I'll do is head over to oh here's I think I might have shown this last week but this was a nice museum of design and plastics had some really nice photographs of the computer perfection here closed and open and missing the battery cover like all of them are it seems there's the box my box is a little different so that might have been a uk one or just an earlier iteration of it but that's the that's the box there yeah mine's from lakeside and I wonder if that was distributed by someone else in the uk because that one says gt action gt is that the manufacturer there don't know uh yeah injection molded and manufactured by action gt oh interesting huh so it's for it's it's designed by lakeside games manufactured by action gt and they got their name on it instead of lakeside for this version that's wild um okay so what I wanted to do is try to dig into the synth i o commands so give me one second I'm just going to look for I might have a note from uh Jeff that includes a link and that'll be a fast way for me to get it so one second okay I'm assuming this is updated uh so synth i o from file you can throw a midi track at it and it'll try to play that a dot mid file uh I tried that with a couple of midi files but it didn't like the formatting of it so I've got to play around and find out what formats it likes and that could be another another interesting way to use this is to have each button play some arpeggio or melody or something like that uh synth i o midi track what am I missing here synth i o from file midi track synthesizer blue right past okay create a synthesizer object the apis experimental uh two notes supported the mimics rt 10 and rp 24 platform support up to 12 notes so 60 is the c4 middle c approximately 262 hertz uh you can pick a sample rate and the lower the sample rate the grittier and chip more chiptuny it'll sound but uh we can this I think we have a 128 on here right now which sounds good uh waveform single cycle waveform default is 50 duty cycle square wave um and then it tells you you can you can specify a readable buffer sign 16 bit for these other other single cycle waveforms sample rate uh okay so pressed sequence of currently pressed notes max polyphony press turn some notes on release then press release all then press release all yeah so it seems like there's definitely enough in there to be able to uh build up some some polyphony uh over in the chatlet city said I haven't been able to get it to recognize a midi file either so if you find a trick in your travels please let me know yeah I wish there were one file and and they're binary so you can't really find out that much about it but I would love if there's like one file that the original author of this can point us to that that works or if if Jeff can look at it at the code to see what it's whether it's not loving about the midi tracks um okay so let's try let me try to adjust the code here so um let me bring this up here um okay so I've got release then press turn some notes off and on all right let's just do press I'm just going to build up notes so whatever I press it just adds to it um so what I'll do is take that out of there and this if we press something it'll just be synth press and then let's see if it just takes one in note list I and let's grab this pile of wires here if anyone sees uh mistakes or improvements as I go please speak up over in the chat hey FX music nice to see you sorry I I saw you you popped up earlier over in YouTube nice to nice to have you here um so let's do a by the way here uh you won't see this but one one thing I do often uh let me close this one thing I'll do often is when I go to save uh a chunk of code I'll just right click on the circuit python drive uh code dot pi and duplicate it just in lieu of proper um file management while I'm working directly on the disk so basically I'm about to save this merged underscore code dot pi as code dot pi on my circuit python drive but I right clicked on the existing code dot pi duplicated it so now there's a copy sitting there so if I if I do something terrible I can go back to that uh it's not great but it's it sort of works um so I'm going to replace the existing code dot pi with this one and let me disco tool dash n m7 by the way disco tool lets you just pick a unique part of the name so I might have another metro plugged into the computer but I know this is the only m7 because I only own one so that that should connect to that okay so let's see let's restart okay into objects is not iterable so even uh you can see there that's the error I was getting line 51 so let's uh check some parentheses and a comma in there yeah now let's see if I switch that waveform nope so the new notes in the new waveform oh wait what's going on it's not reading my switches did I unplug something what wiggled let's see do they work on their own right now oh I bet it's the position of that one sorry yeah remember I said these switches are all interrelated I uh I think my I'll brighten this up and take that saturation down my bottom switch here was in such a position that I wasn't able to get these read okay so this is on and this is in I think that's a sine wave nope that's the sawtooth okay but here's and then I should be able to change to sine yeah you can see it's just quieter and that one has like some nice beating frequencies because it's a half step off let me just kill them all there um I believe from something that Jeff said that there is um essentially a unity gain mixing happening so the volume when you add a note is halved I think uh uh or equalized to unity so that all the notes you have stack up to the same volume which is great because otherwise you could get it um seeming much louder when there are more notes and much quieter when there are fewer I could be butchering that explanation of it but I think that's I think that is how that's working in there okay so let's see we've also got uh the release all release then press so turn some notes on or off notes use midi numbering 60 without being middle c okay to release a note that was not actually turned on that's nice pressing a note that was already on has no effect yeah so I don't need to use that I was wondering if it was gonna like stack up if I pressed one note twice but it's not like it's increasing in volume or anything that that could be the gain thing I was talking about or it may just ignore um it sounds like from the API here it ignores any notes that are already pressed um so let's see I could do if we want to um just play it more like a momentary switch like a keyboard what we could do is say um if an event is released then we'll do synth dot I think it's release is it no is that not there okay how do we release a note release then press release all release all can we not release a specific note that's weird really I guess if I release and then press nothing okay so let's try release that's a maybe something we could get me release then press is the pressed note optional let's find out yeah that works okay so release then press but don't tell it to press anything works works the same so let me do this as a sawtooth cool all right so weird syntax but that works just well enough um I guess you could also use this you know to have one note just kind of iterate through some different list of notes like a like a simple arpeggio kind of thing um so there's some options in there but play around with it if you especially if you've got an m7 or rp2040 that'll work on I think it should just be a feather rp2040 or a would work maybe any rp24 I don't know the the library is called synthio and it's in the core module so you don't need to add it it's just there also if you've got mid dot mid you can go to a lot of websites and have them generate new ones or pull them from libraries so I think it says in here the kind of it's got to be a single track midi file I tried making some with use score and then didn't like those at all but play around with it synthio and this is the I'll put the link over in the chat if you want to go check out the the read the docs on it um I think that's about it it's not a lot to it the other since since we're like it's an experimental one we're okay changing this api and breaking things so if you're interested in helping break stuff and suggest stuff this would be a good time to do it I would love to maybe open it up to having tuning overrides because you may find that even though this is claiming to be a middle C it doesn't sound in tune with anything else that you're playing and and so since it just accepts this note 60 to be a 262 hertz maybe having offsets or maybe just telling it giving it frequencies and having a helper object for for the midi stuff that might be a sensible way to do it and the other thing that we're looking to do is add envelopes so right now as you can hear it's very harsh just on off sometimes can even give you a little clicks be really nice to be able to do some simple like attack release envelopes so that it can ease slowly or quickly into the note and ease out I don't think we have to get wild with it but an ADSR would be amazing ASR will be fine ADR AR any kind of envelope would be helpful all right I think that's going to do it so I will I'm excited this is working this well this is really the first time we've had a real synthesis polyphonic real synthesis happening in circuit python we've been able to play you know samples and mixed samples really incredible stuff that we can do with the mixer inside of the audio library that stuff's amazing but synthesis a little different animal from from doing sample playback so this is really exciting and I will be working on adjusting this thing to fit it into there and see if there's any other features to add I wouldn't mind doing a line out instead of just a speaker so that I can then go into like a small reverb or something like that that would be great have a little chorus and reverb on there and I'll be attacking the lights figuring out how to get these lights work I may I may take one more effort to see if there's any reasonable way to do lighting and buttons but I don't know it's a little wacky because it involves really fast switching of digital inputs to digital outputs which I don't think is going to happen fast enough to to make sense so all right before I go I'll remind you you can go and get yourself some cool stuff for 10% off over in the store so head over to Adafruit type in synth stuffing because we're stuffing synths sizes into things like that and you can use that coupon up till midnight tonight all of the great freebie options we have are in effect in fact let me since we're talking about coupons in the store let me jump over here real quick and and point out if you are interested in picking up some stuff with a larger order not fee but free adafruit.com slash free who doesn't like free stuff here's what you can get if your order is 149 or more you get a free kb2040 this little guy right here if your order is 200 or more you get free ups ground shipping in the continental us a if it's 2.99 or more you get a free circuit playground express we have those in stock now which is awesome and you can get all of them they all stack so if you get the circuit playground express you'll also get the free ground shipping and the free kb2040 so order has however much you want and get yourself 10 off using that coupon code synth stuffing right there um before i go i'll just take a look again at the chat see if there's any thoughts or questions um thanks jim henricksey you have a great weekend too thank you andy callaway thanks mouse and just to build custom pcb would be cool as heck oh my gosh with a display now you're talking that is that is a pretty cool idea considers making the scene for monsters versus alien with a president played by steven colbert tries to greet the aliens with funky tunes wait don't they blow up the poor aliens i didn't remember that was steven colbert either about that uh thanks paul cutler nice to see you and i appreciate you stopping by all right everyone thanks so much for a different industries i'm john park this has been john park's workshop and i will see you next time uh join us tomorrow for a deep dive with foamy guy i believe he's doing one tim uh we'll have shows starting again on tuesday with my product pick of the week wednesday we should have 3d hangouts return of the 3d hangouts uh show and tell i believe hosted by liz with co-host erin we'll have ask an engineer and then this thing happens again and cycle that endlessly uh all right thanks everyone for a different gem job park i will see you next time bye