Juce Tutorial 39- Bitcrusher Plugin Walkthrough with Aaron Leese (Stagecraft Software)

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
hey what's up everybody so we're here with a friend of mine Aaron lease who I met last year at the audio developer conference here in London how you doing Aaron good I waited till you like we're getting ready to take a drink yeah I catch people off-guard like I just thought let me just wait until he just goes for that goods for the drink yeah so so Aaron has his own plugging company called sound craft and I knew I was gonna mess that up man I was thinking I was I was leading up to it I thought is a stage craft is sound craft the stage craft some craft must be another company I'm sure it is but stage craft so so Aaron has his own company called stage craft and he's how long have you been doing this for Wow 15 years programming or just or just the company itself yeah yeah I mean all of it all of it I was a pretty bad programmer there for the first like four or five years so maybe I could say 20 years but then the company started more like 10 or 12 years ago nice nice and one thing that really impressed me this was before we actually even knew each other was that you're one of the only people that I know that has made a plug-in that uses DBS outside of the kind of commercial applications like tractor sarado so on the staff so can that's the big one man that's totally what the that's the one that gets us on the map because we are the we're almost the only company that does that miss pinky has a plug-in as well a little they're a little bit different there's allows needle dropping and it's kind of a more traditional DJ approach whereas ours is like finger drumming triggering triggering samples and then you can scratch those samples but both of them yeah getting it into the DAW environment is a huge thing for producers and obviously some DJ's so the people that are out there that are looking to produce a lot of them end up finding produce scratches who's you know turntablism them a lot of them end up finding us so that's where that and we have a few free plugins we give away and that's kind of what gets this gets our name out there yeah yeah so so just to catch people up just in case they're unaware the the what's what's the name of the plug-in again scratch track scratch track track yeah so scratch track is the only plug-in that I'm aware of well besides miss pinkie that allows you to basically use DVS digital digital vinyl system software within AD aw like Ableton so if you want to put scratches on your tracks then basically you could get scratched track and it provides you with a whole load of features that allow you to basically lay down your cuts over these tracks and and it works really well so yeah and you can you can actually select from different types of vinyl as well so you can select cerrado vinyl tractor vinyl so on and so forth yeah it works it works with any vinyl that's out there and CDJs pretty well and ok with MIDI controllers to even that those are a little harder yeah so so Aaron was nice enough to basically let us into his his kind of mind for this bit crusher plugin that he's created and can you just tell us a little bit about the big crusher plugin yeah so we were talking last year about this we have I have a number of free plug-ins and josh is getting hardcore into like DSP coding and juice coding so he said look I'm looking for people to kind of like help the coding community and show us DSP and show us how juice works and things like that and I said you know sign me up and we've been talking about it since there is a we have a free bit crusher plugin so today we're gonna I think today we're going to go through the steps of the bit crusher plug-in and show kind of talk about the DSD stuff like that all right yeah yeah that sounds great so excellent so basically like like Aaron was saying since last year we were discussing this well I think one thing that I thought that I've always thought would be really helpful is to have more experienced developers if you know if they were able to to just kind of let us in a little bit on the way that they come up with their algorithms and their designs for the plugins and Aaron's been nice enough to be able to kind of walk us through one of his bit crusher plugins and I think that's really cool because then we can kind of see exactly how a professional coder actually kind of builds his plugins and also the way that some of the things that are going through your mind you know and some of the considerations that you need to take when while you're building so I really appreciate you coming on and being able to walk us through this and is there a place where where people can download the code or is the code not available or don't you want to hand it out anywhere you can you can spread the demo code wherever you want okay cool so I'll go ahead and now uh I'll put it up on my github of course all the credit goes to Aaron and everything since he's written it and everything so you can so you can download it you could check it out pull it apart and you know I think it'll be a great way to kind of engage in discussions and just a way of making us all better and a little bit more aware and just kind of working our way through this C++ world so so what I'm going to do now is I'm just going to go ahead and share the code itself and pull you over here so I can see ok cool can you see that Aaron good ok great awesome I'm gonna put it inside here so so let's go ahead and I guess what I'll do is I'll just kind of start and I'll kind of walk through just the juice basic kind of plug-in model and then what we can do is maybe we can start getting into more detail as far as how you get started and then and then just kind of take it there how's that how's that sound yeah we should step back and kind of tell people what a bit crusher is and does at some point - okay yeah yeah that'd be great good go ahead and fire away part of the reason this one I mean part of the reason we make it free is because it's a small plugin it's well known algorithms everything like that like there's no trade secrets that kind of stuff in here um but nonetheless like 90% of what you're going to end up doing out there when you're putting things together you're gonna see an algorithm you like and you're gonna want to adapt that so in this case we're doing a big crusher now bit crushers are all a little bit different but almost all of them do two or three of the same things almost all of them have bit reduction which means taking it from like 32-bit sound down to 8-bit sound which makes it kind of give it a crunchy sound rate reduction which means taking it from like you know forty-four one kilohertz sampling rate down to a much smaller sampling rate which also mangles the sound and then a lot of them also add noise and then there's filters or compressors or things like that we don't do any in this demo we don't have that so the three things that are kind of broken off and put it into this big crusher for this demo are bit reduction rate reduction and adding notes awesome cool and now I'll just go ahead and quickly review the kind of plug-in model for for juice and the way things are set up once you kind of open a plug-in template within juice this is something that we've covered in the past but I'll just go through really briefly just for people that don't know so basically when you get a when you open a plug-in template from juice so as you know there are a number of different templates that you can open you could do an audio application you could do a UI application and you can do a BST plugin so this is a VST plug-in type of model and he hasn't added any classes in here or anything so this is these are the four files that you end up with so you have the plug-in processor and the plug-in editor cpp and header files so the plug-in editor is responsible for all of your UI so what the user actually sees the controllers the controls that the you is able to modify things that they're able to turn on or off sliders that they're able to move so on and so forth the plug-in processor is responsible for the actual kind of back end the audio the DSP algorithm and the initialization of the plug-in would that would that summarize it pretty much totally yeah and like you said or like you alluded to this is like the simplest kind of audio processor you can get if you open up the juice demo project that's what this is we didn't add much at all we just went in and quickly kind of built a few things into the plugin process great okay so where shall we start here shall we start on the US side or on the processing side well maybe run it once and we can at least take a look and then if you want to look at each class quickly we can look at the UI just see where things live and then really we want to get to the DSP ok great so just building it here so I've built it so okay cool I felt like for a second it wasn't going to show up can you can you actually see that did you put it on a second monitor I got it on I got it on the plug-in host yeah I don't see that that's probably on a different monitor or something all I see is the bit crusher demo okay great so it's just opening at the moment here it's thinking about what to do so I could actually stop the share here and then I should be able to do this so let's see now hopefully it'll actually run yeah it's actually thinking at the moment there we go so I'm just going to load this audio file yeah it's a bit strange because it's doing a screen share okay these can still see that or no oh yeah okay great can you see the audio file player no okay so in just one window so it's just showing like the big crusher demo filter graph window right now okay so I'm going to go ahead and play this and then I'm going to okay let's see so I'm gonna go ahead and play it and then I'm gonna open up the actual plug the actual plug-in itself I'm gonna share that so you can see the actual plug-in itself and then I'm going to run up I'm going to kind of toggle them around a couple of the controls just so you can get an idea of what the plug-in actually does so actually let me just do this and then I'm flipping through a million different windows right now probably like screen share the whole screen or something yeah that is three see this is why you're a professional man okay here we go so now you should see what I see yeah great yes this is why the this is why he's a pro and I'm just the startup man I'm a Padawan so cool so you can see the UI for the plug-in and everything right yep cool alright so here we go so I'll just toggle these around oh I love that a lot of crunches it's all about the dirt it's all about yeah great yeah so that's that's a great little demonstration so that sounds that sounds great I loved I loved the rate the way that that works that sounded really good so cool okay so so yeah so we saw how it worked just I think let's start on the processor side maybe because I think that's the part that people will be the most curious about that's what the good stuff happens yeah and also like we can talk about the editor class that's the way things all fit together but I feel like that can be a different I could be a totally different day you know yeah yeah absolutely yeah let's stretch out the content make this into two parts man and like the sound of that so cool okay so let's let's just start like at the beginning okay so you want to make a bit crush or plug in where do you start really let's start if you can collapse all that stuff right and go down to process its block right so this is juice plugin it inherits from the juice audio processor class audio processors have a method called process block this is the most important thing this is the thing that does all of the sound every all the changes and everything else when you when you open up the juice demo you'll see the first five or six lines there come straight from the demo they're not even changed and then down where it gets to noise amount fifth-rate divided line 247 that's where we that's where I started adding stuff so the place to start if you want to develop a an audio process or a plugin is you go to this class you start up this demo and you delete everything that's in process block mm-hm and then we're gonna say okay what do we want it to do right and if we go through a brainstorming session we talked about a brick crusher and you come up with the three things we were just talking about building noise rate reduction and bit reduction and then we want to find the algorithm for each so there's a few up at the top of this there's some stuff we can kind of circle back to but in our case it's it's usually a good idea to put all the things you're going to need and all that kind of like safety checks and like anything you need to resize or things like that I tend to put at the beginning those up at the top we say you know what's our buffer size how much noise do we actually want how much I don't know time down at the process block Oh down in the process block my bad yeah so process block starts up and every time there might be a slightly different amount of noise fit done whatever line 2:47 there mmm first few lines are just getting stuff and there's a quick safety check if for some reason the number of samples has changed we're going to change some of the buffer sizes mm-hmm so this is so this is when you're in a da W environment sometimes something may happen in the da W where it changes the buffer size is that is that correct and that and and so this so this ensures that you're able to always get the correct buffer size and that you're never kind of running out of bounds with that would that be yeah yeah we were so we were talking about before we don't necessarily want you were talking about any multiple buffers and stuff you're gonna see here it looks like we use a couple buffers no noise noise buffer probably that's where we're gonna keep the noise current output buffer that's probably the thing that we're going to you know build and it's gonna be our output and then at the end of this well there's not a mix on this one but sometimes you build an output and then you have to mix it with the current buffer if you go up to where it says process block like to line three lines above where that is uh-huh this is what the da W is calling over and over and over right like 44 thousand times a second it's cleaning process block yes giving us it's giving us a buffer of incoming audio data and it's giving us MIDI messages that's what you see on 228 there yeah you don't always want to you can't always just change things in the buffer itself sometimes you meet other buffers so you change there's things over here and then you kind of mix them together stuff like that I see okay great so that's what noise buffer is current output buffer down there on 260 that's what those are okay great so so so yeah so just to so just to refresh people this process block is a high priority function that gets called as Aaron was saying 44100 times a minute I think that's kind of arguable how many times it gets second or 44100 a second but I think it's arguable how many times it gets called but around that much so basically the idea is that this is getting called a lot faster than any of your other any of your other methods that you know that you have that you have yeah one thing you never ever want to do is reallocating when you can avoid it yeah why down there where it says before set sighs it's gonna make that buffer bigger if it has to be where does false true true after that the third true tells juice to avoid reallocating you don't reallocate must be absolutely half to this thing should only ever get bigger yeah ever gets so we could we could have again we could fill a whole whole talk about that and this isn't necessarily the best way to do it but for our purposes it's fine yeah yeah exactly so so basically what Aaron is saying is that when you're when you're doing work within this process block that you don't want to do anything that's going to take an unexpected amount of time so so something like loading the file or also you don't want to do anything like putting any like sending any messages to the console you don't want to do that within your process blog so anything that you can take kind of a indeterminate amount of time to actually do you don't want to happen in the process block because what happens is that you can kind of cut your audio is processing at a very fast rate and it needs to be able to it needs to be able to call that buffer 44100 times a second so but if you come to a function where you're having to load a file and things are gonna have to wait then it could hold up your audio and then you end up with this has to be real time yeah we keep saying forty for one but it's not actually that's how many samples total so it's divided by whatever the buffer size is yeah thousands of times a second this thing's filled yeah okay great okay so so basically we have the process block this is the most important block where everything kind of happens okay where where shall we go to next go on down a little bit and we'll talk about the three algorithms and we don't need to get too deeply into this right but you were saying like what's step one what are we doing if we're building this step one we go to the we go to the audio process or we delete what's ever in there and we start looking around and saying you know what do we want to do mm what are we looks like we're adding in the noise first okay so the first thing we do is we're gonna clear out a noise buffer and we're gonna put something in there and it looks like we make sure it's limited to you know between zero and one we multiply it by the noise amount so that's what we're getting from the slider slider says I want no noise or I want you know full noise very loud the noise amount is in our case you know it's we're gonna get a decibel value and we're gonna convert it whatever okay currently it's set up to add the noise so it it takes as you can see there and it adds the noise that it creates to the buffer well the part that's commented out there it says multiply mode another thing we do right is you have a noise signal and you have your incoming audio you could multiply the two local mmhmm right sorry um so just these are the kinds of things this is how you this is how you manipulate the sound is by using long strings of numbers buffers or arrays in this case yeah and mixing them together multiplying multiplying them together or adding them together yeah I was I was just gonna touch in on a few kind of key things that I think are kind of important in here so as Aaron was saying so you have this J limit right here that's eliminating between 0 & 1 so as most of you probably already know the basically you have floating-point numbers that are coming that are giving your speakers instructions on how they need to move to recreate the sound of the audio and those floating-point numbers should be between 0 and 0.99 or you know just less than 1 so because if you if you go more of them if you go more than one then you're gonna get distortion so that's why you can't go above you can't go above 1 and so that's what that's what Aaron's doing there making sure that that's limited to 1 and then another thing that we want to key in on here is that you have a stereo output so you have two channels and so everything that you all the processing that you do you have to do on the Left speaker and the right speaker or channel 0 and channel 1 so you have to be able to process those separately okay okay so let's talk a little bit more about this a room for improvement right couple things in there you might notice it says array float noise equals get white noise here we're doing something we're going out and getting white noise and we're creating an array and filling it with this white noise you might say you just said a second ago not to allocate stuff and you would be absolutely right whip this up in like an hour the other day but if going over this the second time and we're saying okay we want to optimize this code you can do not want to be creating this array a thousand times a second it's been really that array called noise should live elsewhere and it should only be resized when necessary okay sorry so would you do that would you do that globally then and then just put it in the audio processor so just like the noise buffer lives in the audio processor um player the the noise array in the audio processor resize it on prepare to play method and then a quick safety check to make sure that it's the right size we don't want to be doing what I'm doing here which is creating it every single time yeah okay we limit it to zero and one that's a good you know to bring up this point that it needs to stay between zero and one but really we should make sure that get white noise always makes it between zero and one anyway and then we can get rid of this line and save a little time mm-hmm okay great cool okay so then here you're just taking the white noise and you're just outputting it you're just adding it to the audio that's coming in to that well to current output buffer yeah actually Oh guys Oh Tarek your output buffer okay so the thing that we're building that we're gonna mix in okay cool so okay let's go to this next part resampling so yeah so okay so we've got a we're writing audio to the output buffer here then okay so let's let's go through here so this is cycling through now the noise plus we kind of skimmed over but we also added the incoming signal so we have the incoming audio and we add noise to that and now what we're going to do is reduce the bit depth and reduce the weight so those are both done in here okay and where do you where do you find like okay let's say that we're just starting this from scratch where do you find the algorithm from where do you find where do you say okay what I need is I need a power function here well I guess I guess that's kind of common sense isn't it yeah kind of it's a little bit of both right I mean this is we don't need to go through all the all the steps here but right you can when you say what is the DSP algorithm for these kinds of things there's a couple of good sites out there for that music DSP I think it's dot-org mm wikipedia has a lot of these things on it mm-hmm a lot of them you can figure out a lot of them if you just read up on it and say okay what we have right now is 32-bit floats right so it's 32-bit means it's 32 of those ones and zeros right which means this number can be anything you know these infinitesimally differences in the number it can be any kind of number on the number scale what we want to do is quantize acidic it can't be all of those numbers so that can only be some of those numbers yeah right and the way we do that is by so this is bit-depth we found bit depth earlier if we want it to be you know made bits it's them or take the the easiest case right if it's gonna be two-bit sound mm-hmm two-bit sound there's only two of these ones and zeroes you know there's only gonna be four combinations right you know they're both once the boat zeros one zero or zero one so when you start thinking about that stuff you can go out on the internet and find how to make that happen or like you said a lot of times you can just figure it out yourself a lot of it is common sense you look at it you say total Q levels is you know how many how many levels do and how many different quantization levels well it's gonna be a power of two right how P owf is then power float use a floating number and they two and raise it to the power of whatever the dip bit depth is which will give us the total number of levels we want to use yeah then we take our incoming audio data which is the their data i hmm and we do a mod f mod f is this is the modulus operator write the remainder operator mm-hm the remainder operator gives us the value and a remainder of it something take our total quantization levels there and we do this tricky bit of math where we say okay well how many you know it's going to be the fifth quantization level and it's going to be a little bit above that and then we're going to throw out a little bit that's above that and just set it to the quantization level and this changes your 32 bit and a full spectrum full sound into 8-bit sound or 4-bit sound or whatever else yeah okay so and just to go through bit-depth really quick so this is something I've covered way back in kind of audio programming for beginners so typically you know when you're bouncing down a bit of audio from a DA WF like a 16-bit 16-bit bit depth or 24-bit bit depth and so this just as Aaron was saying it just refers to the number of positions so if you have so if you have this wave this kind of you know happening let's say it's a sine wave then basically you have all these points let's say it's one second long so you'd have 44,000 100 points at the sampling rate is 44100 so so you have 44100 values that are going this way and then the the bit depth refers to how many how many how many values you can use going up and up and down this way so vertically on the y-axis so basically what he was saying is that if you if you have two two-bit bit depth then that only gives you four four possibilities so you could be zero you could be at 1 you could be minus 1 and then is that right new spots in between right yeah here's your you know negative 1 to 1 is the full sound right you have these down with through what reducing the bit depth doesn't of being able to go anywhere it has to be just yeah specific spots so so it's gonna be a zero zero one it can only be a zero one minus one and I guess is zero again this is something there but that's that's the basic it's gonna be a little different than that but yes same idea with rate divide right this is another creative use of the modulus of the remainder operator yeah so we have our audio going like this through time and sometimes they call it a hold algorithm to on certain scents and things instead of instead of being able to just change continuously we say stay there for a minute where is it I now okay stay there for a minute now stay there for a minute so in this case we take whatever the index were at the sample number one sample number two sample number three e sample number four oh we know that we want to hold each sample for 10 spots or 15 spots or whatever else so we do this I the sample number modulus remainder operator of the rate divided and it says look if this is the fifteenth sample or the thirtieth sample or the 45th sample and we're cool make it you know let it through basically and if we're not go back to that 1:15 ago or five ago or three ago whatever it is and hold on to that sample and just repeat it so this rate divided just by changing one number we change how often we change samples as time moves yeah yeah yeah it also yeah go ahead good no that's the death and rate divider both basically modulus operators one if you think it a sound wave one on the x-axis one on the y-axis yeah so so what we're referring to here is just where when you have where you have quantization so what happens is that as you're moving through time as I said before you know you have 44100 values that are happening in one second and when when you're going from one value to another value it doesn't just go straight from that one value to the other value basically what happens is you have what's what's called a process is called sample-and-hold and this is what Aaron's referring to where basically what happens is that it kind of holds that value and it kind of steps to the next it kind of steps to the next value and so what he's doing here what the quantization is he's able to adjust the amount of time that you can kind of hold that that value is that would that be a fair statement yeah when you stay right there for a minute and then you jump to the next one okay great okay and then you're just doing the basically the same thing here copying it to yeah so the buffer that we were handed by the DA is this one that's just called buffer that's our final output okay this two I should another point of improvement right the the astute listener might notice yeah current output buffer here we're like building everything onto this current output buffer and then we just copy it over to the buffer okay we could just be building it on the buffer there's no reason that we need to have a second buffer here so if we wanted to again optimize and we probably get rid of our current output buffer and just use buffer everywhere the reason it's like the reason it's like this now um is that initially I was going to put in or I copied this from somewhere where I have a mix so you go from wet to dry mm-hmm and if you have a nought if you have that set up where you're gonna want to go from what to dry you're gonna want the dry throughput so you want to hold on to the buffer yeah and not do anything to it and then copy it to somewhere mangle it and then you can mix it at the end in this case we're not actually mixing it so it wouldn't matter let's go back to the to the white noise is real quick to just while we were talking about our rhythms okay so you notice it just says get white noise this is the first thing we were looking at at the very top and just to talk for a second about the finding algorithms again if we think you know when I was first doing noise I thought about this I was like well just grab a random number mean grab random numbers and throw in there and you get noise yeah but then you you google around a little bit and you find out oh that's not going to be you know white noise or it's not going to be Gaussian distribution of pink noise there's different types of noise right which one do I really want to use mm-hmm and you'll notice that the get white noise algorithm I think it's at the very top I think I would click through there we go yeah there you go so get simple noise above it is the one I did first okay just grabbing a random number so yes you know if your users wanted to experiment you could enable that instead and see what what simple noise sounds like instead of white noise and then googling around to see what white noise is you quit pretty quickly come upon these kind of like those Gaussian noise and there's a particular algorithm for getting it called the Box Muller method which you see just down below there at the bottom ears yeah so I included this link video page you'll notice this is copied straight from there right we copy it exactly you change a few things then so many algorithms are like this there's so many things that with just a little bit of searching you can figure out and it looks you know real complicated math but then you get down to the bottom and it makes a lot of sense ya know a lot of these things are not as as hard to figure out as they seem like they would be at first you know you got to wrap your head around them a little bit yeah but then they end up being pretty easily accessible online so yeah that's part of the reason I wanted to share this one is because it is fairly simple algorithms mmm and it's it's fairly easy to see where you get them it's fairly easy to talk about what they do yeah so so you don't have to be a math professor too because because you know as you can see you know some of these some of these algorithms they have the implementation right there so it's just really kind of plugging it in and then just being able to kind of understand the basic gist of kind of what's going on and then adapting it to your code and plugging it in no need to kind of reinvent the wheel you know and you know come up with a super you know something something new that nobody's ever done I mean you know experiment experiment around and stuff you know like that's important but you know I'm talking more to people that are really trying to kind of get off the ground you know trying to build their first but bit crusher or build their first effect plug-in you know more than people that are working for like Universal Audio trying to do like analog modeling so on and so forth most of the innovation and stuff like this doesn't come from like you're not gonna sit here I mean maybe you aren't maybe you're a genius math whiz and you'll come up with some brand new scheme to manipulate audio yeah most people and most of the most of the really creative amazing stuff you can do out there is combinations of known methods yeah so you look at this and you say that's a pretty good bit crusher but what if we what if we resample before we add the noise or what if we filter the noise before we resample or what if we multiply instead it add yeah and always things like that you have so many possibilities in that you know you can't find all of them out there so it's it's not so hard to come up with a plug-in that does doesn't do algorithms that nobody has ever done but kind of combines them in ways that they haven't been mined before exactly exactly I see so many people that are really I think almost like trying too hard sometimes you know like you don't have to you know be like Stephen Hawking to like build an effective nice plugin you know that works like like Aaron was saying sometimes it's about taking two existing methods and combining those in a way that that is interesting and that has a really kind of interesting texture to it rather than trying to build something completely from scratch so cool awesome okay so part of me so say so okay cool where show where shall we go next so we have this this Moeller method that was pretty much just adapted from the Wikipedia article and yeah then you saw the way that it was implemented in the process block so let's go back down here so have I missed it oh yeah right there so it's just the game yes right here so there we go okay that seems pretty straightforward what else what else should we go where should we go next is that is that pretty much everything 15 minutes but yeah we've gone through all the DSP stuff and yeah philosophical a little bit yeah the joys of audio programming and pains and pains great how long did this take you to build would you say I mean this was a couple hours but I had something to start from two so I copied and pasted big crusher code and then I paired it down and changed a bunch of little things and like I said it's nowhere near perfect you've got a few different places there were we're allocating arrays and everything else which is slower than you want or four but it's a good prototype yeah prototype to build off of good things for people to learn and that's what I wanted to do was give you a fairly simple example of of a audio plug-in and one that does something pretty cool you know a lot of people like the kind of manglers and the noise creators and all that sort of stuff absolutely and for people this let's say that you know some people are looking at this they aren't sure about what what cosine or sine what epsilon is would you what would you say is like the would you just say it's more kind of linear algebra linear it be more linear algebra wouldn't it that would really be the way to go for people that are looking kind of pick up but I mean there's there's some there's calculus in there too you know sine and cosine er yeah tell Jo its function is more or less but yeah or geometric I guess trigonometric yeah yeah tricking of this stuff does get very heavy math wise yeah yeah you should know what sine cosine like there's a logarithm in there too so you might say well what is what is that what does that mean yeah and those are those are things that you just have to not be afraid to learn if you don't know them yeah yeah so you know trigga metric functions like sine cosine tangent you should also know about imaginary imaginary numbers complex numbers that's a good that's a good place to look as well Khan Academy is a great place to start learning about those sort of things so so yeah it is important to to understand the basics of what's going on here and you get a better understanding as you can kind of learn about these things let's see should should we should we delve into the editor real quick or shall we shall we wait till next time for that one well why don't I show you like I said I gotta hop off in about ten minutes but why don't I show you the connection we'll talk for a minute about because there's four other people who are looking at this and they saw the UI and they see the DSP but they're wondering but how are those two connected mm-hmm okay all of the audio parameters on all the juice audio audio processors excuse me have parameters right just like in the DI W when you start one up and then there's there's those parameters on there and you're like where do these where do these come from and if you go to the header plug in processor header okay there you go those are three parameters noise amount rate reduction bit reduction yeah in this case I they're their bit crush parameters so obviously it's custom this is something we made so click on that let's see what that class is okay okay and it derives from audio processor parameter so it's taking a generic juice class and then I'm you know overriding a few things are changing a few things these are fairly simple value objects that you have you know what's my current value what's my name in this case what's the default value maybe of this this object okay and then take a look in the editor real quick and I'll show you how these get linked to the header file or yeah or either one so there's slider yeah in header you've got three sliders so we created a bit reduction or a reduction and a noise slider and then in the CPP in the constructor you can see here we are creating creating the sliders and and what do we do and oh okay yeah so we're not even linking the the value object on a deep level just we add the listeners so a pattern that that you're familiar with I know and a lot of your a lot of your listeners are is the this observer pattern where you set up a listener and you say okay this thing is going to listen for changes over here yes what's going on here whatever the slider changes so we kind of trace this in the UI somebody moves the slider and it's gonna go down to slider value changed which is them like a lot of slider value changed you know which slider is that oh it's the noise slider well then change the parameter right yeah in this case get parameter number zero which we happen to know his noise now we should have some sort of Inu whom or something smart about it so that it knows that we're getting you know just get the noise parameter that kind of thing but yeah for the purposes of a prototype we just say slider parameter number zero we know is his noise so it changes it yeah right I was gonna say I was gonna say a way that people maybe a little bit more familiar with from the videos maybe using the audio processor value tree state which is another way that you can that you can that you can use this as well which will give you instead of instead of giving you just a the index of the parameter it could actually give you like the name so right where it yeah so what what Aaron's say you put together this a key thing who's running this thing anyway the so like aaron was saying so this is where where your value from your slider actually links to the value on the processor side so you got processor value zero that will link to noise the parameter that controls the noise in the processor so if you go if you go quickly back to the processor to the process block method yeah I think it's oh no actually go there should be a value changed do we do it value changed yeah let's see if we do that mmm seen okay good it's probably in the process block okay look take a look at the process block what am i doing there yeah there we go um yeah and if you scroll down just a little bit this gives us back to where we were the first thing we were talking about more or less very noise amount bit depth and rate divide that declared as as floats so the noise amount is conditioned the other two are not right so the bit depth rate divided whatever the value that's in the slider it just takes that value turns it into an int in this case or loan for the bit yeah and then noise amount it's scaling it - what's it doing there zero to one as 120 so noise amount probably goes from zero to 100 because it's in percentage and those are going to scale that from negative 120 to zero then you want decibels yeah and then as you can see noise amount it's limited to just below we're just below there noise amount is limited negative 120 to 0 and then decibels to gain takes a decibel value negative 60 decibels or whatever turns it into an actual game so point zero zero zero one mm-hmm or or something like that and then we can use that and to multiply how much noise is coming through that sort of thing so anyway that's it there quick sum up of how we get stuff from the UI into the process block in this case and then those values as we've already talked about are used in the various in the three different algorithms for awesome man well I know you've got to get going I'm gonna stop the share here there so we go back here now and yeah really big things for for sharing that with us and as I said I'm going to put Aaron's code up on up on the github for you to download and to check out and hopefully you'll gain some things from it and what what I would do is I would actually just start up a new fresh project you know maybe have Aaron's project right alongside right alongside this new project and then just start kind of going through things and then as you come up to parts that you're not quite sure about you know that's the point where you can kind of go back and you can start researching and looking into okay well what does that particular thing do or what does it how does it change if I do this other thing what does this piece of code particularly mean how does it how does it kind of apply here and basically take it from there so once again thanks a lot Aaron and then I really really appreciate you taking the time I know you're really super busy sometimes I just take my time yeah man and you know I'd love to have you on the show again and stuff and you know we can we can maybe make this a regular thing or something let's find some other interesting piece of code to talk about yeah that would be awesome man cool all right thanks a lot yep
Info
Channel: The Audio Programmer
Views: 2,609
Rating: undefined out of 5
Keywords: juce framework, c++, audio, tutorial, audio programming, creative programming, creative coding, dsp, digital signal processing, vst, create vst, create plugin, audio plugin, oscillator, synthesizer, maximilian, openframeworks, software development, beginner, easy, max msp, bitcrusher, downsample, distortion, code, juce, plugin tutorial
Id: 1PLn8IAKEb4
Channel Id: undefined
Length: 48min 0sec (2880 seconds)
Published: Thu Jun 28 2018
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.