diff --git a/BuboQuark.quark b/BuboQuark.quark index 2b3639d..bde7e18 100644 --- a/BuboQuark.quark +++ b/BuboQuark.quark @@ -14,6 +14,7 @@ "https://github.com/dmorgan-github/Pdv", "https://github.com/supercollider-quarks/Bjorklund", "https://github.com/adcxyz/SafetyNet", + "https://github.com/madskjeldgaard/nodeproxygui2", ], url: "https://raphaelforment.fr", isCompatible: {Main.versionAtLeast(3, 1)}, diff --git a/Classes/BuboBoot.sc b/Classes/BuboBoot.sc index d2f6854..4aedb94 100644 --- a/Classes/BuboBoot.sc +++ b/Classes/BuboBoot.sc @@ -3,11 +3,11 @@ Boot { classvar <>clock; classvar <>localPath; classvar <>samplePath; + classvar <>serverOptions; *new { - arg configPath, samplePath, soundDevice; - var s = Server.default; - var p; var c; var t; + arg configPath, samplePath, serverOptions; + var p; var c; var t; var s; var banner = "┳┓ ┓ ┳┓\n" "┣┫┓┏┣┓┏┓ ┣┫┏┓┏┓╋\n" "┻┛┗┻┗┛┗┛ ┻┛┗┛┗┛┗"; @@ -16,6 +16,25 @@ Boot { "┗┛┻┗┛┗┛ ┗┛┗┛┻┛┗┛ ┛┗┗┛┛┗┻┛┗┛"; this.fancyPrint(banner, 40); + if (serverOptions == nil, + { + "-> Booting using default server configuration".postln; + s = Server.default; + s.options.numBuffers = 1024 * 128; + s.options.memSize = 8192 * 64; + s.options.numWireBufs = 2048; + s.options.maxNodes = 1024 * 32; + s.options.numOutputBusChannels = 16; + s.options.numInputBusChannels = 16; + s.options.outDevice = "BlackHole 16ch"; + }, + { + "-> Booting using user server configuration".postln; + s = Server.default; + s.options = serverOptions; + }, + ); + // Using Ableton Link Clock for automatic synchronisation with other peers this.clock = LinkClock(130 / 60).latency_(Server.default.latency).permanent_(true); TempoClock.default = this.clock; @@ -25,16 +44,7 @@ Boot { // Defining the local path as default for configuration files if not configPath this.localPath = this.class.filenameSymbol.asString.dirname +/+ "Configuration"; - // Customizing server options: less conservative than SuperCollider defaults - s.options.numBuffers = 1024 * 128; - s.options.memSize = 8192 * 64; - s.options.numWireBufs = 2048; - s.options.maxNodes = 1024 * 32; - soundDevice ? s.options.device = soundDevice; - s.options.numOutputBusChannels = 16; - s.options.numInputBusChannels = 16; - - p = ProxySpace.push(Server.default.boot, clock: this.clock); + p = ProxySpace.push(s.boot, clock: this.clock); this.samplePath = samplePath ? "/Users/bubo/.config/livecoding/samples"; // Setting up the audio samples/buffers manager @@ -52,9 +62,6 @@ Boot { }); } - /* - * Convenience method for printing a message with a fancy separator. - */ *fancyPrint { arg message, length; var separator= length.collect({ @@ -81,7 +88,7 @@ Boot { { ~buf = Bank(~sp)[~nb % Bank(~sp).buffers.size]; } ); if (~nb == nil) {~nb = 0}; - ~type = \note; // back to note + ~type = \note; currentEnvironment.play; }); } diff --git a/Classes/GUI/BuboScope.sc b/Classes/GUI/BuboScope.sc index 0da2299..3078b6e 100644 --- a/Classes/GUI/BuboScope.sc +++ b/Classes/GUI/BuboScope.sc @@ -5,3 +5,24 @@ Scope { } } + +Meter { + + *new { + var window = Window.new( + "Meter", + Rect.new(left: 0, top: 0, width: 680, height: 250), + resizable: false, + border: true, + scroll: false + ); + var meters = ServerMeterView.new( + Server.default, window, + 0@0, 16, 16 + ); + window.front; + window.alwaysOnTop = true; + ^window + } + +} diff --git a/docs/.nojekyll b/docs/.nojekyll new file mode 100644 index 0000000..e69de29 diff --git a/docs/README.md b/docs/README.md new file mode 100644 index 0000000..581dfa7 --- /dev/null +++ b/docs/README.md @@ -0,0 +1,39 @@ +# BuboQuark + +### What is this? + +BuboQuark is a collection of methods and hacks I have found to make _live +coding_ easier on SuperCollider. Since the Quark itself does not bring +much value and does not change SuperCollider radically, I have thought about +creating this website to document my findings and help other people get started. +This small website takes inspiration from [how to co34pt livecode](https://github.com/theseanco/howto_co34pt_liveCode), another great read. +BuboQuark, thus, can be said to be: + +- a small Quark to setup SuperCollider for _live coding_ and sound exploration. +- a companion tutorial website to learn how to use that setup and SuperCollider. + +BuboQuark can be thought of as my personal SuperCollider configuration. It twists it just enough simply for my own convenience. Internally, it relies a lot on JITLib, Patterns and NodeProxies. It truly feels like a collection of tips and hacks found on the internet. + +### What does it talk about? + +I am a big fan of _live coding_ and I have been practicing it for a while. I +have created the [Sardine](https://sardine.raphaelforment.fr) and +[Topos](https://topos.live) live coding environments. Writing code to make music +live is part of my daily musical practice. Like anybody else, I like to have +many different tools to make music. I have been using SuperCollider for a long +time, but most of the time using it as an audio backend and talking to it +through Python, Haskell, JavaScript and so on. I never really learned to play it live. I have some requirements for a tool to be usable in a live context and most specifically as a part of my musical practice: + +- I need a powerful sequencer / scheduler for musical events +- I need to be able to talk with other softwares / devices easily +- I need a playground for audio synthesis and experimenting with sounds +- I need to be able to play with my friends and synchronize easily + +Everything else is accessory and I can easily live without it (graphical +interfaces, widgets, etc). SuperCollider, out of the box, ticks all the boxes. I +can do everything using just that tool and it's a great thing since it is +available on most platforms and doesn't consume a lot of resources by default. + +### What music can I make using it? + +My interest for electronic music ranges from experimental and noise to [Algorave](https://algorave.com) club-like music. I also like to slice sounds, to play around with oscillators, filters, delays and modular synths. Consequently, you will find a lot about this here and not so much about traditional music production or composition. diff --git a/docs/Warning.md b/docs/Warning.md new file mode 100644 index 0000000..2e96a47 --- /dev/null +++ b/docs/Warning.md @@ -0,0 +1,40 @@ +# Before reading this guide + + +This guide is a not a general purpose tutorial. It will not teach you how to use +SuperCollider. If you are brave enough, you can learn by doing/following the +steps. However, you will sometimes feel the need to read other sources to fill +the gaps. I am not a SuperCollider guru and I do just that when the need arises. + +## Learning resources + +There are already many great resources to learn SuperCollider. I recommend the +following among many other ressources: + + +- [SuperCollider for the Creative Musician](https://global.oup.com/academic/product/supercollider-for-the-creative-musician-9780197616994?cc=fr&lang=en&) by Eli FieldSteel: the best educator I know to learn SuperCollider. The book can be expensive for some people. If you can't afford it, read the following point. + - [Eli Fieldsteel YouTube + Channel](https://www.youtube.com/user/elifieldsteel): Eli Fieldsteel has made + a great series of video tutorials that are free to watch. This is the best way + to learn SuperCollider that I am aware of. + +- [A gentle introduction to SuperCollider](https://ccrma.stanford.edu/~ruviaro/texts/A_Gentle_Introduction_To_SuperCollider.pdf) by Bruno Ruviaro: a great introduction to SuperCollider with an emphasis of making music / composing first. Especially great for patterns and sequencing. + +- [A practical Guide](https://doc.sccode.org/Browse.html#Streams-Patterns-Events%3EA-Practical-Guide) by H. James Harkins: already included in the SuperCollider help files. Easy to read, with interactive code examples. + +## Lurking around + +It's probably a good idea to lurk around the SuperCollider community to see what +people are doing with the software and how they make music with it. I really +like to spend hours browsing the web. Here are some good resources: + +- [SCCode](https://sccode.org/): some website where people post their +SuperCollider code. You can find some classics there and some recent +experiments too! +- [SuperCollider Forum](https://scsynth.org): obviously, the official forum. +This is where most of the gurus are answering questions to new users and having +debated about some aspects of the language or audio server. +- [YouTube](https//youtube.com): just search _supercollider live coding_ or +something like that. Tons of people are posting their live coding sessions. +There is [Nathan Ho](https://www.youtube.com/@synth_def), [Jaxa](https://www.youtube.com/@JaxaSound) and all the live coding folks that play in the [Eulerroom](https://www.youtube.com/@Eulerroom). + diff --git a/docs/_sidebar.md b/docs/_sidebar.md new file mode 100644 index 0000000..9662d96 --- /dev/null +++ b/docs/_sidebar.md @@ -0,0 +1,27 @@ +* Guide + * Installation + - [Before we start](warning.md) + - [Dependencies](dependencies.md) + - [Recommended](recommended.md) + - [Editing code](editor.md) + + * Configuration + - [Boot Method](boot.md) + - [Configuration](configuration.md) + - [Audio routing](routing.md) + - [More options](more_options.md) + + * Server control + * [Widgets (GUI)](widgets.md) + - [Commands](server_shortcuts.md) + + * Patterns + - [Tempo and Clock](clock.md) + - [Player shortcuts](player.md) + - [Pattern shortcuts](pattern.md) + + * Sampling + - [Sample Library](library.md) + - [Using samples](sampling.md) + + * Audio effects diff --git a/docs/boot.md b/docs/boot.md new file mode 100644 index 0000000..fce3ab5 --- /dev/null +++ b/docs/boot.md @@ -0,0 +1,45 @@ +# Boot the server + +There is a `Boot()` pseudo-class acting as a configuration file. Its behavior +is pretty classic if you are already accustomed to SuperCollider: + +- it raises the conservative options of `Server.default` to allow more connexions, + more buffers, etc. Will prevent you from running out of memory while +improvising. + +- turns the the default environment into a **JITLib** `ProxySpace`, replacing +all global variables with `NodeProxy` instances. This is one of the classic +_ways_ to _live code_ using SuperCollider. + + +- set the `ProxySpace` to use `LinkClock` for syncing with other. +`LinkClock` is using the [Ableton Link protocol](https://ableton.github.io/link/), supported by most other apps. + +- Set custom paths for loading audio sample banks and synth definitions. Write +your definitions once, reuse them all the time (if you want to!). + +- Set up a sound limit to prevent you from blowing up your speakers/ears. This is an often overlooked step that can save you from a lot of trouble. BuboQuark will also automatically load the _SafetyNet_ Quark to protect you from loud / incorrect audio signals. + +The `Boot()` constructor takes three arguments: + +- `configPath`: path to a `.scd` configuration file that will be automatically +loaded +- `samplePath`: path to a folder containing your audio samples (in sub-folders) +- `serverOptions`: a set of [ServerOptions](https://doc.sccode.org/Classes/ServerOptions.html) to fine tune the server configuration + +All of these arguments are optional. However, they will default to my +configuration if not set. If you want to set one option but not the others, use +keywords arguments or `nil` values. Here is an example of how you could boot the server: + +```supercollider +Boot(serverOptions: nil, // use default options + configPath: "/some/config/path", + samplePath: "/home/me/my_samples") +``` + +To make sure that you have booted correctly, you can go through the following +check list: + +- [ ] do I see my samples when I write `Bank.list`? +- [ ] do I see my synth definitions when I write `d.list`? +- [ ] is this snippet producing sound: `{SinOsc.ar(200) ! 2 * 0.5}.play`? diff --git a/docs/clock.md b/docs/clock.md new file mode 100644 index 0000000..733a594 --- /dev/null +++ b/docs/clock.md @@ -0,0 +1,41 @@ +# LinkClock + +SuperCollider is using a clock to sequence events in time. When you boot the +interpreter, there is a clock created by default, accessible through the `TempoClock.default` command. This clock is local and specific to your server. However, thanks to the client / server architecture of SuperCollider, it is quite easy to implement networked clocks that can be shared between peers. This is what the `LinkClock` class is doing through the _Ableton Link_ protocol. You just have to swap the base clock with a `LinkClock` instance and you are ready to go. This is what BuboQuark is doing. + +The `LinkClock` is accessible through the `c` global variable. Be careful not to +override it by mistake! It behaves like the regular default `TempoClock` with the typical methods from this class. The main difference is that this timing information is shared with other peers on the network. You can synchronize easily with your friends ... basically by doing nothing if their applications are also using the same protocol. + +**Note:** The few additional methods are already very well documented. + +**Note 2:** For _live coding_, you will need to use the clock fairly often to synchronize your time-based effects with it or to write various routines. + +##### Setting / Getting the tempo + +Use `c.tempo` to set or get the current tempo. Note that it _will_ change the tempo of the other peers. Be careful if you are playing with other people as they will probably not like it very much. There is also a `.beats` and `.quantum` method that can be used for other time-based calculations but I almost never use them. + +##### Beat duration + +Use `c.beatDur` to get the duration of a beat. This is so useful that I have +created a shortcut for it: `c.dur`. It is a very common thing to use in audio +functions. Take a look at the following excerpt: + +```supercollider +( +~wind = { + var wind = PinkNoise.ar() * LFNoise1.kr(c.dur * 4).range(0.01, 0.3).varlag(0.1); + wind = Pan2.ar(wind, LFNoise1.kr(c.dur * 2).range(-1, 1)); + wind = RLPF.ar(wind, LFNoise1.kr(c.dur * 2).range(200, 2000), + LFNoise1.kr(1).range(0.2, 0.9)); + wind = [BPF.ar(wind, LFNoise1.kr(c.dur / 4).range(40, 2000)), + BPF.ar(wind, LFNoise1.kr(c.dur / 2).range(40, 2000))]; + wind[1] = DelayC.ar(wind[1], 2, LFNoise1.kr(1).range(0.025, 0.3)); + wind = JPverb.ar(wind, size: 40, t60: 4 ); + wind[0] = wind[0] * LFNoise1.kr(c.dur * 4).range(0.01, 0.3).varlag(0.1); + wind[1] = wind[1] * LFNoise1.kr(c.dur * 2).range(0.01, 0.3).varlag(0.1); + wind ! 2 * 2 +} +) +``` +This is a wind sound texture that is also synchronised with the tempo thanks to +`c.dur`. diff --git a/docs/configuration.md b/docs/configuration.md new file mode 100644 index 0000000..225a406 --- /dev/null +++ b/docs/configuration.md @@ -0,0 +1,23 @@ +# Configuration + +When you install the Quark, you will also inherit a folder called _Configuration_. This folder contains my personal configuration files. They are `.scd` files that will be interpreted during the boot sequence. You can use them to pre-declare synth definitions, add convenience methods, etc: + +```bash +├── Configuration +│ ├── Startup.scd +│ └── Synthdefs.scd +``` + +You do as you wish with these. They are currently very minimal and only include +a method call to setup **MIDI** and a bunch of synth definitions I use. They +rely pretty heavily on [mi-UGens](dependencies.md). + +### How to list synths and effects? + +In my personal configuration files, I am using the `d` variable to hold a +reference to every synth definition I write. I also use the `f` variable to +pre-write some audio effects that I use often. This is not hard-coded, you can +get rid of it if you want. I am also attaching a few methods to these objects: + +- `d.list`: print the list of available synth definitions. +- `d.params('synth')`: print the parameters of the synth definition named `'synth'`. diff --git a/docs/dependencies.md b/docs/dependencies.md new file mode 100644 index 0000000..da5185a --- /dev/null +++ b/docs/dependencies.md @@ -0,0 +1,29 @@ +# Dependencies + +BuboQuark is assuming that you have a standard installation of SuperCollider ready: + +- [SuperCollider](https://supercollider.github.io/): the main software, +available on most platforms, including niche ones like Raspberry Pi, and other +tiny computers. Pick the latest version, always. +- [sc3-plugins](https://github.com/supercollider/sc3-plugins): official plugin +collection for SuperCollider including many audio effects and useful synthesis objects. They are often considered standard and are available on most platforms. + +BuboQuark also uses the following external libraries / plugins: + +- [mi-Ugens](https://github.com/v7b1/mi-UGens): a collection of UGens taken from + the open-source code of Mutable Instruments Eurorack modules. This is +basically free ear candy. +- [Ported Plugins](https://github.com/madskjeldgaard/portedplugins): another +collection of UGens compiled by Mads Kjeldgaard. It includes new objects taken +from other libraries or DSP research papers. + +Everything else will be automatically installed by the Quarks system. Let's +install it now by running this command in the IDE: + +```supercollider +Quarks.install("https://github.com/bubobubobubobubo/Buboquark"); +``` + +Press `Ctrl/Cmd+Enter` to evaluate that line and the installation will promptly +start. When the install process is over, you will have to recompile the library by +pressing `Ctrl/Cmd+Shift+L`. That's it, you are ready to go! diff --git a/docs/editor.md b/docs/editor.md new file mode 100644 index 0000000..9ca70cd --- /dev/null +++ b/docs/editor.md @@ -0,0 +1,12 @@ +# Code Editors + +**SCIde** is the default code editor for SuperCollider. It works super well and +it has been fine-tuned for years to be a robust companion for the language. I +recommend you to use it if you don't have much experience with SuperCollider. It +will do its best to help you and it will be easier to browse help files from +there. + +I tend to use [Neovim]() because I do most things in Neovim these days. Some +other people [wrote about using it](https://madskjeldgaard.dk/posts/neovim-as-sc-ide/) with SuperCollider so I am not going to repeat everything. Just install [scnvim](https://github.com/davidgranstrom/scnvim) and go with the flow. This plugin is very well made and can replace the IDE if you configure it well. It is also very lightweight which is always a plus if you intend to run SuperCollider on a potato computer. + +There is some efforts in the community aiming to make [VSCode](https://code.visualstudio.com/) usable with SuperCollider but it is still [an ongoing effort](https://scsynth.org/t/vscode-supercollider-current-state-macos/8312). It is probably already usable if you take the time to install it. diff --git a/docs/index.html b/docs/index.html new file mode 100644 index 0000000..339eccd --- /dev/null +++ b/docs/index.html @@ -0,0 +1,43 @@ + + +
+ +