Ian Hobson (Independent) - Rusty Grains (Granular Synthesis in Rust)

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
yeah so our next speaker is um ian hopson hello ian are you here hello yeah so um yeah so thanks francesco for this talk so we talked already about i guess several programming languages already um but this is a programming language special so we're going to talk about more programming languages and the next one um is going to be rust so yeah and obviously um so first of all you're a former dsp principal ableton now you're independent developer but also i remember you've given several talks at adc so you're kind of a regular speaker there and the last talk i remember from you which i think was in 2018 was about rust and how to use that for audio and i think at the time i was really excited about that because no one was really using rust for audio as far as i was aware um at the time or at least not in a way that the community would be aware of and you kind of gave a talk about how to do that and i found that very interesting obviously that was several years ago so things have changed since then so um you're still doing rats and um yeah we're looking forward to hearing where we are with rust in audio tonight um from you so welcome ian great yeah uh well yeah thank you and thank you for inviting me to do this i i i appreciate it it's a fun thing to do i'm happy to be here um sorry i share my screen right yeah let's see do i do this yeah yeah so um as timo mentioned uh i gave this talk at uh adc uh a couple of years ago um and that's really my whole connection with rust i i'm not like uh a big contributor in the community or i haven't uh like released some like large projects uh in rust but my my background really was uh one of curiosity uh over several years following the rust project and seeing it develop uh and to become what i i thought could well be a a viable alternative to c plus plus for uh real-time audio development because for a long time it really felt like c plus plus was the only choice that we had um yeah so anyway i mean i was introduced today so i can skip over uh this and also yeah the the talk was called an introduction to rust audio developers and you can go and look it up on youtube if uh if you haven't seen it and you're interested in rust in the context of audio i'm going to skip over a lot of the introductory material i'd say like normally in a a rust talk maybe i'll go through a few of the basics but we only have 30 minutes so i want to kind of try and dig a bit deeper uh into into the language and uh also yeah look like tmo mentioned maybe give an update about what's changed since uh uh i gave this talk in 2018 so one thing that's changed is that we've seen a lot more uh industry adoption so large companies are paying attention to russ now in in increasing numbers and uh like it's quite amazing to see how quickly this is happening actually um and one of the the key things that's come out of this there are several uh reports where large companies have looked at all of the uh security issues that have been found in their software projects and a consistent number that pops up in these reports is that 70 of the bugs uh security bugs are related to memory safety and uh the memory safety being the kinds of uh like uh errors in handling memory that uh crop up uh quite often when you're writing c or c plus plus code where uh maybe you're accessing memory out of uh outside of the range which you think that you should be in or maybe you're accessing a an object which is being deleted or well there are all kinds of uh ways you can make mistakes and uh yeah it's a pretty like uh consistent finding uh that has popped up so far uh and something that is really important to uh take away uh from looking at rust is that there are whole classes of bugs which are impossible to write if you're working in safe rust and that's uh really the the key uh differentiator from rust to other systems languages that uh came before and you might be thinking well who cares about security because we're dealing with audio development and uh maybe uh this doesn't matter so much to us but um ethics aside of uh being sloppy about security um actually the kinds of bugs that we're talking about come up again and again when you're working on audio algorithms or at least they have in my experience where i'm running into these types of errors maybe you spend a few hours debugging something really hairy and it turns out that an object wasn't initialized correctly or maybe you know there's some undefined behavior and then the debugging experience is inconsistent and uh those kinds of uh bugs are uh not so much fun to to deal with and to debug now uh another thing that has developed since 2018 is has that is that rust has continued its run as the voted most loved language in the stack overflow developer survey so that's five years in a row that people have taken this survey and voted for us as like most loved and i it's a bit of a like a strange thing to to point to i think but it's interesting to me because it speaks to this uh idea that uh you can actually love a language i i find that quite interesting or that uh if if maybe we uh like uh scale back the the term like maybe love is a bit strong but like this this kind of emotional connection that you get to the tools that you use i find very interesting and uh what does it really mean to to for people to be like uh claiming that they feel this way or declaring that they feel this way um and so then i started thinking well what is it that i see in this language that i i feel that strongly about and i'm not sure if i would say i i love rust at this point but i you know maybe we're not at that stage of the relationship yet but i really enjoy using the language and at this point i'm i'm using it full time so since uh uh leaving uh my my work at ableton last year i've been able to like use rust as my primary language in in all of my work and so it's been a good run of like 10 months now or so where i'm using rust full time and also i've actually managed to get some uh audio analysis code like real-time code uh shipping uh with low felt uh as part of the ios sdk which i guess you'll hear more about later from neil so to highlight some of the uh aspects of rust that i like um i wanted to connect uh some of the ideas to a project that i've been working on it's an old project that i dusted off it's a granular synthesis engine and let's see if i can get it running and maybe turn up the right maybe you can hear this so granular synthesis of course is where you take lots of slices of sounds very short slices from uh like a larger sound and then you uh you window them and you string them together to create uh like time stretching effects or drone-like effects you can do lots of fun things with it and it's a really good engineering exercise so if you haven't implemented a granular synthesis engine before i would highly recommend it because it's a good fun thing to to implement anyway you can mess around with it and find sounds and play around [Music] so good times with granular synthesis um oh yeah and here's an illustration of what's going on you have a larger sound buffer and then you take short slices smooth them out and string them together so you have lots of overlapping grains to produce these larger effects and uh yeah i uh borrowed this from the internet you can find it here so that gives us some context for uh some things that i uh really like about rust if we or even love and the first one i want to talk about is the ergonomics of the language um in particular rust enums and pattern matching as a core language feature i think are a really useful uh pleasant thing to use like in your day-to-day code and one that you'll encounter a lot in rust is the result enum and what you'll see here is that there are two variants in the enum and these enums both have a value attached to them so this is a lot like uh stood variant in c plus it's essentially the same concept um but as a as a core language feature so when you call a function which may succeed or not it will return a value and that value could either be an okay value of type t or it can be an error of type e and so then when uh you're using functions in rust or a library uh often it will be written with this result type as the the primary uh mechanism for reporting success or failure and in the granule synthesis engine we need to load lots of sounds from disk and a load sample function is the the main entry point for this happening um it returns a result and the result is either a vec a vector or a dynamic array of stereo frames so we're going to create a stereo sample of a particular format and in the error case we're returning a string which will have some information about what went wrong and inside the function we're calling an open function on wave reader and we'll come to that later passing the path and if it was successful in opening the path then we get a reader as the okay return value and unpacking the reader is achieved by using the match keyword and so match on some enum type or well match on any value that can be matched against and it's not just enums but for for now we'll just deal with enums you you get the ok value or the error value and then you're able to work with the contents of you know that particular value type now this is of course uh possible in c plus plus and other languages uh i'm not like making a claim that unique uh rust is particularly unique here it's just that i find the the fact that it's baked into the language uh so uh so deeply and from the very early stages of the language that it has a very nice clean uh syntax to it and it becomes very natural to use this style of uh uh coding like uh regularly all the time you end up using it a lot and that means that it's uh like second nature to use this uh as a tool so then another example of matching here is that to load the sample we want to convert the source material to a particular format and what we need to do is look at the the number of channels in the sound the the the the bit depth of the sound and the sample rate and then oh well not separate sample format sorry whether it's an inter afloat and then uh call the correct uh conversion function based on the contents of the sound and being able to just say match on those three values and then like here are the cases that we can handle and then there's a fallback for the cases that we can't handle uh is is very pleasant to use and i really enjoy like this style of programming things that i love about russ number two so cargo is the standard entry point for your project it's the main tool that you're using uh when you're dealing with rust it's the build system it's the dependency manager it's the the the command you use when you want to run tests or open your documentation it's a really powerful tool and the fact that it's the standard tool that's used uh by default when you're you're dealing with a rust project means that you you get very familiar with it and everyone else in the in the community and ecosystem is very familiar with it so it's it's really nice that this is the the default thing that uh is available uh uh from the start so if you're looking for a library to integrate into your project so for example we need a a wav decoder um there are a a collection of libraries out there that do web decoding you can quickly find uh one of those libraries um just by a simple search on the command line or you can go to the website and then you can see all the links to the github repos etc and you can audit like find it find a project that you think would work for you and then adding it to your project is trivially easy so you just list it as a dependency uh in your cargo.tml file which is your you know your project settings and that one liner will cause cargo to download that version of the software compile it make it available in your project and then in our load sample function wav reader is coming from a use statement we're saying use hound wave reader and that's literally all you have to do to integrate uh like this really nice library into your project things that i love about rust number three um yeah so traits are um this uh like core concept and rust of how you define interfaces for different types and they're used for both compile time generic interfaces like uh c plus plus 20's concepts and they're also used for runtime interfaces like uh virtual based classes in in c plus plus so it's the same concept for for both types of behavior which is quite neat and an example of how they look uh so in in the in the in the engine in the granular engine there's a lot of linear interpolation going on so we have a lerp function and here it's implemented just for floats so f32 is the 32-bit float type and we have a and b as values and we want to interpolate between them with an x factor and uh that equation works out uh to give you linear interpolation between a and b and that's nice but it only works for floats if you want to make it generic in rust it's very similar to c plus in that you use angle syntax and then you have types that are available through your function and we're going to take a and b as types t and then have a separate type well that's a type that should be x a separate type for um the the interpolation factor and that allows you to have your custom types uh but then have a scalar value for interpolation which is quite useful um and then in a generic uh context you where uh you're making use of the types so in this case we're performing arithmetic operations on the types you need to spell out uh uh in the in the function in the context of where the types are defined what traits you expect those types to implement now it could be that t implements many other traits it doesn't have to only implement these traits but it at least will have implementations for these traits and you say that t can be added to itself so the ad trait like 4t the sub trait fatigue that's subtraction mole here we're saying that we need to be able to multiply a t by an x and then receive a t as an output and that's what you see here b minus a and the interpolation gives you the range size and then you multiply it by the interpolation factor and that that b minus a would give you you know your t type and x would be the interpolation factor plus copy uh which maybe is a detail we don't need to go into but we do need to be able to copy a in this context so we have to tell rust that we need to be able to copy this value now the value type that we're most interested in interpolating in this engine is a a stereo frame and that's because we have left and right channels for our grains and uh we're going to perform the same operations on both the left and the right channels uh all the way through the pipeline so we read a sample sorry a frame from uh the the audio data in memory we read uh a couple of samples out we interpolate between them to get our interpolated uh readout then we're uh well what are we doing now we're windowing the data and we're mixing between two different sounds and then we're applying panning and and gain and then we're mixing all of these gains together and all of these operations can happen at the same time on the left and right channels we don't have to spell out these operations on left and right independently and we can achieve that by having this stereo frame type and it's declared as a wrapper for an array of two floats uh we don't need to go into uh the details of this syntax but it's there really we're declaring the stereo frame as a rapper type or a new type in in in rust terms and here derive the attribute this is a an attribute which tells the compiler to automatically derive implementations of these three traits for the stereo frame type so we get implementations of clone copy and default and uh i included defaults here because it's useful to see that default now is available as a method or a function on stereo frame so these traits aren't just about arithmetic operations or operators they're about all kinds of behavior including you know functions if you want to go further with this and implement other traits that maybe can't be derived by derived automatically then you can implement that trait using this kind of expression where you say implement ad for stereo frame and then you you explain to uh the compiler how to fulfill the interface of that trait and here we're saying that the output itself and this is short short uh shorthand for the type that you're implementing so this is stereo frame and we're implementing a function which is add and we're going to take we're going to get self which is an instance of uh well it's a copy of this value it's like the this pointer in c plus plus and we receive another uh instance of stereo frame and then we're going to add the two inner values together so zero here is the inner value which is the array and they get added together and we end up with an added stereo frame the same applies for subtract and multiply really only difference here is the the operator that's used the operator is already available for the array type and the maybe more interesting case is the scalar multiplication here we declare that we're implementing multiply of f32 for stereo frame and so then here the uh the other type is f32 and in this case we need to access the two uh channel elements independently and then multiply those together to produce our inner array now that's everything that we need to be able to use lerp with the stereo frame type we now well i've added here an implementation uh which isn't attached to a trait but is attached to the type itself so now i'm adding a new method with a function which is an idiomatic initializer uh function for uh well in rust you you generally implement a new function and that allows us to show that lerp actually works here we have uh one and two as our a value and two and three is our b value and then we interpolate by half and and you'll get values halfway in between for each channel now you might be thinking there's a lot of parallel operations happening here on left and right channels this could be a good opportunity for cmd optimization and you're right um and it it is maybe useful to talk about cindy uh in the context of what's changed since 2018 because in 2018 uh there were x86 intrinsics got stabilized and it looked like there was a good progress towards stabilizing a high level abstraction over those intrinsics but that effort stalled a new uh a new effort is is happening now to try and get some more uh of more cindy functionality into the standard library but that's underway and there's a lot of problems to figure out there and people are working on it um however if all you need is simple arithmetic on f32s and you're happy with x86 intrinsics which i am then there is a library called wide which offers a a simple uh pack of four f-32s as a cindy type with uh implementations of all of the arithmetic traits wrapping the underlying intrinsics so the plus operation maps to the underlying intrinsic ad for for f32s and then making use of that uh i mean instead of our array here that we're wrapping we're instead wrapping an f32x4 and then in our new initializer we're putting our left and right channels into the first and second elements and then we're just zeroing three and four because uh we only uh in in this case care about two channels then the implementations of the traits all uh come for free except for the scalar multiplication because uh the authors of f32x4 didn't add a scalar multiplier but that's okay it's easy to implement ourselves uh just by changing the implementation of the scalar multiplier to take the scalar factor and then construct an f32x4 from it then that's everything that we need to have a simplified pipeline because we're using stereo frames all the way through the like the the grain processing and then into like the mixing of the grains uh we end up with like cindy pretty much all the way and then that results in a about a 30 speed up which is nice and i wanted to highlight this because i think the the clean nature of how the traits are designed and they're very clear clearly expressed and easy to implement means that you're encouraged to create these kinds of abstractions so really for me achieving simplification of the the processing pipeline uh with a very small number of code changes was like a nice surprise and that for me really fell out of just the the nature of uh the the design of traits number four now i'm not sure how i'm doing for time but i'll try and speed up a bit um the ecosystem in rust is really nice i think the fact that you have this standardized way of sharing packages means that there is a lot of sharing happening and there are lots of libraries out there and what i've seen in the last couple of years is that the quality of these libraries is increasing uh rapidly and there are some really amazing projects uh popping up now um and particularly cpal for audio uh it had a lot of effort put on it in the last put into it in the last year and this is a a solid uh nicely done audio library like rt audio port audio and i i integrated that into this project really easily the asp is a nice emerging collection of useful dsp utilities it's well worth checking out midiar just worked a nice cross-platform midi library for real-time input and then w midi for like midi types crossbeam makes uh uh cross-thread communication and rust really easy so cross-beam channel there's a sub-crate and i'm using that for midi to audio and audio to ui communication and it just works really well and criterion is worth looking at if you're interested in benchmarking it's a nice statistical benchmarking framework so the last thing i want to mention about rust is uh the the feeling that i get uh with the rust safety net and i the i completely accept that the strictness of the compiler uh takes a bit of getting used to it's it is pretty strict and especially if you're coming from c or c plus plus you might find uh like this this feeling of banging your head against the borough checker this is something that uh like you i i felt certainly at the beginning and often it comes from trying to apply a pattern that you would think works in c plus plus and maybe it does work but you aren't be able to prove to the compiler uh that it can work safely like maybe it only works by chance or because you've thought about it carefully but maybe you've made some mistakes and you don't know which is where these uh these security bugs come from uh and i describe the the feeling of it as uh like having a couple of like expert engineers looking over your shoulder as you're coding and uh like telling you don't do that like uh you you don't want to do that or have you thought about this or you know it's this um sense that you've got uh like experts with best practices pretty well thought through um in the compiler and that might sound daunting at first or or maybe even like oppressive or something but i i i think that once you get used to the rust way of working and you get used to the the tools that are available to you and you you find your uh your feet a bit in the system in in the in the language then uh for me i found that uh it's really quite liberating because once you uh have like a good sense of how to achieve the the high level goals of your of your project then you don't have to worry so much about the low level details the like the good uh well-designed architecture kind of emerges naturally if you if you follow the the path of least resistance and then when you do need to worry about the low level like if you're if you're optimizing or if you're if you're uh taking care of some very specific functionality then you can zoom in and and then really care about those low level details but the fact that you're able to shift levels of abstraction uh for me like seems quite natural now that i'm more experienced with rust and uh in the end i think the this idea that it uh like there's friction to the bora chakra actually for me it i find that in the long run it reduces friction and uh that's uh worth pointing out i think so then in conclusion what am i saying i'm saying that i i feel different when i use rust or i programming rust than when i'm programming in c plus and uh the the the sense i have is that it's a more pleasant language to work in for me and that's not going to be true for everybody and for some people c plus plus is a natural language for them and if you love c plus that's great and i i would wouldn't want to uh change that and i wouldn't suggest uh changing it at all it's it's fine and if if you're comfortable in that environment then that's great but it's we're at the point now where alternatives are available and uh it could be that rust is the one for you and it's worth looking into but yeah so the theme of the night is alternatives and uh they do exist now so that's all i wanted to say and uh if you want to uh reach out to me at all then you can find me at uh on twitter or github and uh you're like if you've got any questions about russ just hit me up i'm really happy to uh like answer questions and uh anything you want to talk about just let me know okay so that's that's that's it for me thank you very much ian yeah thanks yeah um yeah actually i have to say like specifically one thing that you said i was i was you know i'm one of those people who are basically naturals in c plus plus i guess because that's what i've been doing on my career but i wish i had experts looking over my shoulder checking things like dangling references and things like that so that actually would be great um yeah i do have one question actually so what i hear um about rust from from other people and particularly people who do like doors and plugins and and these kind of things is that you mentioned we have quite a few libraries now available in rust um but um what people say they're kind of missing before rust becomes like a really viable alternative to them is like something like cute or juice which is like an application framework which brings all the gui tools and all the other ancillary tools around it in one package to put together an app and even more so if you're doing plugins you need something like juice which also gives you all the wrappers for you know vst and audio unit and ax and before we have that we can't really in this particular sub industry i would say of the audio industry we can't really use it like at all um but maybe we're missing something so what's your opinion on that uh well i think you're right that rust uh doesn't have yet a large scale application framework like like juice or cute that that that measures up against those those frameworks at all i mean they're pretty mature and long-running projects and rust doesn't have anything like that um that said there are projects that are emerging in different different domains so like uh game engines are emerging which are starting to look more and more attractive and uh like i think it's only a matter of time before uh the people who get invested in audio and rust will start to build out the the tools that you need to uh get a full stack of utilities that you need right like it's only a matter of time i think however you something that i showed in the adc talk was that if you did want to uh go down the road of having those expert engineers on your shoulder uh applying best practices to your your audio engine for an audio project you could still use juice as your application framework and then hook into rust fire the the like c bindings which is something i showed in the talk you you're able to compile rust code with a c interface and then make use of that in any other uh application that would accept c code great so i have a load of questions here and uh if you've answered any of these in here already please just let me know because i was just concentrating so much on the questions so there's a comment from cass cassette who says the pattern matching reminds me of scala do you have any comments on that do you know about anything about scum yeah so it it yeah the the designers of rust had a a lot of functional programming in their background and i think ml is one that's cited quite regularly and and you'll see similar patterns in in lots of functional languages uh that's that's definitely a a big influence i'm not sure if scala specifically but those kinds of ideas of how to deal with values it pops up a lot in different functional languages okay great james bradbury asks what is the worst part of coding with rust compared to other languages i'd be interested in knowing the pain points you have had either in practice or conceptually yeah i think uh so the the the immaturity of some important libraries has been touched on already so it would be great if uh if we did have juice for rust that would be lovely the two main gripes i have at the moment are compile times and what i'm finding is that actually rust doesn't compile slowly it's not a slow language to compile uh by a default what you get though is that there are important libraries in the ecosystem which use procedural macros which can then have explosive effects on your compile time so you'll find that lots of projects take a minute or two to compile and that's because they're using specific libraries that use specific features and if you're careful about the way you construct your project then you don't have to have slow compile times so i i i my wish for uh the community over the next few years is that there's a big effort to try and uh uh avoid these like really slow features i mean it's like in c plus plus with template meta programming you can get um like uh constructions in your code that cause the compiler to uh lose its mind and um the same kind of thing is happening in rust i think okay great and i think we've addressed this question a bit but uh and there was one that was mentioned in the chat already but jose asks if there are any good libraries that you know of to start experimenting with rust audio applications yeah i would recommend checking out nanu and it's about n-a-n-n-o-u it's a creative coding framework which is similar in nature to open frameworks or cinder and it's really nicely put together and lots of great examples to work from and it has a simple audio abstraction which is based on top of cpal um so it's uh yeah you can hook into an audio callback and get some audio going with a good graphical environment to play around with as well great and guilio moro asks do traits have to be specified can it not infer them from the code so it could but then you would have the same problem that you have in c plus pre-concepts where you uh maybe you have a very long function that's generic and then 50 lines in to the function there's an operation that needs to be performed with your generic type that then causes a compiler error and then you end up in a difficult situation where you're trying to figure out what went wrong and what's much cleaner is that before any attempt is made to compile the function uh the the contract is checked and if your types match the these this interface then the compiler will continue if not then you get a really good clear error message explaining why exactly uh your function won't compile i'll see okay great and i think you i think this was more or less the point of your presentation but uh let me see if you have any other thoughts uh stegen asks uh if there was anything that you that eventually made you decide to go with rust for full-time development and what were what took away some of the final doubts um so i i think the yeah a lot of the the things that i mentioned uh really have attracted me to rust that there's a lot more that i could talk about but uh obviously we're we're sure it's on time okay um i think if if i was um i don't know like if i was working in a different area like if i didn't have like freedom to choose exactly what i work on then uh maybe i would be making more pragmatic choices so if if i was starting a plug-in company today maybe it's very likely that i'd be using juice and then maybe i would make a choice about whether or not to use rust for audio or some parts of the stack but also maybe in the end we would take a pragmatic choice to stick with c plus plus there and and that would be sensible and and probably wise um but because i i'm at a point in my career where i can uh try out a few different things it seems to me that rust has a very strong future ahead of it and i'm quite happy to be um engaging with it for now like great um another question from gwylio uh what guarantees does rust make as to memory allocation and in general real time safety yeah it doesn't have a garbage collector which is one of the main things that made it attractive to me in the first place and i i for some reason have a difficulty with languages like like d where uh the the core of the language was designed around uh having a garbage collector in place and this might be completely unfair and i i don't know if it's like a valid uh like concern but it what really um like turned the lights on for me uh with rust was that this was uh something that they made a choice on very early on uh that they wouldn't have garbage collection um so then the the guarantees i mean as far as i know uh they're essentially the same as in c or c plus plus you have a um like i think it uses the system allocator by default and i i didn't know we had lights in here i've been in the dark the whole time um yeah it's basically the same and then you can override the allocator so if you want to have a custom specific allocator with specific properties then you're able to do that if you need if you want great and i think you might might have addressed this a little bit as well in your presentation but uh what control do you have on memory copy when passing arguments into a function uh i.e passing by reference or pointer versus passing by value yeah that's something i didn't uh touch on which is that rust is moved by default okay so when you pass a value in it it is moved if you implement copy on that value then it will make a copy um if that would be a problem then you pass by reference and and there it's essentially point to semantics except for the strictness of the rust system where you can only have one mutable reference at a time you can have as many immutable references as you like so you can share data around as much as you like in your system as long as it doesn't change and if you need to change it then you have to have the only reference to that data okay and there's a question from studio six plus one with the stringency of rust does that mean that rust no longer requires any sanitizers well now i i don't know if i would go that far if you if you have a safe only project then maybe that's enough if you're using third-party libraries maybe those libraries use unsafe internally and they might claim to have a safe abstraction over the unsafe code but maybe you're in a position where you don't want to trust them and then maybe you would want to throw all of your analysis tools at that library as you can i don't know i i haven't ended up in that situation but there is an aspect to the unsafe versus safe um uh concept where you have to trust the unsafe code and in the case of like the standard library code obviously this has been thoroughly vetted and you can trust that it's correctly written but in the case of third-party dependencies you have to be cautious great so spencer asks and i think you've covered this uh how is rust ecosystem support for building cross-platform uis that's one of the weak points of rust at the moment is that yeah yeah there are a few projects that are active that are trying to build a nice ui system uh for rust and there are yeah there are a few around that uh that you could look at the it seems that most uh projects will uh end up using gtk or qt so there are there are rappers for rust for cute or for the gtk and i think that's what people would normally use but the way i i so i haven't thought about this in a while before i was thinking it would maybe make more sense if you have an application framework to instead of try instead of trying to fit that application framework into rust you would do it the other way around so you would have a cute application or a juice application and then you would use rust as a library that you would pull in so then you have your full featured ui framework but you're using rust in specific areas where you think it makes sense great and we have one more question i think you've your presentation for addressed this pretty well but any other comments uh what do you feel the need is a requirement for an alternate uh audio programming language what functionality does c plus plus lack that other languages offer such as rust yeah the i mean the only thing that c plus lags uh is the the guarantees about memory safety i mean otherwise it's like a fully powerful language right it and within that you can create all kinds of libraries and frameworks that fit the uh like the the domain that you're working in and build up something that makes sense for you uh so i don't think c plus plus lacks anything other than uh it's very easy to make mistakes and if you want to go deep into the language and become an expert in it then uh you're going down a path of learning the standard which will be appropriate for some people but not appropriate for many others and then you're working within a subset of the language and if you're in a good framework like like juice is an example where if you're working within the scope of a particular framework and you you kind of play by those rules then maybe you're going to be fine and and you won't have the kinds of problems that uh maybe we're talking about okay great i guess we'll finish off with a one of my questions actually in terms of education because just looking at the syntax of rust from my perspective it looks very tough to me and i'm just curious from an education standpoint when you have a team and this would be a great question that maybe you and neil would probably be able to address in terms of education for developers and the threshold to get into something like audio development let's say in a perfect little world where a a a rust version of juice existed do you feel that this brings the threshold for getting into this type of development even higher or do you feel that that once we have a working frame audio framework that's on the same level as juice but a rust version that uh that this will actually make the threshold lower or the same do you have any comments on that um yeah my feeling is that uh rusted is a more teachable language than c plus plus i think the the concepts in the end are simpler uh there might be potentially a lower barrier to entry with c plus but not to writing c plus plus correctly like if you want to write c plus plus without making mistakes then i i think that's a harder like hill to climb i think i think if i was starting with a team of developers with no experience in say any systems language then personally i would rather teach them rust than c plus plus yeah just to interject i i really agree here like i on the one hand you know why we use superstars because we have all these libraries and frameworks but i would also not definitely recommend to um start with it it's just so hard and gets harder as it grows and i always make this joke that um you know cheaper is growing faster than the rate at which i'm learning it so i'm actually getting worse at c plus as the time progresses and i think that's very frightening to hear you saying that yeah and that's something as well that i think if if you're interested in um rust then you should just take a look like it's a good learning exercise and if you're going to be uh continuing to work in c plus plus whatever happens then then fine you you've you've uh learned a few things in in rust that will probably make you a better c plus plus developer great um okay i think oh we do have one more question from mark mossberg does rust have similar binary compatibility issues that c plus plus does yes it it does uh the there are uh discussions you can look at uh online about whether or not russ should have a stable api and it does not at this point and uh yeah i i mean i wish it did but they've decided at this point they're not going to commit to a stable api so uh you you really need to go down to um yeah like see bindings if you want to have like dynamic linked rust libraries
Info
Channel: The Audio Programmer
Views: 1,352
Rating: undefined out of 5
Keywords: Rust, rust audio, rust vst, juce, juce framework, audio development, granular synthesis
Id: Z4P5f6ZJ_nE
Channel Id: undefined
Length: 50min 42sec (3042 seconds)
Published: Tue Aug 25 2020
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.