 And let's get it on. I plan for 90 minutes, but I don't really have enough slides for 90 minutes. But depending on how many questions there are, we may finish early, maybe, but I'll do my best to at least not be too late. So this workshop is not about Faust-Pessier, but about the special topic of doing Faust plug-in programming. So it was my idea, well, usually I do the more academic or science-y stuff, as some of you might know, but it was my idea to do a real practical introduction to all the incantations that you need to get Faust compiled, something to plug in that's ready to use in your door. So there are basically two reasons for that. First, users want to know how to do it, because they maybe got a nice plug-in as a Faust code, and then they need to figure out how to compile it so that it works in their favorite LV2 or VST host. And the other group I am talking to are the developers themselves, so I want to learn at least do some of their DSP programming in Faust, because I am a bit biased, of course, but I think Faust is very nice for doing DSP programming. You can program on a much higher level, and it still feels like coding on the bare iron, so to speak. It's much like doing hardware, but it's all virtual. So if you, into patching with PD or Max or whatever, then you will find some elements in there which are familiar, but it's a textual language, and you actually get a mathematical description of your signal processor, so even if in 50 years someone discovers your code, they can maybe still do something with it, at least if they can still find the Faust specification, the specification of the language. But that's only the academic or the science part of it. The practical part of it that you don't have to worry about all these nitty gritty details which can take very long to get right. Okay, that was the gong for the final members of the audience to get in. Not yet. It's like in the theatre. The break is over now. Okay, so anyway, I will go into that a bit more later on, but for now, just to give you a short synopsis of what we'll do today, is, well, we don't have tables here, but installing the required software, you have the slides, you will find them in the wiki, of course, and I've also uploaded a demo to gtap. You can get the entire gtap repo. The link will be shown later, and you can find that in the slides. And then you have all the materials and can do, and I have written down all the commands that you need so that you can then redo the stuff at home if you are so inclined. So I'll show how to install the software and then show you how to do basic programming in Faust without going too much into Faust, because teaching Faust would take a day at least. I mean, at least getting the basics across. I will show some elements of Faust. I will give you a complete walkthrough of how you can do a very simple instrument, step-by-step, and beefing it up until it becomes really a playable instrument in Carla or Ardo or whatever you use. Here in the demos, I will be using Qtractor. And so I will be showing how to compile both LV2 and VST plugins about the reasons for that later. They work exactly alike. So if you're using a Haas-like Bitwig Studio on Linux, which only can do VST plugins, then you're covered. And if you have one of those nice open source doors which do the LV2 plugins, then you're covered too. So I will show that if there's enough time, I will also show it in different hosts that I have installed here. So I can show Ardo, Bitwig, Qtractor, and also Traction here. And I also have Carla and Jalf, of course, installed. So I can show that too if there's enough time. And while walking through the demo, I will also show you some optional features in these architectures which can be used for musical applications and also for beefing up the plugins with the GUI, which is pretty new stuff, which was done by one of my students. Okay, so the secret source here is Faust. So let's start talking about Faust. Why would you want to use it? Well, it would be nice if Faust would make it possible to bring DSP to everyone. So you don't have to know much about coding. I mean, the language is pretty simple actually. But we really have to face the fact that doing DSP programming is hard because DSP is hard. You have to know quite a bit of math and you need to know some special coding techniques, at least if you're doing it in C or C++ or even Assembler. But all is not lost. Others have learned this. So you can learn it too. And what's so nice about Faust is that it makes coding DSPs a lot easier. So there's less code to write. You can do a simple additive synthesizers and just maybe four or five lines of code. And most of that is actually the control variables. The algorithm itself is basically a one-liner. And the rest of the stuff that you need, if you want to do a filter and you do that in C, then you have to think about buffers. If you have a recursive filter, you need a buffer to keep track of the past samples. And it's easy to forget about that or make one-off errors and stuff like that. And you don't have to worry about that when using Faust because the Faust compiler will take care of it. And the other nice thing about Faust is that we have some very good codes available already. So some of the world-leading experts like Julius Smith from Karma are working in Faust by now and they have published many of their codes. So there's lots of really good DSP code in the library. And much of that is available either... Was that... Okay, so that speaker... It wasn't me, I hope. Much of that is also available in a form so that you can just plug it into your program pretty much like you take an abstraction in PD and put it into your PD patch. And other stuff is ready-made code which you can produce an instrument from and just use it in your DAW. And other stuff is you will have to work a bit more. But in any case, there's lots of code already available so that you don't have to start from scratch. And getting into these P programming is of course the hardest part and it's always nice to have some code that you can start working with. And if you got deeper into Faust there's also lots of in-depth documentation available. The pages by Julius Smith if you want to do really the hard math stuff he has plenty of pages there and also plenty of pages, basically even an introduction to Faust itself. I've linked to that in the slides so these are actually links there not always recognizable in the slides, I'm sorry about that. But if you see something that looks like it might be a link then you should try in the slide to just click on it and if you're lucky then you actually take into the page. And one very nice thing about Faust is that it has an online compiler so it lives on the web as well. So if you want to get started with it it might be a hurdle to get Faust up and running I'm going to show how you can do it it's actually not that complicated but even if you don't or even if you use Windows and don't have an up-to-date binary for the Faust compiler available you just go to the web and use the online compiler to compile your DSP code I'm going to show that as well. So there's plenty of nice stuff in Faust to do that a bit more formally I wanted to present some pros and cons so for me it's more the pros than the cons of course but I tried really hard to also find some reasons why you wouldn't want to use it. So for me the main points for Faust are that it has a formal semantics that's maybe something which only scientists or mathematicians like me are interested in but you have to think about it this way just in the last break I talked to someone who's doing audio formats and if you're doing stuff that might be useful or might be interesting for others let's say in 50 years time and if we are talking about music there there are always some scientists who are interested in the old stuff namely musicologists which I teach at the university and then you have to start thinking about things like how was that instrument implemented how did it sound and with old instruments we maybe know maybe some of them are still around with real instruments but with virtual instruments unless you have precisely the max version that you need to run a certain patch from one of the fathers of computer music you don't know how it sounds and in 50 years maybe all these max versions won't be available anymore so you can't reproduce the original sounds and that's where the formal semantics comes in so it's also something for documentation and not just for getting executable code more quickly and more conveniently than in C it's also very high level that is closely connected to that very high level means that you can concentrate on your DSP algorithm and forget about all the nitty gritty stuff that's for me that's just great I mean I don't like bothering about thinking about buffers should it be five samples long or 17 samples I don't want to bother with that the false compiler will take care of that then it's also cross-platform cross-platform we have other toolkits we've heard about DPF you probably heard about JUICE and these kind of things so that you can produce cross-platform plugins well get plugins for different platforms but false really takes this to a new level we have so-called architecture files and so you can compile to different targets Edgar already mentioned that this morning and the nice thing about that is you can do your own architecture files it's basically it's just a C++ template for the plugin and into which then Faust fills in the DSP specific code which is generated from the Faust program next point is output is C++ code so you can just take the code produced by the Faust compiler and run with it and modify it for your needs and that is actually done by some people who I know are using Faust to do at least parts of their plugin and of course then you have to know C++ or at least C there's very little actual C++ in the generated code it's basically just an object, a class which encapsulates all the routines which are needed and the data so that's the way that C++ gets used by Faust so you don't have to be worried about some of the inefficiencies which might creep in the views C++ instead of plain COS and then there's some more stuff which I can't really get into there's the Faust 2 branch which gives you an embeddable JIT compiler for Faust programs so JIT means just in time you can use Faust in a library and put that into your own programs and then have the DSP code generated and executed on the fly and this is of course nice for rapid development tools and we have two examples of that already Faust Live is available for Windows also I think and the Mac and Linux of course and P-Mix is unfortunately only available on the Mac right now P-Mix basically gives you an environment to program your Faust plugins directly in a VST host like a DAW Faust Live is more for doing stand-alone stuff for quickly testing plugins so it's very nice to have this quick way of dropping your Faust source into a program and have it run there and there's also the web audio support which is where you can run your Faust DSPs in a browser, yes one question you were mentioning unfortunately with respect to the P-Mix only being available to OS X right now are there any plans to yes but they're still quite a bit off if I understood the guy correctly so there are no dates no no expected time to arrive sorry no thanks okay the web audio support means that you can run your DSPs also right there inside the browser as Javascript code as ASM Javascript to be precise and it runs almost at native speeds which is an incredibly incredible feat in my view that was all done by Graham of course I'm just talking about the Graham stuff right now there are also some disadvantages of using Faust so certainly there's a learning curve you have to learn a new programming language if you already know C or maybe C++ and maybe Java or Javascript which are popular languages today they are all imperative languages object oriented imperative so you give commands to the computer not so with Faust Faust is a functional programming language and even among the functional programming languages it's purer than many others so there are no side effects whatsoever what you write down is essentially an expression which describes how a signal processor operates and there are very many high level operations the so-called block diagram algebra operations which let you combine these things which is more in the style of patcher environments like PD or max and less in the style of C++ where you say okay first I need to get these buffers and then I multiply them by 3 and then I add something and so on so functional programming is much different and it requires a different mindset then more seriously I mean all these things can be overcome with learning just studying Faust and learning to code in it there are some things which aren't quite finished yet which I worked on by Graham one is the short circuit conditionals so that you can shut off part of your DSPs if you don't need them that's not in the master branch of the FaustJIT repository yet but there is a special branch where it's already implemented and as far as I can tell it seems to work great and will probably soon be integrated into the mainline Faust branch and the second thing is multirate processing which is in this setting quite complicated where Jan, that's one thing which I remember we talked about that how many four or five years ago and designed the scheme but it's not easy to do so but it will be there eventually multirate processing you needed for stuff like doing Fourier transforms right now you have to jump through some hoops do some stuff in Faust again some other stuff in Faust and connecting these two and maybe doing the Fourier transform in between or something like that and of course we want to keep everything to Faust it must be possible to do Fourier transform there then another potential point is that your target architecture which your environment that you want to use needs to be supported which isn't always true but for the popular environments I think Edgar showed it this morning the impressive list of architectures where many people have contributed to Faust it's a comparatively easy way to contribute if you know a plugin interface if you have a plugin interface which you know very well and you know how to which callbacks need to be implemented just teams up with someone who's written architecture before or take one of the sample architectures and put that stuff into the architecture and make it work and that's always a valuable form of contributing to Faust because in the end of course we want to support everything that does audio in some way at least but if your environment is not supported yet then you'll have to roll your own architecture code so that's potential disadvantage and now I'm already entering the more practical stuff so if there are any questions about Faust itself I mean the inventor himself is also here he can probably answer these questions much better than me one thing I've noticed sometimes you get really long compile times depending on what you're writing I've had like seven hours on a modern computer submit a bug report there's probably some corner in the compiler which isn't either not completely working or where some optimization really needs exponential time or something like that submit a bug report with a minimal example and I'm sure that Jan will look into it where do I file bug reports is it just a mailing list or the C both happen one program is the C takes really long and the other is the Faust takes really long the propagation made it mostly but yeah something like 10 gigabytes of memory or more I think even post on the mailing list or submit a bug report at the SourceWatch project that's a proper way to go about that so if there's no further questions about that I'm now entering the realm of getting practical and getting stuff installed so if you want to do VST plugins then you need this one commercial piece of software the rest I'm going to talk about is all open source software these VST sources are also available in source form but there are some license conditions this is stuff from Steinberg the makers of Cubase and well it depends on whether you want or have to use VST in some projects and then if you want to compile your Faust programs to that format then you just need to install the VST SDK source so I've written down how you can do that you can read it for yourself I'm not going to walk through the steps now I have it pre-installed on my computer this may be a stumbling stone if you want to publish your software then you have to fulfill Steinberg's license conditions at least if you sell stuff I think and ok but as long as you're running the VST plugins for yourself there's no way that Steinberg can know about that or has to know about it at least that's how I see it so if you have a project which you want to port to Traction or maybe Bitwig Studio then you just need that Faust plugin as a VST it's possible you just grab the source code and install it and then you can use the same processes which I'm going to show with LV2 to produce exactly the same plugin within limits I mean there's some stuff that's just done differently in VST than in LV2 in subtle ways sometimes it's done better in VSTs but most of the time it's done better in LV2 so there are some limitations which you have to live with but most of the functionality will be exactly identical with both kinds of plugins which I'm going to talk about so this is also the stuff that I've done and some of my students I'm going to give some tips for ARCH users because I'm a big fan of ARCH Linux and actually I use Manjaro but so you see some notices of ARCH user repository packages then it becomes very easy to install the stuff and even if you don't running ARCH if there's some stuff that you want to find out how to package or how to compile which dependencies it has don't look at the Debian source packages they're big mess, they're horrible and in ARCH you get a single child script there's the dependencies there and the entire build process everything in a single child script so you can easily find out how to compile stuff even on a totally different system whether it is Debian or Rated or something so this information may be valuable for others too and in any case I included it so you should install the SDK first why? because during fast installation it will try to figure out the script which gets used to compile to VST will try to figure out where the sources are maybe you need something to edit something manual anyway but maybe it will figure it out on its own otherwise you'll have to look at the fast VST script and fill in the right path to the VST SDK there but that's why I put this step first so if you put it in some of the paths I put up a sample path here if you put it there then the script should be able to find it which is included with Faust so installing Faust it's really easy so you take the slide and this doesn't work here if you have a proper PDF reader you just copy this line let me see whether I can do that in this browser selection, where is it? there it is I hope that this works let's clone the sources I'm just going to put this on the desktop now somewhere on the desktop I don't have internet why don't I have internet? so let me see where is the public network? more networks okay there it is okay now I have internet well this will probably take a while let's pretend that we've already done that of course I have the sources somewhere and then you just run make and if you want it to be a bit quicker then you let all your processors work and I also added world which compiles some extra stuff which isn't usually included but which you also won't need for the demo if you do it just to make it will have amazingly small number of dependencies basically just the C library or is there some C++ standard library and you need a C++ compiler and you probably need actually the GNU C++ compiler or CLANG of course it's pretty compatible so and then after that you just do a sudo make install and everything will end up under C++ local by default also of course there's an arch package which I made so I actually made two packages one is the mainline Faust which is all you need for doing the stuff that I'm showing here and the other one has more dependencies that's the experimental Faust 2 branch it has more languages output languages and the additional features which I mentioned the JIT compiler but for just compiling your plugins the mainline version is all you need okay yeah you see all the commands there so it should be easy to follow those instructions for the stuff that I'm using here the LV2 and the VST plugin architectures you need some extra stuff you need the boost headers that's used in some part of the architecture where it does processes, MIDI stuff and actually I think I'm using that in the voice allocation algorithm somewhere I didn't want to write a cyclic buffer just for this it's in the boost headers you only need the header files from the project on Ubuntu or Debian systems that's probably boost minus def or something like that on Archdew you just install the boost package and you need the LV2 headers you can get those from those links as well but they should be readily available in any kind of Linux distribution that you want to use and QT of course as well QT is only needed if you want to build the custom GUIS with the plugins and there you might ask why use QT we just had the discussion on the LV2 mailing list QT is not ideal for plugin GUIS for a variety of reasons but we did it in QT because it's readily supported by Faust that there's already quite a lot of code for doing Faust DSP GUIS in QT and we just used that and that's why we use QT so there are some pitfalls there you need to be sure that the QT version will work with your DAW for instance adder requires I don't know what I do when it does this if you have a tip for me some cable connection maybe I hope that the guys listening on the stream haven't just exploded yet so the QT you need for adder is QT4 and the QT you need for the other DAWs or you can use with the other DAWs including QT Ractor is QT5 so that's the current version of course so I've also written down the packages that you need to install and so the next thing that you need are these special architectures for LV2 and VST plugin programming you actually don't need to get these the stuff is that you need for compiling is all included in the latest FaustJIT versions anyway but I've included these links to the original Bitbucket JIT repositories with the code because there's a makefile in there which shows how you can package up stuff with the makefile if you want to do that for your own plugins and there's also a couple of examples which you can use for testing immediately and you can just clone these repositories of course I have downloaded these as well so let me just show you how you compile this stuff I have it sources bitbucket Faust LV2 so if you need all the dependencies that I mentioned and then you just type make or if I'm doing it to make it a bit quicker then it will compile use Faust to compile the stuff this uses the makefile not the script that you get with Faust there's also the script included so you can always get the latest stuff from this repository that I've shown but I try to keep the Faust repository in sync very closely so that it doesn't fall behind yeah so it's quite a few sample plugins but it should be almost finished now if you just type make in the Faust LV2 directory it will build with default options which means no dynamic manifests in LV2 those of you who have used LV2 plugins will know what I'm talking about so it needs to generate some LV2 plugin manifests and package them up with plugins themselves and it would also do GUI-less plugins I can show you a different way to compile well it's still there's some extra compilation stuff going on there because it actually compiles the plugins twice to generate the dynamic manifest which is always in the plugin itself but you can if you have a version of LV2 installed or more precisely of LV2 LV which is the host LV that for instance Qt Tractor uses and also other uses if this is compiled with dynamic manifest enabled then you don't need all this stuff and the compilation gets much quicker let me briefly show that as well the dynamic manifest option you have pretty much the same options also if you use the compilation script which I'm going to show later on and you just say you want these so in the make file you write equals 1 so this enables this option then the compilation is much quicker because it just needs to compile the plugins once just as a shared library which can be loaded by the host but I'm going to stop this here now as well and show you another option which is GUI equals 1 so in this case the make file will compile against Qt5 by default if you have that installed you can plug in including custom GUI in Qt I'm going to show that in a couple of minutes how they look like and this takes a bit longer again because well actually there's some kind of Q make stuff and mock compilation and everything going on there in the background so this takes a bit longer and there's no compilation as well but I mean it's not really that bad okay so once you've compiled these things while it keeps compiling I'm going to get back to the slides okay you also need a doll of course if you want to run these plugins or at least an LV2 or VST host I'll be using Qtractor here because I can do both Qt2s and Qt5 GUIs with it and it's nice and small and easy to use. I could have used other as I said in the end I will maybe show some of the other hosts as well but for now I'll be sticking to Qtractor so if you want to follow along with the demo you will have to have that installed as well and I've left some links here of other stuff like studio, radium, reaper on the Mac if you're here with the Mac so the stuff also works on the Mac with some limitations which I'm going to talk about at the end of my presentation and traction also on Linux very nice and okay if you don't have any of these and have troubles running the plugins directly in your door then maybe Carla will help you we've seen it in Vince's presentation and there's also an external for PD which I've written so that you can run the LV2 versions of the plugins also in PD compilation I've already explained that there are some technical details you can specify which QMac version to use on Mac Fire and I've explained the dynamic manifest option I recommend using this option there are some reasons against it LV2 from the basic philosophy of LV2 is that you have all information as static data in these manifest files so that the host can discover everything about the plugin without running the plugin but there are some features which are just impossible to do if you don't have dynamic manifest like the tuning control that I'm going to show so if you can use the dynamic manifest it's good it's not absolutely necessary but in any case none of these distinctions hold for VST because it's always there's only one output in the VST architecture which is the plugin and to install these plugins once they're compiled let me see whether it's finished already yes you end up with some stuff in the case of in the case of LV2 you end up with this where are the results did I do the VST stuff the accident it's still compiling that's why but it should be finished any minute now any questions concerning the build process while it's still building no ok probably anything which does standard C++ 11 or later so 4, 4, 6, 4, 7 should be should be ok so it just finished and here in this case the Faust LV2 stuff gets generated in a separate LV2 directory as a single bundle which contains multiple plugins and the needed manifest files and stuff so you can just take this and copy it over to your .LV2 directory where I already have quite a bit of stuff so you see the Faust .LV2 stuff is already in there and therefore I'm not going to do that now but you can just take the entire bundle and throw it into your .LV2 directory and then stuff is installed and you can immediately fire up your DAW and they should be recognized of course if you're packaging stuff for someone else then you might want to install elsewhere instead on the user LV2 or something so that's how this works that's the makefire compilation same process basically with the VST stuff you run make or the scripts and then take the scripts which come out of that and throw that in your .VST directory and well I don't really want to go into the technical details of the compilation process but you see in the VST case you just get a single binary the shared library which is the VST plugin so it's a bit simpler in LV2 there are some details involved whether you want a GUI or not whether you have dynamic manifests or not whether it needs to generate the manifest and the manifest and the plugin binary needs to be put together into a so-called plugin bundle and all that is taken care of either by the makefire that you find in the jitter repository or with the script which is also included in the Faust installation and well so there are some options there which are in lighter blue but I don't really want to go into that now so using the online compiler I actually have this link should actually be working so let me see there we go okay the online compiler looks like this and it used to greet you with a selection screen where you could select various example programs that's not the case anymore you can enter your code right there or you can just drop a file over there so let me see let me take one of these files that I have so you find these examples in the examples folder let's take for instance a little instrument like the organ let's take the car plus so the DSP file is the Faust source let's just drop that up here it didn't work why sorry now the sound will get worse but the battery is going down I still have an internet connection so this should work but it doesn't there it is now I'm not going to explain all of that it's an instrument it's a simple physical modeling instrument and the code which is pretty much stolen from Jan so that's why his name is up here and so that's the code that you find in the examples and you then go to the compiled code tap and you just select you just select as an architecture whatever you want if you want 64 bits LV2 without GUI it will be this architecture or you can create a plugin with a Qt4 GUI or Qt5 or let's do a VST this time with a Qt5 GUI it will actually show you the C++ code but of course we just want to have a binary and so I click on the last tab it takes a little while again maybe do it again I hope I didn't kill the... ah no there it is now so if you want to download the plugin you can get it right here if you have your phone ready you can just scan the QR code and click on this file here it's a tab all which contains the plugin so I'm going to save that and let's look at it there it is C++ in this case there's just the C++.so in there which you can now drop into your .vst folder in the home directory otherwise you'll have an entire plugin in there you just unpack that and throw that into your .lvst folder that's all so it doesn't get any easier than that I hope that you'll agree with this okay that's well there's one more possibility use the script this is what actually is done by the online compiler when it compiles the stuff it uses these helperscripts one of them is the faust.lv2 script which creates lv2 plugins from faust sources and the other one is a bit weirdly named faust2faustvst that's because there's also another vst architecture by karma which isn't quite as capable which you can also use but this script is called faust.vst so it has various options because I'm running out of time I'm not going to go into all of these but you see you can select the qt versions that you want to use and you can also instruct it to keep the C++ the generated C++ code if you want to tweak that yourself and stuff like that and you can also specify a style for the GUI and there are some some pre-configured style sheets available in the faust source and for lv2 you can also specify whether you want dynamic manifest support or not and also quite useful if you in lv2 every plugin has an uri and you can choose that with this option here and you will tag on the plugin name and then you can have your own plugin URIs if you don't specify one you get a generic one which is actually URL pointing to my BitBucket website for that so let's get even more practical and see whether I can still in the 30 minutes that I still have walk you through a complete example we'll start out with something very simple namely this little example here so that's just a sign generator you probably thought now ok I'm kidding you but we'll arrive at something much more useful in just a few steps this thing I mean it's probably pretty obvious what it does so I don't even have to explain that but you see that there's some library imported there which has the oscillator function this OC function defined in it and there's one control here for the frequency in hertz and this is described by a certain function numeric entry function and you have a default value for the frequency here and a range of values and a step size and then what your process function does process is the main function in the Faust program it realizes the global processor so the DSP which is realized by the Faust program in this case it's just an oscillator which oscillates at the given frequency which I can then control with the frequency control and let's just compile it so that you've seen it once how you do that manually it's very easy let's do a VST so remember it's Faust VST not just Faust 2 VST and then basically you just specify the name of the Faust source in this case x01.dsp and then it will everything else gets done silently in this case it will only for the benefit of the online compiler I think we introduced that you introduced that that it prints out whatever gets produced by the script and this will then get packed up for us it's just an information ok it left our plugin here and now you have the x01.so right there and you can drop that into your .vst directory and that's all you have to do to install this stuff so that I don't have to compile everything manually here I've prepared something ok for these sources let me show you where you can find this stuff there's the repository it's on jitub in the slides you have the command you just copy that and then you can clone the repository which has the slides in it this example and a little makefire which then automatizes the compilation but it uses faust2.faust2faustvst script so let me just run make and it will also produce a faust this is a GUI this is the minus GUI option but of course I've prepared that as well so that I don't actually have to do it anymore I just wanted to show how that works it will take a while because with GUI compilation as I've explained it takes a bit longer I've already copied this stuff over I can show you that for instance the vsts are in I put it in a separate sub directory so that they're easier to find the vst host will also look in subdirectories so there they are all the plugins in this case only shared libraries because that's all vsts and now let's see them in action so let's start with the simple one that I just created that I just compiled I can show you that ok Jack is still running and as I said I'm going to use qtractor for the demo and we just create a midi track and add the plugin that's all well I've chosen lv2 here I've actually compiled both so they are also available as vsts in qtractor I'm going to use the lv2 now it's not much but you can actually change the frequency so that's probably not what you expected but it's the first step so it's actually produced by this plugin so you have a control and the GUI is included as you can see it's in this case a very simple GUI to show you what you can get when you do more stuff like this and to keep you motivated I'm going to show you a complete project with in this case let's take that one so these are some of the sample plugins I have the kind of couple of strong synthesizer here which looks like that in the GUI and well we can take away the free verb and have a font sitter reverb also as a file program and you see the GUIs are formatted in the case of sliders that's because the layout information is really can be included in the Faust program this will be in the final steps of our walkthrough and you can also have some plugins with outputs so here we have a GUI element which is called the bar graph which then gets rendered as this kind of control so that you also have some meters and stuff like that that's how the full blown results looks later, now let me just walk through the remaining steps maybe we don't do all of them but ok we don't have to listen to all of them so next step would be if you want to arrive at an instrument we already have the oscillator so one more step let's add some metadata the plugin hosts always like metadata because then they can show some information about the plugins so this is the only difference we have in this program we declared some stuff the version of the plugin, its author a short description, a name it depends on the host how this information is used and also on the plugin standard how I could map it to some metadata in the plugin interface but it should work to some extent at least in the different hosts but I'm not going, I don't know what I'm doing wrong sorry about that again maybe it's because I'm running out of time and they want to remind me ok the third example now has some more interesting stuff in it I've added a few controls you can also in the materials that I included if you go into, there's not only a make file there's also a read me in there which explains everything which I'm now just glossing over in a bit more detail but what we have here is actually I've added two parameters gain and gate I already have a mind of producing an instrument and we need that for the instrument later on too and to make the sound more interesting I added some partials well now there are three where there was only one and this also shows how you can program with macros in false macro definitions look very much like ordinary function definitions but they have patterns in them and what happens here is whenever I need the value amp of one it will take this definition for amp two it will take this definition so this sum will take the control variable that I want to use with all the ranges and stuff multiply it by the oscillator and the i value here is a running index which is defined down here it will then run from 0 to 2 and because i,3 is written down here it will run from 0 to 2 that's why I had to add one to the index here but what this basically does is it defines partial E as a signal processor which creates a sign and this main function here the process function adds these three partials together so I guess that should still be understandable as well so where we had one control parameter we now have six in total one for every amplitude for every partial and the other three which will then become the voice parameters of the synthesizer which we are coming to in a few minutes so let me briefly show you that using Q-tractor again excuse me? where? David, can I please have a glass of water that would be very nice, thank you regarding the macro is there any real difference because I was confused by the term when you compare it to some other function or is it just regular pattern matching with expression, just define a function which is only defined on one, two, three a partial function in a sense or is it? actually it's a function which is evaluated at compile time and not when the FAUSE doesn't generate any code for the function itself for the AMP function but it generates code for the GUI elements as usual it's missing from the compile code it's kind of inlining but it's really a macro language thank you very much Heiko but I would theoretically have the possibility to use pattern matching and make some complex whatever yes we have some code like that if you want to create complicated signal processors with repetitive pieces like measures and so on we regularly use that but I can't really explain it in a few words now and I have no examples to show right now but it's used for much more complex stuff okay but maybe I can ask that later when it talks about it yes I can then maybe look for some examples which I have thank you okay let's try this new plugin new track which one was it I forgot the number number three okay first need to turn it into MIDI track and number three there we are okay it looks a bit funky we'll take care of that but you see there are the three sliders and I have my frequency I also have a new gain parameter and I can push the gate button to play and I can change the amplitudes so it's beginning to look and sound like an instrument and let's take that one step further next step okay you probably I forgot to mention this but you probably heard that click right that's because we have no envelope yet of course and if you just start the sound with full amplitude then it's going to click you don't want to have that in instrument that's why you add an amplitude envelope and I did that in this version of the patch otherwise it's still basically the same but we have this part down here if we take another look at the version of the source before that you see it just multiplies the three oscillators with the gain and the gate but now instead of multiplying with the gate itself it multiplies with some signal derived from the gate and here you see how you can patch stuff together in Faust we still have the same gate control signal which will be one when the node is played and zero when it's off and have this ADSR function which turns this parameter this control signal into a more complicated signal namely into the envelope signal that's a function which is available in music.lib as well it's interesting to look at it's a quiet intricate implementation I really like it but fortunately I didn't have to write it myself Jan did that for me and we just have to pass some parameters and I've added these here a tactic a sustained release just the classical stuff if you know about sound synthesis and the techniques which are being used there then you know what I'm talking about now so we need those four parameters to describe a curve that looks a bit like a church so it has these four periods attack, decay, sustain, release and now instead we just pipe this gate parameter into this ADSR function which is a signal processor which takes this one parameter and then produces the envelope and then multiply with the signal just as we multiplied with the control signal before that's also one of the features of Faust is that all your operations operate on signals not on single values and you don't have to think about it even so and I also added master volume and panning now so that we have a stereo signal and we also control the volume separately for each voice later on so I can briefly show that as well we still have time for that I should really remember the keyboard shortcut can you change these? I want to have control T for that MIDI so this was 4 so there we have the attack, decay, sustain, release parameters some reason why they are not in alphabetic order but that's all written in the read me I don't go into that now so we still have the gate and gain but if you listen to the sound now it should start without clicking and I can control the left-right panning it's also not as loud anymore that's because of this parameter here and we can of course change the amplitudes like we did before but we can now also change the attack decay sustain, release parameters and get different sounds, both sounds and stuff like that so now we almost have an instrument that should be pretty clear and we can go this one step further and this is now really easy because the rest is basically done by the architecture you just have to tell the not even the false compiler but the architecture the compiler doesn't know or care about instruments it doesn't know or care about media, that's all in the architecture and the architecture will pick up this extra data, the end voices I introduce that into my architecture I guess that we might make some kind of pseudo standard from that because I really want to have that information in the false program at least in cases of architectures where it makes sense so this tells the architecture I want 16 voices maximum and I want this to be an instrument plugin and the rest of the plugin is exactly the same so we can give that a try now now I need to create a track and I make it a MIDI track and I also change the metadata so it's actually now called synth instead of sine which I used before that's just changing the metadata doesn't affect the functionality otherwise so as you can see one thing that you will notice is that we have some new controls down here but the frequency gain gate parameters are gone they are now automatically operated by the voice allocation algorithm which is also included in the plugin architecture so with just this simple step just writing down declare and voices 16 you now have an instrument and the voice parameters this frequency gain gate parameter have become invisible and the other parameters will be operated in lockstep for all the voices so the architecture actually makes sure that there are enough instances of the DSP available to play as many voices as you specified and the actual number of voices you can change with this polyphony parameter which goes up to the end voices value and yeah that's about it let's play it a bit and now comes the embarrassing part because I'm really not a piano player so I can't really compete with wins of course and I still need to make a connection probably here, a MIDI connection so let's connect the keyboard to Q Tractor and now I should hear a sound and now I can play this as an instrument so of course I need to probably need to change this to record no it wasn't even needed so it's always monitoring, right? if it's connected so we now have an instrument some more details about this I can only pick one or two now because I'm running out of time already but basically you can now go into pick a MIDI file drag it in here why can't I drag it up here because actually I wanted it to have here but it's not possible or is there a way to do that try clicking on the MIDI yes now I got it but ah there it is, ok then I can get rid of that one again thank you very much you learn something new every day so same instrument again now there's still some issues with that you want to have a nice aguille it's not really formatted nicely and you want to deal with super noise maybe and stuff I've taken care of that in the walkthrough too but maybe one thing that I want to still show you in the end instrument yes the microphone where is it? ah there we go would you be able to automate the parameters we defined in the Faust code? yes they're all automatical so Faust maps that to the architecture they're all exposed in LV2 they're exposed as LV2 ports but there's also a MIDI input port where you can then use the Faust assignments of MIDI controls which is also possible MIDI control automation on the door side I wanted to go into all of this but I'm running out of time now so maybe we can but Faust abstracts this and translates it into the architecture which maps it to the port basically Faust has no business in that it's all done in the architecture in the Faust program there's certain metadata which the Faust compiler will just put into the output C++ program which is done by the architecture like the MIDI assignments and stuff and all the connection to the plug-in API is done by the architecture Faust knows nothing about VSD it doesn't have to so let me create another now with my new found knowledge let's have a quick look at this so the end product would then be something like this which I even styled with the gray Faust style for QT which looks pretty much like a standalone application which you get out of Faust when you use the Faust 2 Jack QT script or something like that actually uses exactly the same code it's just packaged a bit differently this as an instrument but let me do this with MIDI so again I need the MIDI file and Vencio so this is by Bach and yeah it works actually so let's look at the plug-in again and now you can just operate if you've ever used Faust Live in a standalone plug-in you just operate it in exactly the same way okay maybe sustain so you see they are all working they can also be automated and then operated by MIDI or you can operate directly by MIDI and it's multi-temporal actually it keeps track of the separate MIDI channels and in the end this was added functionality which you don't have in Faust Live yet we want to merge all this code and then it will work the same everywhere but this is right now only in the LV2 and VST plug-in architectures then you can also change the tuning on the fly so basically there was a question does this you probably heard that this sounds like a little bit out of tune now which is because actually this is a quarter-mean tone which sounds pretty bad in some keys and you can change this on the fly or you can also send MIDI tuning Sussex messages to the plug-in it will understand these as well if your DAW supports it so this is also added functionality which you get for free okay now the question does this already have dynamics what do you mean by dynamics with different velocities? it's a complete MIDI synthesizer the velocity gets mapped to the gain parameter that's why I had two volume parameters one was named gain which is specially interpreted by the architecture as one of the voice parameters so it's automatically mapped from the velocity and I've also put in the other volume parameter which isn't interpreted especially by the architecture which can then be exposed in the GUI or in the generic GUI provided by your DAW so the architecture just maps the velocities to the gain parameter and the note beginning and end to the gate parameter and the note number to the frequency and this is where the tuning is used and the tuning can also be different for every MIDI channel so it's a fully multi-temporal instrument which we don't have in Faust Live yet but once we merge the code we'll be there as well then let me get back to my slides and finish off I talked about this and the MIDI CCB support you can find it in the slides and in the README as well where I explained the entire walkthrough one thing which I didn't talk about yet and I think I'm really... we started a bit late in the last few days can you give me five more minutes ok thank you then I can briefly show that to finish off so that I just finish off with the slides you have a very good opportunity to create your own plugins either from existing Faust code or if you're a developer we really try to lure you into Faust if it's more convenient to write your stuff in Faust than doing it in C, C++ anything yourself the reason to also support VST with exactly the same functionality for me was that personally I also use other hosts I couldn't show these now but the stuff also works in Bitwig Studio and Traction and Ardo of course and so we have some nice hosts now which only support VST Bitwig Studio and Traction and so I wanted because I'm using that also in my courses at university I wanted to have that work as well not because I'm really fond of the VST plugin architecture but I think it's important as a step and we just can't close the eyes on the fact that VST is a cross-platform plugin architecture right now I mean LV2 pretty much with very few exceptions only works on Linux right now and now you can just take your Faust code and compile it to VST instead and then you can run it on the Mac as the same plugin that you used on Linux and the goal is of course to have also the GUIs work which doesn't work yet there's some trouble with the LV2 stuff it should work in principle it even compiles on the Mac but the GUIs don't work in Ardo I don't know why they don't work in Kala either probably some library incompatibility I couldn't track that down yet and in VST there's if someone knows Cocoa and knows how to embed a QT window back in a native OSX window then please get in touch with me we still need to solve that other than that we probably will look into lighter toolkits as well I mean this QT support was done by Roman Zwidler one of my students and it was a BC project so it had to be done in a certain timeframe and then it was very convenient to have all the ready-made code for QT in Faust itself we used all of that and it still works with Faust VST .h header file unchanged so we just built on that but QT is not the optimal solution I'm sure if Robin is still on ISC will agree with that there should be other possibilities but then we need to develop the code to format the GUIs other interesting directions for future work will be to port the architecture to some other plugin standards and also make it work directly in PD instead of the plugin that I will be showing now and then something which I have on my to-do list I just bought a mod the new one the mod duo and so we probably will add some special support for that in the LV2 architecture and there's some other stuff but one thing which Wins were just brought up which has been on my to-do list for an eternity already is MIDI output from the control variables and as he just convinced me this really needs to be available so that you can have a feedback to your MIDI controllers and so these are the things that I probably will work on as time permits and as the last thing before we can maybe have another Q&A I'm just going to show the same kinds of plugins that you've seen earlier in one of the more elaborate examples I will show now in running in PD you can also find that in the JITAB repository there are two examples they are one more basic and this one is a bit more like the stuff that I've shown in Qtractor so I'm running this in PD L2 org but of course you can use vanilla PD or PD external instead and as you can see there's a special plugin here you need more dependencies to get that to work because it's written in my own functional programming language pure but it's not too complicated to get it to work you will find some notes in the readme files and this can load any kind of lv2 plugin it uses liplilv as inside of it and so it will load any plugin that the library by Robillard will load and there is no GUI no Qt GUI even if you've compiled the plugin with GUI here in PD but as you can see there are some generated generic PD GUIs actually PD users will maybe even support that but it would be nicer to have auto-generated formatted GUIs which we already have code for that but I first need to make this lv2 vst architecture work in PD the version we have now is still a bit more primitive that's also on the to-do list just to convince you that this actually works let me run this from media player to pure data I have no sequence here in pure data so I'm just taking a basic media player application and there we go and we should also same stuff, same plugins exactly the same plugins now running here in PD so that's the cliffhanger now I'm ready to take the Q&A and thank you for listening I have maybe two questions the first one you said that you do the automatic mapping of the velocity to the gain if I don't like a linear ramp how would I set my own exponential or logarithmic wave? well, you get a linear parameter but it's just mapped to the 0,1 range you can then still do anything in files that you like so you can turn it into an exponential response or whatever you want second question second one is ok, so I've got you right if they generate it, you guys don't really appeal to me and the ones with the theme are somewhat nice but you really want something photorealistic, self-rendered could you hook some self-made code with your own PIX maps and rotational knobs into it? just rip out the GUI code and put in your own that's why I said it's so nice that you get C++ code you can see that the GUI code actually it's a part in the architecture which you can just throw out and in the VST architecture it's basically that you can that you can don't let me lie to you but you should be able to just replace the editor callback in the VST architecture and in the LV21 it's basically well there the link is a bit more intricate but so that's probably more work to integrate your own GUI but in principle it's also I mean there's a Q widget which is created and which gets then passed to the LV21 plugin host and if you rip out that code and create another kind of widget instead you probably have to change the manifest which also says which kind of widget it is but we could maybe make this easier by providing some conditional compilation stuff which leaves out everything but the call which you then have to implement with your own GUI so that's probably what we should still work on. It's certainly possible because you have the C++ output code but it's more work with LV2 I'd say right now as with VST where you can just take your own editor class and throw it in there and delete the traces of the old ones. Right. So Albert I might jump in there just as open AV because I've actually done exactly this in two different ways. One take the C++ code from Faust I wrote an architecture backend for Faust a really really simple one where you could pull your parameters and get float pointers and then you write your own C code or C++ code that actually pushes the values into the Faust DSP so it's essentially take their magic and just bring it into really usable C code as a certain class and this was the way the first version of Sorcer was actually built even though I never released architecture file because it was such a hack but the code generated was that it's actually much simpler. You just add another UI to the plugin itself in the metadata and it doesn't have to be in the same bundle at all. So you can specify a new bundle and I think that's the way the mod guys are doing that too, which is a really beautiful solution. That's true because it's just also in the LV2 architecture I've shown that picture which displays how it's compiled. GUI is really separate. It's a separate module so you can just throw it away and put in your own GUI as a binary and just change the line in the manifest which tells it where the plugin is or just build without GUI and add the stuff yourself so that's really, that's Harry is right. It's much easier than I imagine it to be. But if you want to have some template code how the integration could work also with your own GUI then you can maybe even use some of the code that we generate. Okay, any more questions? Yeah, you here? In the middle? You mentioned you wanted to use other toolkits as well in a more lightweight, are you thinking of stuff like the thing that Harry wrote and Robin? Yes, I'm thinking specifically about his toolkit but there's other stuff we should really team up to make that happen because QT, for me it looks nice but I'm maybe not the typical target audience and we should have alternatives there but we need to make them happen so I don't, I have no idea how to target his GUI toolkit and right now we don't have an architecture for that, we don't have FaustQT.h for the OpenAV toolkit and so we still need to write that and probably we need to team up with Harry and there are other possibilities like OpenGL which as soon as Jan implements them I will pick them up Sorry. And then another question you mentioned the number of voices you wanted to make that a standardized parameter Yes, it's already thinking about something where the different voices interact where you have maybe you implement a bleed between them or something like that which I want to have that inside the FaustQT as opposed to a compile parameter or something like that The number of voices? Yeah, and voices parameter? Ah, okay, that's just metadata it has nothing to do with the Faust program basically it gets picked up by the architecture but right now it's only supported by my own architectures, by the LV2 and the VST architecture but it's conceivable to make that work with the other architectures as well so that we have some kind of standard of specifying this Faust program should be an instrument by all architectures which support that kind of thing So you cannot make the different voices interact with each other inside the Faust code Yeah, that's the disadvantage of this approach if you want to do that you basically use that technique then you build really a DSP like usual with all the voices in it as an ordinary effect and then you have to do all the control yourself But that's probably a problem worth thinking about I mean basically what you probably want to do if you want to have interacting strings then you want to pipe out some control information or even audio information and pipe it into the other feed it back into the other voices So it's conceivable to also do it on the level of an instrument plugin in this sense but it's not available yet we really have to develop some ideas for that and another thing if we talk about voices of course you want to have a completely dynamic voice allocation but that's not so easy to do in every time context so we're not doing that right now but probably something for the to-do list as well Okay, there seems to be something from IRC There's a question from IRC indeed Robin Garius asked Does Faust slash LV2 cater for MIDI CC bindings so is it possible to map CC to both parameters like ADSR and Synth settings like the sustain pedal? Yes, I'd say yes If I understood the question correctly you're asking how to map MIDI CCs directly onto the extra parameters in the instrument, right? That's possible You just write some metadata it's already implemented only the input side right now Yes I think we have to call it quits now because everybody's waiting for the break and I'm really thankful for being here because I'm not quite... well, I'm actually the one to blame that you had to take on this task David so I want to say a special and personal thank you that we can be at Berlin for this mini-lock Thank you very much