 It's me, John Park, it's time for John Park's workshop. Thanks, everybody, for stopping by and by everybody. I mean, well, everybody and the people over in our YouTube chat and in our Discord chat. So thank you so much for stopping by. If you're wondering about that Discord chat, head to adafru.it slash discord. You'll get an instant invite. Look for the live broadcast chat channel. It looks like this, and that's where a bunch of the chatting is going on other than YouTube. I'm not keeping an eye on the Twitch and the Facebook and the other places, so head on over there if you're wondering where people are talking. Also sharing links and things, and much, much more. So let me see, what have we got going on today? I first of all want to share with you a coupon code in case you want to go buy some good stuff over in the store and you want to get a discount on it. You can use today's coupon code, which is the mysterious Honeycomb. It actually has nothing to do with what's going on in the show today, but something I'm working on on the side. So that'll make more sense at some point, but Honeycomb, regardless, it'll make plenty of sense if all you want to do is get 10% off in the store. Head to Adafruit, and when you, let's see, where's my Adafruit? There's my Adafruit, if you jump over there and check out maybe new products or some of these, what do we have? Products, featured products, you can click on products and then head on over here to view all under featured products, see some stuff that's featured. Go to the new products and let's see, we've got, oh, we've got a, this is a new one, this little breakout, the AT Tiny 816 breakout. I think the 8, the 1616 is very similar, but with more memory or something like that. One of them's out, you can click on the more info there and then go and sign up for an alert email if you want, but there's also some new lenses in store for the new cameras, the new high resolution Raspberry Pi cameras that are out, there we go, these new modules, 12 megapixel modules, snazzy snazzy. And those have two different lenses built onto them, and then I'm probably confusing some of these because I don't think those can take the lenses. I think it's, which one is it? This one down here, this high quality camera lens mount. I don't, I haven't played with these, so I'm not sure. I think that's just the sensor and then you can screw in these new two lenses. That's probably it, right? Anyway, lots of cool stuff over in the store and you can get yourself that nice discount, 10% off just by typing in honeycomb. And now I'm really hungry for honeycombs because people over in the chat are sharing pictures of cereal and I love cereal. And I'm gonna go get some honeycombs after this. Those were sugarcombs, right? No, those were called sugarcombs when we were kids. I think there's a bunch of them that went from sugar to honey when honey became synonymous with healthy in the early 80s, just sugar, sugar ones dropped out. I'm thinking of a different one. What's that one that's like the little puffed rice sugar bombs? I don't know, that's a Calvin Hobbes thing. Anyway, type that in, you get yourself a discount. What else is happening? Hey, on Tuesdays, if there's any cereal experts who can remind me, I had a bear, right? The bear only makes sense in the honey context. I don't know which one I'm talking about. I got a show on Tuesdays that's the JP's product pick of the week. And on that show, I give you a big humongous discount. We all do, not just me, but we ate a fruit, especially a new products team. Thank you for all the help on that. We give you a big humongous discount. Sugar crisps, sugar snaps, sugar smacks. I think it was sugar smacks. So this became honey smacks, right? I'll look into this. But on Tuesdays, I pick a product, sometimes something new, sometimes something from the archives. And I give you a little demo of it. Huge discount. The show appears inside of the product page in a little window there, a little YouTube view of the live stream happening. And you don't need a coupon code. You just throw it in your cart and buy it before the end of the show and you'll get the humongous discount. This was this week's where I... Oh, I thought I'd fixed that. Hold on, wait, we gotta fix the typo. I wrote charriplexed there. Hold on. I'm gonna go resolve this right now because I did make a updated. Phew, charriplexed LED driver, 16 by nine driver and the boards. And we had all of those on discount during the show. Here's a little recap. It is the 16 by nine charriplex PWM LED driver board and the 16 by nine LED boards themselves that you can pick one of to pair up nicely with your board. These allow you to easily now with STEMIQT connect up to your microcontroller and send very easy pixel commands and brightness commands to decide which of these kind of pixels you're lighting up. These are single color LEDs as well as their brightness on an individual level. So you can do some really nice gradient effects. Here you can see I have just a little, pretty simple. I'll show you the code in a second. Pretty simple code that is sending some a little heart pattern. And as it builds that pattern, it's doing some PWM brightness things. You can see it kind of fade vertically. And then I'm wiping across horizontally again with altering that brightness level as I go. This is through a little bit of diffusion acrylic. It is the charriplex 16 by nine PWM LED driver board with STEMIQT. Mm-hmm, yes it is. Those are really cool. That was product picked. By the way, one of the cool projects that was done using these, I think maybe the prior version before the STEMIQT was, I'm gonna jump over to my learn guide page here. It was the CM2, is that it? What was the name of the, it was a compute machine. Compute machine. What's the name I'm looking for? You know, connection machine, not compute machine, connection machine. So there's the real one there. I've seen one up in the computer history museum up in Northern California, the connection machine. I stand about that high. But look at this really cool, little desktop connection machine made with, I think eight, eight of these little Charlie Plex 16 by nine drivers. So that's a cool one. That's a tempting one to build. I think there's a, yeah, there's a Raspberry Pi version and Circuit Python version. So there's some options on that one. Anyway, that was a build that used those from this week's product pick. Also important updates from Discord. Sugar smacks was the one I was thinking of. I think that they are one that became Honey Smacks. But I think kept the frog, right? There's an article there. I'm definitely gonna check out. Thanks for linking to that. There's six different cereals that got rid of the word sugar from our childhood. Okay, she says, sugar smacks are still around. Oh, so did they do both? Did they just fork it into Honey Smacks and Sugar Smacks? I'm looking forward to reading that article and then going to cereal shopping, because I love cereal. Well, let's see what else have we got. This is a good time to do Circuit Python Parsec. Let's Circuit Python. Okay, hang on. Before I do that, I was just getting a notice from YouTube that there's maybe not enough data to maintain smooth streaming. Audio got out of sync, huh? That's weird. Why that is? All right. It looks like it's coming back in. Coming back online. I'll pause my little preview there. Let me know. I'll chat here for a second before I jump into the Circuit Python Parsec to see if we've got smoothness. Sound and vision out of sync, David, as I said. Thank you for the warning. Thanks, Mike P. Here she is. Hmm, let's see how it is now. What's it saying here? Huh, mouth is now in sync. Yay, back in sync. Okay, I don't know why it glitched there. A little window around here. Okay, so let's get to this. And for the Circuit Python Parsec today, I want to show you how you can turn on and off auto reload on your Circuit Python device. So auto reload is one of the features that makes it possible to hit save while you're coding on a Circuit Python device. In this case, I've got a little cutie pie here. And after it saves, it then automatically restarts the program, so it allows you to immediately see what's happening. However, sometimes there are glitches, particularly when you're doing sound stuff and audio stuff, sometimes MIDI stuff. Sometimes it's just the fault of your computer and what you've got running on it. I've run into issues where my computer is noticing my Circuit Python device as a drive and doing something. Maybe it's some backup thing in the background that's like, hey, I noticed a drive. I should take a look at that. And you'll see your code sort of stutter. Sometimes you'll hear it if there's an audio thing. So you don't have to deal with the root problem sometimes if you're just desperate to make things work. And so this is the way you can do a little bit of an end run around that auto reload. And so the way you do it is you import supervisor, the supervisor library, and then you just add this bit of code right here. Supervisor.Runtime.AutoReload equals either true or false. So right now it's set to true. This means if I save my code, I'll see that it just restarted. And the way you can tell mine is running is I have a little bit of a fading LED here and I have some ASCII text moving across the bottom. So now what I'll do is I'll set this to false and I'm going to resave my code. And that's the last time it's going to auto reload when I save code. So you'll notice now if I try to go and change the code. So I've uncommented a little bit here. I'm going to hit save. OK, it just saved, but you'll notice it's not running the new code until I restart the board. And an easy way to do that if you have a little repl open is hit Control C. That stops the current code from running. And then as it says right there, use Control D to reload. So I'll hit Control D and now it's running. So this is something that you don't always want to use because it does slow down your iteration a little. But if you need to be certain that things are reloading and you want to avoid any issues that you're having with your operating system or with other glitches, this is a way to know that no matter what's happening in disk activity, the board is not going to reload until you decide to reload it. And so that is how you can use Supervisor Runtime Auto Reload in Circuit Python. And that is your Circuit Python Parsec. Circuit Python. So like I said, you probably don't want to have this running all the time because it does slow down your development if things are working well. Don't touch it. But depending, especially I think it's things going on on my computer, one computer and not the other, it's a really easy way to just stop that frustration of disk activity causing your machine to reload. Let's see. Tyeth asks a question, is there anything else super duper in the Supervisor Library other than Runtime? That's a great question. I think there's one other I've used. I'll try to remember that. And if there are, I'll do some other Circuit Python Parsecs on some other stuff inside a Supervisor. All right. Take that out of there. OK, let's see. What else is happening? And by the way, if anyone in the chat has suggestions for things to look for inside a Supervisor, let me know. Actually, one thing you can do, a quick, I'm going to re-plug this cutie pie and bring back that window. One kind of quick and easy way to check is if you hit Control C in your REPL and stop the current program, you get a little Circuit Python command prompt here. So I can do import supervisor. And then I can do dur supervisor, directory supervisor. And this will tell me some of the things that are available. So there's run reason, get previous trace back, reload, reset terminal, runtime set, next code file set, USB identification, status bar, ticks. I think if I do just supervisor.runtime, dot and hit Tab, I'll get a little tab completion of some of the things that are inside of that class. So auto reload, BLE workflow, run stack limit, RGB status brightness, run reason, serial bytes available, serial connected, USB connected. Doesn't give you a lot of info about that, but now you know maybe some search terms to go look for in the documentation, either on Read the Docs or in the Circuit Python GitHub. So let's see. Todd Bott says there are many useful things in Supervisor. Because she has this runtime only for auto reload. No, so yeah, there's a bunch of things there. So you can throw a bunch of these as a little boilerplate template if there are ones that you want to always maybe change your RGB status brightness before it runs. You can adjust that as well. Thanks, yeah, Tackle the World says, wow, that's so convenient. It's very friendly to go in here and either ask for what some of the libraries have inside of them, or just use tab completion and see what some of them are. And I've fairly scratched the surface of these. A lot of good stuff in there. You're welcome, yeah, Dave Echols says, great tip. Thank you, that's so helpful. Especially with, I think, you know when I was really starting to use this a lot was with the pull cord, C&C, it's audio projects, playing back wave files, and there are sometimes some audio glitching that happens when the Circuit Python drive gets pinged and it auto-reloads. And so that was just making me lose my mind. So telling it not to auto-reload, very, very helpful in that kind of an audio playback project. And Koyoshi asks, who supervises the supervisor? Probably Scott, that's my guess. OK, so what else is going on here today? Again, I'll remind you, Honeycomb is your coupon code. So if you want to go to the store, check out some stuff, buy some supervisors and things, whatever you want to get, get 10% off. And that's only good on stuff, not on software or gift certificates or subscriptions, so only on physical goods, but you'll get 10% off. And just type in Honeycomb, that'll be good until midnight tonight, Eastern Standard Time or Daylight. I don't know which one we're in, I can never remember. Which is one of my Achilles heels in the crossword, because it often asks for a thing. And I do E blank T, Eastern Something or Other Time. And I can't remember which, if it's Daylight or Standard at the moment. So let's talk about this title I have here, Ice Cream Cone Pitch Bend. So yes, it's all about our friend, the Meowzik. So I've been working more on the MIDI version of this. I have two versions I'm working on, writing guides for. And the one thing I had done, so some updates, since last week I did go and tap into the ribbon cables for all of these buttons. They're also on the six by eight row and column matrix, button matrix. So I wired those into my KB2040. And so now I have all those buttons there. There is a LED inside of the record button. You can see it there. That I might tap into, I might not. It just runs into the motherboard that I'm basically not using at this point. So now I have all keys, all buttons, with the exception of these four. So I am going to look and see if I can run some bodge wire off of the traces for these or see if they're part of the matrix. But those are right on the main motherboard, so they just kind of immediately duck under the epoxy blob. But I'll see if I can get to those. And that'll mean I have everything. And it might be really nice to have essentially these labeled tempo and volume buttons, because that might allow me to send some MIDI clock stuff and Channel 7. I think it is a MIDI volume message I can send over CC. But this right here, this ice cream cone, is this one taped in? This one's taped in right now. This ice cream cone, let me grab a different one here, is a little microphone. And on the stock meowsic, it just runs its very low-fi mic through the speaker. In fact, if I turn this on. Oh, you know what? This is the one I disconnected. Yeah, check, check, check. Yeah, so that's not working. But when you pull on this thing, you get a sort of little handheld ice cream cone that you could use for something or other. And during last week, I think it was last week's show, it was C Grover who suggested, hey, what about putting an accelerometer in there so that you have now something you can use to control some continuously variable stuff, like maybe pitch bend or like a modulation wheel, modulation knob type of thing. And so that's what I want to do. By the way, Kiyoshi asks, how many did you buy of these? I have four of them now. Maybe more than I need. But so what I want to look at today is adding the accelerometer. How do you add an accelerometer to a project like this? So let's jump over to the workbench here. I'm just going to small up this window a little bit so that doesn't block too much. And let me guide you through what I got going on here. I'm just going to real quick get Discord up on my phone here so I can see that chat. And sorry, I don't think I can do both YouTube and Discord chat on my phone at the same time, maybe. But actually, I've never really played around with that split screen stuff much. So I will look at Discord. OK, so this was something, first of all, that I demoed last night. Let me give a little recap of where we're at with this. So what I have as far as connections here at the moment, oh, I can hear that one snooze. Just snored. That freaks me out every time. If you leave a meowsic alone for a couple minutes, it makes a snoring sound. And then sort of goes to low power mode. So this is going to get tidied up because you can see here this is actually about twice as much space as I need. And I may use one of our little mint tin-sized proto boards for this and put the KV2040 directly on it to lose all that height that I'm gaining from header pins. But there are essentially the row and column matrices or two of these ribbon cables. The other ribbon cable is coming from this section here. And that is overlapping these. So none of these are unique row or matrix pins. So those are just doubled up with some of those. Then I have a TRS Stereo 3.5 millimeter jack here, which is my MIDI output for classic MIDI. So if I plug it into a classic synthesizer, something that doesn't have USB, classic MIDI is coming out of that, or serial MIDI. And then, of course, USB is providing power to this and I'm sending USB MIDI back up to whatever device if I'm using a software synthesizer or a host of some kind. And then you can see here I have added a Stemicut cable and a little three-axis accelerometer breakout. This is the MSA 311. Pretty much any accelerometer would work. This is a nice one. It's, I think, $5, quite cheap and it works very well. So what I'll need to do is figure out if I've got a good cable solution for essentially replacing this cable. So this cable here has two wires in it and I need four wires. This cable is nice and robust. It's fairly flexible but nice and robust because it's got to stand up to the abuse of being pulled from there and retracted. But once it's pulled out, it'll be kind of a nice little controller for adjusting one of my parameters like pitch bend. Even with it connected, you could probably do some like little minor, it has a little bit of jiggle to it, so you might be able to do a little minor tremolo style effects to your pitch bend there. And I think, though, if I figure out a good cable solution, this will fit nicely in there. This is just basically empty space here. Honestly, I think the biggest challenge will be, can I use some solvent, because this is just glued together, can I use some solvent and a thin blade to open that up or will I have to just hacksaw or dremel it open? Either way, I think I can solvent weld it right back together once I get it apart. I don't think I'll bother adding screws. I think this top is also, there's no seam in this dome part, so I think that's glued down into there. So that'll be the only sort of very destructive edit that I'll be making to the little meowsic guy here. But I think it's a great suggestion from C Grover. I think it'll be a nice update to the functionality, because everything on the cat piano is basically binary. It's just buttons. So this will be kind of the only thing that we have that gives us a knob-like feel or a pedal-like feel, a mod wheel type feel. So I also showed this on the show and tell last night. And I wanted to talk about this a little bit, do a demo, and then we'll look at the code that I've set up for doing pitch bend here. So this is Audio Kit Synth 1. It's a synth 1 is from a company called Audio Kit. They make essentially a whole, it's an open source synthesizer foundation that you can create your own synth application, skin it however you want, pick and choose what functionality you want. But it's really a great foundational, it kind of has everything you need in it for doing really good synthesis on iOS. And I think it's available for the phone and the iPad. I don't know if there's a, I think there was a way to run it on macOS. Maybe pre-M1, I'm not sure if it runs under the M1 or M2 chips, but someone correct me if I'm wrong or look into that. But anyway, really fully featured synthesizer. It can be controlled via MIDI over USB. It's set up for that, really easy to control it with pretty much any type of USB MIDI controller. So it acts as a host. And it has the ability to accept a MIDI note on off, a MIDI CC, so change any of these knobs with something, and pitch bend and probably a few other things. So what I've done is I've set it up so that if you look right here, put this in view, you'll see there's a sort of a slider there on the left that is moving up and down as I move my accelerometer. So that's the pitch bend slider. So that exists kind of always in here. You can, while you're playing, you can just reach over here and use your finger to adjust the pitch of a note. So if we take a look at that, so you can do it right there in the interface. But now what we'll be able to do is use the little accelerometer, which is just plugged in over stem of QT, to do the same sort of thing. So like I was saying, if you have this plugged in down here with the ice cream cone just plugged in, then you'd be doing little very minor little pitch bends. This is set up to do one, I think it's one semitone when it's fully vertical and then a semitone down when it's pointed down at the ground. The classic problem with these is really hard to find your note again at the middle of it since it's not a spring return wheel that goes right back to nothing. So I have a couple ideas about that. One could be just to create a pretty big dead band in the middle, a larger range of change required off of the 0. This accelerometer essentially reports things in 0. I'm using the y-axis for this 0. Negative 9 when it's pointed up, so negative 9 against gravity, positive 9 when it's pointed down. So I'm taking those and converting them to the pitch bend values, which I think are 0 to 16,383 or something like that. So there are probably some ways to prevent that. Another way too is to only enable pitch bend when you press one of the buttons that's not currently in use. So I have these keys being used right now for playing notes. That's doing nothing. That's doing nothing. This now sends MIDI panic, which is just turns off all notes in case you get a note stuck. And then these 10 here I'm using to pick different presets or patches. So you can see a whole bunch of stuff changes on my screen here when I press a button. And I'm also now using the play button here to start and stop sequences. So if I pick one that has a sequence, I can just stop it. Now it'll let me use that sound design of that patch, but not automatically play the little sequence or arpeggio that's built into it and start and stop there. Record doesn't do anything either right now. So that could also be one to use for enabling and disabling the pitch bend there. So yeah, those are the keys that I have free right now. Oh, OK, Iran, this is a good suggestion. It says, instead of being able to say, we'll have a button to re-zero the accelerometer. So that'd be kind of cool. So you could grab this, hit a button, and say, OK, that's the zero state. And now we take that number, whatever that number is, that becomes the new zero pitch bend. I really like that. That's a cool idea. Thank you. Let's see. Kayoshi says, if you can't open the ice cream cone without sawing or melting, maybe a 3D printed cone is an option. That's a nice idea, yeah, because I'll be removing that wire anyway, so maybe just pull that whole thing off and just put in a stand-in would be kind of cool, too. So yeah, so I have these. These are all patches, so 10 patches. These play, that one actually toggles start and stop on the sequence. Record is doing nothing right now. These four are not wired up to anything. These two don't do anything. So I've still got some space there to pick some stuff. And the nice thing, of course, is that it's a very temporary choice, because you can plug that into the computer. Circuit Python, just open up the code.py file, change your mapping, and then your buttons now have a completely new meaning. So that's certainly flexible that way. So let's take this. I just want to show you the code update for doing the accelerometer. So I will bring the whole cat piano over there, and I've got a USB cable there I can use. So let's retract our ice cream cone and bring this over here. By the way, some of these buttons are loose because I just haven't screwed all the screws back in yet. So this whole thing here is only held in by one instead of four screws, just because I'm in there still desoldering things and figuring out what I'm wiring to. So it'll be more sturdy once I'm done with those changes and button the thing back up. All right. So let me switch over to another view here. Well, I get this plugged in and set up. So you go over with the continued suggestion, says the cone could be converted to a neopixel disco light wand. I like it. All right. So let me put that in there. Focus. Let me see your Mosaic here. He's crazed. OK. And I'll close this up. And oh, now I've done it. I may have to. Oh, yeah, it didn't break it. Sometimes this software doesn't like a window getting closed and reopened when it's broadcasting. So let's see. Is this the code? It is. OK, so here's what's new for. You can see here, by the way, this is an example of where I'm not using the auto reload, the runtime auto reload. So if I make changes, I do have to do my manual reload. Open up the terminal in here. There we go. And that's a KV2040. Oh, hey, that's funny. Let's see what that's a new one on me. OK. So Control C, Control D, we're reloaded now. What's it giving me there? Accelerometer output. OK, so yeah, I think the only thing I'm printing right now, one of the only things is that note numbers. And since those are slightly vibrating things here, it's also giving me accelerometer output there. So here is what I've added. So I've got simple math. I'm using map range class from simple math library. And that's what I'm using to take my negative 9 to positive 9 float that the accelerometer spits out per axis and convert that into 0 to 16383 for the pitch bend data that gets sent over midi. And then I added pitch bend here. I also added midi start and midi stop, which I was going to use for starting and stopping the midi clock. But I don't know if the audio synth 1 will or will not accept that. It seemed like what I really just needed was to map a spare midi CC 0 to 127, like a binary on-off switch, which I could then in the learning process of the app tell it to hit the start and stop button in there. So I don't know if they have a standard midi thing connected to that start and stop the arpeggio, but it's not the midi clock. So I actually don't need that stuff for this application. Then I'm setting up I squared C. I didn't need a I squared C bus until now. So now I'm setting up I squared C is the board stemma I squared C port. And then MSA 311 is the accelerometer, which did I mention? I think I forgot. I'm importing that up here. So Adafruit MSA 3XX, because we have the 301 and the 311. Not sure if there are any others, but from that, I'm bringing in the MSA 311 for this particular chip. And then other. OK, so there's a lot of mess here right now that I'm going to consolidate probably into a dictionary. But right now, I've just got some key ranges that are the keyboard keys and then some others that are just telling it explicitly what those do. So that'll get neatened up in time. But for today, here's the new stuff I am. Let me make a little space here. So here is a bunch of the stuff for the accelerometer. So first, I have a value, which I guess is my hysteresis. It's this 0.2 change in the accelerometer. X float value is enough for it to say, OK, we're going to pay attention to the accelerometer. So that's something I can change if I want it to be a little smoother, a little steppier, a little broader in allowances for what it considers to be a pitch bend change. And then I have this filter percent. It's how much I'm actually filtering that data. And then I have a variable called Excel data y, which is based on just asking an accelerator. I say msa.acceleration. And that's a tuple. Normally spits back the x, y, and z. I think that's all it gives back. So I just want y. So I'm picking the 0 index. So item 1 is y. And then I'm also setting up a little comparison variable called the last accelerometer, data y, which is at the beginning of this thing the same. Then we can compare those and see if the slop amount of delta or difference between those two is enough, then we'll pay attention to the accelerometer and send some pitch bend stuff. And then this right here is all I need to do the pitch bend stuff. So I have, again, every time the loop runs through of the main loop of the program, we say new data y equals, let's go and read the accelerometer just spitting back the y axis into this variable. And then I have this filtered version of it. So Excel data y is equal to my new data y, so that was the latest reading, times this filter percentage plus 1 minus the filter percentage times that accelerometer data y. So that just filters it down, smooths out the data. And then with that, I check and see, OK, if the absolute, so it can be negative or positive direction, if the absolute of that Excel data y minus the last Excel data y is greater than my slop amount, then I do something. So that's sort of a little dead band, only if we go more than 0.2, or whatever you set the slop value to be. So in this case, if this is running, it's true we've moved it enough to then say, OK, I have a pitch value that is equal to, I'm creating an integer, casting an integer version of this, which is map range from the simple math library. Whatever the Excel data y is, that smooth version. As my input, my range can be 9 to negative 9. And then I turn that into 0 to 16, 383, which is the integer numbers that can go in the MIDI message over to the software synth that's looking for a pitch bend adjustment. So I think this is somewhat confusing, because if you look up MIDI stuff, sometimes it'll tell you that pitch bend is actually negative 8,000 something to positive 8,000. But in this case, at least, with this synthesizer, I don't know if I've run into ones that want it expressed as negative to positive. But in this case, 0 to 16, 383 makes this happy, as far as receiving pitch bend values, where the halfway point of that is no pitch bend. And then as we head to 0, we drop the pitch down, semitone, and as we head to 16, 383, we raise the pitch up a semitone. Then I'm just sending this on MIDI USB right now, just because that's what I was working on and being lazy, but I should actually also have this go over the MIDI serial. So that means it'll send it also over that little TRS jack there. I'm printing it right now just for my own debugging feedback. And the last thing we do is we set that historical placeholder that we check against, the last Excel data, why I just set it to be equal to whatever the current is. That means we'll be able to keep checking against change. And that is it. Everything else in here is the code I was using previously, which is a bit the stuff I need to clean up with my using a dictionary for this or some lists for this stuff. But this right here is the whole event of the keyboard matrix loop. So we just get that event loop or buffer of events, see if anything's changed. If something's changed, if it was something that was pressed, we find out which key was pressed, if it is within the range of what I called the keyboard top, which is all these keyboard keys, piano keys, then we send a note. And if it's one of these patch ones that are named piano, bells, meow, organ, and banjo, or rock, blue, samba, techno, and disco, those are the ones that I'm sending out a patch change or a program change. So actually, this is newer code from last week that I didn't have either. So I'll show you how this works. Let's say we hit the piano button here. And actually, I'm going to turn off the print statements from the accelerometer, because we don't need to see that crowding things up right now. Sorry. So I already turned that off. OK, so I'll save this code. And now I will, since I'm not allowing auto reloads, I'll hit Control C, Control D. Now you'll see the accelerometer doesn't do anything, but I am still receiving notes. So if I press the piano, bells, meow, organ, banjo over here, because all I'm printing out right now is just their event number. So I think 0 is the first note on the piano keyboard, up through 27. This is 28, 29, 30, 31. So that's just how the matrix is set up. So when I press one of those, let's say the piano one, here's all I'm doing. Send PC, it's a function I created. And then the argument here is 0, 1, 0. So what does that mean? If we look up at this function, hopefully I commented it a little bit. That comment doesn't matter anymore, in fact. So OK, so send PC function. And I'm feeding it a bank number, a folder number, and a patch number. Excuse me. So you can see that in the choices here. I'm going to go to full screen on this for a second, right there. Let me go to full screen on that down cam. Just the focus here. OK, so this is, it's not plugged in. I won't plug it in yet. But what you'll see is there are ways to organize presets on a MIDI instrument that can be broken down into banks, sometimes folders, and then individual patches. This one uses just banks and patches. So if I send it, what did I say, 0, 1, 0, is what this piano key sends. Yeah, 0, 1, 0 means it's going to go to the first bank. Is that right? The first folder, actually I don't think it's using that. So whatever that number is, it doesn't matter. And then 0 on the patches. Actually, I don't think it's that. I think this is what it calls. Yeah, bank A there. Bank A is what, when you call 0, we get. And then synthwave1974 is the first patch inside of that or program inside of that. So then when I press the second key that says bells, it jumps to that bank and the first item in it. If I go to the meow key, that's number two. It's Bryce Beasley here. Same thing, the very first one. DJ Puzzle, shout out to DJ Puzzle. He's awesome. This presets on all kinds of things. So let's see, DJ Puzzle's one there is what, 0, 1, 2, 3. So that's what the organ key gets. And it's, again, lost sense in all the first one on there. So you can see that in action if I go. I'm going to unplug the KB2040 from my computer and plug it into the iPad here. And hopefully it's not pressing a key where I have the iPad resting. So now that the iPad is plugged into the meow's a keyboard, you can hear some sounds coming out. Here is bank A, item 0, bank B, or bank 2, sorry, bank 1, or bank 0, bank 1, bank 2, bank 3. So I just was picking kind of the first one in many cases. Some of these, there's the, yeah, that one is, let's see, or any of these, not the first one. I happened to pick the first one in all of them, but yeah. So that's, if you look back at the code here, all of these are just picking the first sound inside of one of those banks. So if we change one of those, let's say we'll change disco here, the last one. So let's say that's going to be number 4. So I'll hit, I'm going to plug this back into the computer for a second, save that, restart it, make sure it doesn't get mad. OK, it looks like it'll work. So now I'll unplug and re-plug that into the iPad. And now when we pick this disco button here, you can see it goes to the fourth, that's actually zero index. So it's the fifth one, but these are named 0, 1, 2, 3, 4. Soy ARP 5. Ooh, really percussive, that's cool. So that's how that's working. That's how the change between presets works here. It is fairly standard. These program changes are sort of an integral part of MIDI and how you can use a controller to tell different instrument sounds to come up on a piece of MIDI gear. However, I was somewhat dismayed to find that a lot of software synths don't really implement it or don't implement it well. So if you look around, even software synths on the computer, not just on the iPad, sometimes you're really only able to send the program change numbers and not different banks. And so if the software synth is arranged with a slew of banks, you might only have like 10 sounds in the first bank. That's all you can use with this. So it'll vary. But I was glad to find that this one does respect the whole bank and patch thing. It doesn't use folders, but if you find one that does, or let me know if that works. So I think, yeah, that's it. You can see here I mentioned that I have the play button just sending a send of a control change that goes either 127 or 0 on MIDI CC number 16. So that's the MIDI CCs or this list of 128 different little kind of addresses that you can send continuously variable stuff like knobs or on off essentially with 0 and 127. So that's how I'm using that. Again, I've currently only got that set up on MIDI USB. So I should also make one for MIDI serial, or I should make myself a function that pretty much always, when I say MIDI send, it sends it on both USB and serial. There's no reason not to. Here's my MIDI panic. So that's the boop on the nose that sends out all of those MIDI off messages. And again, that's a little function that I made. And I've used this before in some other MIDI projects. If you look up at MIDI panic, I just say for X in range 127, send note off to note X, both over USB and serial there. In fact, this is kind of a fun one to watch. If I do, let me see if I can open up MIDI monitor and show you this, it should send a bazillion MIDI off messages. Yeah, so let me open up. Let me share this little screen with you here. Go quick, little screen capture. Oh good, DJ Devon 3 said they just downloaded Audio Kit and you're getting a lightning to USB cable for the iPad. Yeah, I don't know what, I haven't tried a direct cable because I think on the iPad side, it's lightning on the, yeah, so OK, so yeah, with that cable and the, whatever it's called these days, we have one in the store I can show it to you, but you may have one already. Then you can use certain USB devices, particularly keyboards, MIDI stuff, not mass storage, usually, I don't think. OK, so let me tell this thing to be a window in a second. My broadcast software doesn't really love adding stuff to it while it's doing its thing. So let's take a second. MIDI monitor, I should do it. Probably come in huge, yeah, it's huge. OK, so MIDI monitor, there's similar MIDI software on Windows and probably on Linux, but it just shows me what MIDI messages are coming from a device or software going into some software or device. You can configure it to just see what's happening. So if I hit a key here, you're just seeing key 67 is on. When it hits a velocity of, we're sending a velocity of 120 by default, off is zero. If I adjust my little accelerometer here, you'll see it's sending pitch data, so 81.91, when I'm fully vertical, up and down, and negative 81.92, when I go fully down. Clear that again, so if I boop the nose, you'll see it just sprays as fast as it can at whatever the top speed that the MIDI will allow it. It sprays, ignore the pitch wheel stuff there, but it sprays all of those note off messages for every note, starting at zero, which a lot of software doesn't really respect having a note as low as zero, but this sends the full range just in case. So that's the MIDI panic. I think there is a MIDI sound off message that works with some implementations. It's a message that exists, but it didn't work with the Synth 1 software on my iPad, so I just went to this brute force attack of MIDI panic. And I love that that's the nose boop now. Boop. Lots of MIDI notes off. All right. So let's see. That's the progress on that. I'm going to try to tidy up the code and post that soon, and I'll be able to get a guide put together for that. Let's see what's going on in the chat. Any thoughts or questions? Oh, Quynman16 said it was Eastern Standard Time and Pacific Standard Time. So this is Standard Time. And then it's Daylight Time, what? When we've changed it? I can never keep it straight. Did you know it'd be gone? All right. Yeah, check out this cord for some discussion on some fixes to some float decimal problems that some people were noticing or talking about. Apparently, Jepler reported a fix of some kind. That did sound like the Knight Rider theme music, Andy. All right. I think that's going to do it. So hey, thanks everyone for stopping by today. I'll be back on Tuesday with a product pick of the week. We've got, I believe, a foamy guy. We'll be doing a deep dive with Tim slash foamy guy tomorrow. Check our blogs and our live broadcast announcements and live broadcast chat channels over on Discord to find out more. And there's also, wait for this to catch up here. It's all some discussion about the cables you need. Yeah, I said I'd show you that. And in fact, hopefully this is running again. I'll bring up, there is your coupon code. So if you want to get some stuff in the store, you can use Honeycomb to get a 10% off. And the lightning adapter I'm talking about is this one that we're calling it on the go cable. iOS Lightning, the USB OTG cable. It's this little adapter. So lightning end goes into the iOS device. I've used it on the phone and on the iPad. And then your USB A to USB C cable would be going into the KV2040 in this case. If you're using a device with a micro USB, such as an older feather, then that's the cable you would use. But this is the secret link to being able to have the iOS device acting as a USB host for something like this MIDI keyboard. And you can get those. There's an official Apple branded one. I've got one of those. And I have one of these. And they've both worked identically for me. So this one, I'm guessing, is cheaper than the Apple one. That's just a guess, I'm not sure. All right, yeah. So Honeycomb, we get you 10% off. Go do that. And thanks, everyone. Have a great rest of your day and Friday and into the weekend. And we'll see you all next week. Graded for Industries, I'm John Park. And this has been John Park's Workshop. Bye-bye.