This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2023-12-01
Channels
- # adventofcode (170)
- # announcements (3)
- # babashka (1)
- # beginners (25)
- # cherry (1)
- # cider (3)
- # clj-kondo (5)
- # cljsrn (9)
- # clojure (27)
- # clojure-art (2)
- # clojure-europe (11)
- # clojure-nl (1)
- # clojure-norway (26)
- # clojure-sweden (2)
- # clojure-uk (5)
- # code-reviews (12)
- # component (8)
- # conjure (1)
- # data-science (2)
- # hyperfiddle (6)
- # malli (5)
- # off-topic (65)
- # overtone (34)
- # polylith (3)
- # re-frame (2)
- # reagent (2)
- # releases (3)
- # rum (1)
- # shadow-cljs (2)
- # slack-help (8)
- # sql (8)
- # squint (100)
- # thejaloniki (3)
- # tools-build (16)
- # vim (7)
- # yamlscript (1)
I wrote a "Linux Audio Primer" specifically for people trying to get Overtone working on Linux https://github.com/overtone/overtone/wiki/Linux-Audio-Primer
Good overview, though had a couple of notes. One is that pw-jack
required installing the pipewire-audio-client-libraries
on Ubuntu and didn't appear to be installed by default (at least on jammy/22.04). Two is even though I had supercollider
installed through the apt package, I also needed supercollider-language
. Three is I think updating the supercollider references to github instead of sourceforge would fix some links, but also it might help to just link directly to their install instructions as a step would help (might have missed where that is in the overtone docs).
Finally, I'm a little stuck at the patching step. I've used qjackctl previously so I tried using that but was not successful in connecting up anything to get audio playing with the sclang example. I'll try one of the newer controllers you suggested, but Patchance doesn't seem to be available (at least on jammy). I think one problem here is I'm still not quite sure what should be linked to what even with a working patch program. I suspect that's clearer if one is used to dealing with patching together physical audio, but it still feels like something there is not quite making sense.
I'm going to try updating to ubuntu 23.10 to see if that helps with any of these issues, but figured I would relay this feedback. Thanks for all the work improving the documentation though, I think I'm further along than I have been previously in attempting to use overtone, and I certainly better understand what the different parts are trying to do.
After updating to mantic/23.10, I finally got the audio playback working using qpwgraph from a flatpack install. I was completely unsuccessful with patchance, it never booted as Jack is not available, but also it's default deb appears broken as I had to manually install several missing python libraries it was missing as dependencies.
One other note, I was confused with the pw-jack example, as it uses -u 1234. It might just help to use the same -u 57110 -l 32 params as the example without it below?
Hmm, so moving onto overtone itself, looks like I need to go back and use jack anyway as both boot-external-server and connect-external-server seem to require jack given the failure on (jack-is-running?)
. I'll have to take a look later this weekend.
Yeah that's an issue I'm still meaning to solve soon. The problem is that overtone assumes jack_lsp is available, which on pipewire systems generally is not the case (unless you've also installed jack, and then these Jack tools will happily work with pipewire)
Overtone once again tries to be too smart, it wants to connect supercollider to Jack for you
There's another issue with that code, it does some matching on the device name, but those names are different under pipewire
At the very least this should all be a warning instead of an error. We could also use jna-jack to connect to Jack ourselves instead of having to shell out. I have jna-jack wrapper code for Clojure, and this is what I do in my own projects, but not 100% sure yet if this should be an additional dependency
I was trying it from clojars yesterday. Won't be able to test today, but I can try from a git branch soon
{:deps {io.github.overtone/at-at
{:git/sha "c087c22df855f3d61859dcaa6594b270e1652b54"}
io.github.plexus/overtone
{:git/sha "9463d61754affee84f9574d4bc371ab94f6fb39c"
:exclusions [overtone/at-at]}}}
Got it working with the deps.edn above. It was looking for a slightly newer at-at then was on clojars. I did have to start scsynth with the pw-jack like: pw-jack scsynth -u 57110 -l 32
, and then wired up the outputs to my audio card using qpwgraph
.
Then an example like:
(ns sound.core
(:require [overtone.core :refer :all]))
;; (boot-external-server)
(comment (connect-external-server 57110))
(definst foo [] (saw 220))
(foo)
(kill foo)
worked.Is there a way to do the graph connections automatically every time supercollider starts? Or some commandline tool to inspect/connect the graph that I could use to wrap the invocation to scsynth?
Awesome! very happy to see you got this far. I've made a tidied up PR with the most important changes and fixes: https://github.com/overtone/overtone/pull/510
What I'm currently doing is using my casa.squid.jack
library to make the connections
(require '[casa.squid.jack :as jack])
(defn overtone-ports []
(filter #(re-find #"Overtone|SuperCollider" %)
(jack/ports @jack/default-client #{:audio :out})))
(defn overtone-conns []
(map vector
(overtone-ports)
(jack/ports @jack/default-client #{:audio :physical :in})))
(jack/connect (overtone-conns))
I want to get the current set of changes on main in and in that PR out in a new release, and then in the next cycle I want to see how people feel about depending on casa.squid.jack
to do the connections, instead of shelling out to jack_lsp
Could you also try this out:
(use 'overtone.inst.synth)
(fm-demo)
?
This is a synth which uses mouse-x
/`mouse-y`, which didn't work for me at first on wayland, but now it seems to work. I'm guessing it's using xwayland to get those coordinates.Hmm going to try again on the desktop, but tried it on my laptop which is back on 22.04/jammy. Used the branch you recommended and was not able to connect to scsynth. I'm seeing jack-is-running? assert failures. It's possible I missed some other step, but it's looking like the directions might work for absolute latest ubuntu with whatever pipewire version it has baked in, but is not working on previous versions.
If I don't use the pw-jack wrapper I get an error about 50 attempts to connect from http://overtone.sc.machinery.server.connection/external-connection-runner (connection.clj:167)
That's annoying, I admit I'm mainly testing on ubuntu 23.10. My main advice would be to go back to first principles, run scsynth manually, figure out how to get that to work properly, then move on to connecting from overtone. There are potentially things we could do to make this "just work", like setting the LD_LIBRARY_PATH variable ourselves under certain conditions. But older distros will also have older pipewire's with less good Jack support. It may make more sense to recommend that people run actual jackd in this case. Like I wrote, it's an annoying transitional period (once again), which is part of the reason I don't want to put too much special casing into the code. As time goes by and people upgrade these kind of issues should resolve of their own accord.
That said I do need to do something about jack-is-running?
, that assertion will fail even if we do have pipewire with jack support.
I replaced the assertion with an information message, it will simpy check if it finds any jack or pipewire processes, and report on that
[INFO] Found SuperCollider server: /usr/bin/scsynth (configured in /home/arne/.overtone/config.clj)
--> Booting external SuperCollider server...
[INFO] Booting SuperCollider server (scsynth) with cmd: /usr/bin/scsynth -u 31001 -b 1024 -z 64 -m 262144 -d 1024 -V 0 -n 1024 -r 64 -l 64 -D 0 -o 8 -a 512 -R 0 -c 4096 -H Overtone -i 8 -w 64
[INFO] Found Jack-compatible server process:
[INFO] 4746 arne /usr/bin/pipewire
[INFO] 4747 arne /usr/bin/pipewire -c filter-chain.conf
[INFO] 4758 arne /usr/bin/pipewire
--> Connecting to external SuperCollider server: 127.0.0.1:31001
if it can't find one, it will warn about that, but continue regardless
[INFO] Found SuperCollider server: /usr/bin/scsynth (configured in /home/arne/.overtone/config.clj)
--> Booting external SuperCollider server...
[INFO] Booting SuperCollider server (scsynth) with cmd: /usr/bin/scsynth -u 31001 -b 1024 -z 64 -m 262144 -d 1024 -V 0 -n 1024 -r 64 -l 64 -D 0 -o 8 -a 512 -R 0 -c 4096 -H Overtone -i 8 -w 64
[WARN] Could not find Jack or Pipewire, starting SuperCollider (scsynth) will likely fail
--> Connecting to external SuperCollider server: 127.0.0.1:31001
To make sure Overtone uses pw-jack, what you can do is create a wrapper script, e.g. ~/bin/pw-scsynth
#!/bin/sh
exec pw-jack scsynth "$@"
Then configure that in ~/.overtone/config.clj
{,,,
:sc-path "/path/to/pw-scsynth"
,,,
}
I'm very sorry that this is all still so challenging, but your feedback is tremendously helpful and appreciated! The above is all available in my arne/next
branch.
No worries, definitely understand it being a work in progress. After updating to Ubuntu 23.10 on my laptop it's working again using your latest on arne/next. So I think it might make sense to just recommend latest ubuntu or equivalent for that documentation on pipewire. I suspect there are workarounds on prior versions but better to clarify that's the basis for the documentation. I did test the fm-demo example and it worked. Haven't had a chance to dig into casa.squid.jack just yet, but will try and check back and see. Was there anything else you wanted me to check? One side note, I was trying to find the source using cider and ran into some issues with jump to because of all the namespace immigration overtone is doing. I suspect there are lots of tutorials using that approach to inject for historical reasons and for live coding, but I'm hoping some of the docs can update to use aliases instead as I think it helps in the long term.
I think we're good for now. Thank you for all the testing. Overtone does make a ridiculous amount of use of :use
(i.e. :refer :all
), it seems to have been a deliberate choice to not have the user worry about the different namespaces. I think to an extent that makes sense, since it's really a DSL. It's like you're not writing plain clojure but "overtone clojure", it's like a separate language. I also tend to refer :all for clojure.test for instance. So I'm not sure the docs should change that much, I think this approach is fine. I would like to see the overtone codebase internally use more explicit aliases to make it easier to follow.
Making sure jump-to-definition works is kind of a separate issue. Overtone does some weird stuff with the importing, it basically creates vars containing vars. Maybe we can improve how it propagates var metadata so cider still does the right thing.
A lot of things also don't really have a definition as such. All the ugens are generated from metadata.
FWIW jump-to-definition does seem to work for me for actual functions and macros, e.g. I can jump to definst
or boot-external-server
. I can't jump to something like sin-osc
because there isn't really anywhere to jump to.
I added some logic to my branch to automatically run scsynth through pw-jack. Only if ◦ we're on linux ◦ we can see a running pipewire process ◦ there is no running jackd or jackdbus process ◦ pw-jack is on the PATH
Thanks, I'll try and give that a test sometime tomorrow or this weekend. For the jump to definition, it was mostly that a bunch of things were not jumping to the source but to where immigrant was moving it into a namespace. But sometimes it just worked too, so not sure.