overtone

plexus 2023-12-01T09:36:45.317849Z

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

👍 3
👍🏻 1
❤️ 5
1
plexus 2023-12-06T08:06:09.171819Z

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.

plexus 2023-12-06T08:07:28.952269Z

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.

plexus 2023-12-06T08:49:13.118239Z

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

plexus 2023-12-06T08:49:41.868479Z

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

plexus 2023-12-06T08:53:35.902089Z

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"
,,,
}

plexus 2023-12-06T08:54:44.276059Z

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.

Charles Comstock 2023-12-06T09:24:01.794379Z

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.

💯 1
plexus 2023-12-06T10:31:25.855729Z

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.

plexus 2023-12-06T10:31:50.913729Z

A lot of things also don't really have a definition as such. All the ugens are generated from metadata.

plexus 2023-12-06T10:33:40.402889Z

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.

Charles Comstock 2023-12-01T18:12:09.479419Z

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.

plexus 2023-12-01T21:25:55.983149Z

That is indeed great feedback! I'll try to incorporate some of it.

Charles Comstock 2023-12-01T22:43:19.934659Z

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.

Charles Comstock 2023-12-01T22:44:27.634489Z

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?

Charles Comstock 2023-12-01T23:10:06.675519Z

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.

plexus 2023-12-05T09:09:47.821559Z

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

plexus 2023-12-05T09:11:16.492549Z

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))

plexus 2023-12-05T09:12:36.547309Z

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

plexus 2023-12-05T09:13:35.214459Z

https://github.com/plexus/casa.squid.jack

plexus 2023-12-05T09:14:40.119659Z

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.

Charles Comstock 2023-12-06T06:34:30.852419Z

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.

Charles Comstock 2023-12-06T06:37:54.930359Z

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)

plexus 2023-12-07T08:11:19.479119Z

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

Charles Comstock 2023-12-08T07:36:46.611449Z

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.

Charles Comstock 2023-12-05T04:24:16.909789Z

{: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.

Charles Comstock 2023-12-05T04:26:11.977439Z

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?

plexus 2023-12-02T09:29:34.581719Z

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)

plexus 2023-12-02T09:30:37.842939Z

Overtone once again tries to be too smart, it wants to connect supercollider to Jack for you

plexus 2023-12-02T09:31:28.446469Z

There's another issue with that code, it does some matching on the device name, but those names are different under pipewire

plexus 2023-12-02T09:33:20.252009Z

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

plexus 2023-12-02T09:33:52.989779Z

jna-jack lets us query explicitly for hardware devices

plexus 2023-12-02T09:34:31.900889Z

Are you running overtone from clojars, the repo, or my wip branch?

Charles Comstock 2023-12-02T16:31:22.485659Z

I was trying it from clojars yesterday. Won't be able to test today, but I can try from a git branch soon