overtone

Joakim Verona 2025-02-06T00:01:27.725859Z

I want to have some form of stereo instruments. This example is from the sources: (definst bar [f1 100 f2 200 f3 300 f4 400] (mix (pan2 (sin-osc [f1 f2 f3 f4]) [-1 1 -1 1]))) (bar)

Joakim Verona 2025-02-19T12:10:54.730129Z

great @frankleonrose! I will try this

Joakim Verona 2025-02-19T19:42:39.704859Z

I tried it, and it works!

🎉 1
Joakim Verona 2025-02-19T19:42:48.581529Z

great work @frankleonrose

1
Joakim Verona 2025-02-19T19:43:20.295429Z

I was also trying to patch the stereo mixer but i never got it working

Joakim Verona 2025-02-19T19:43:27.439339Z

tnx again!

Joakim Verona 2025-02-19T20:00:14.544349Z

finally i can listen to sine waves in stereo it sounds like eliane radigue lol!

❤️ 1
frankleonrose 2025-02-19T07:22:40.222959Z

@joakim, I suspect this is the answer: https://github.com/overtone/overtone/pull/592

Joakim Verona 2025-02-06T00:01:51.368579Z

but it doesnt play in stereo.

Joakim Verona 2025-02-06T00:02:19.780599Z

I tried different permutations, but I cant get the intended stereo effect. Any hints?

xandrews 2025-02-06T00:26:29.750869Z

Mix merges channels into a single channel. Try splay to mix many channels into a stereo pair

Joakim Verona 2025-02-06T00:58:10.600339Z

like this right? i dont get the stereo feel still. (definst bar [f1 100 f2 200 f3 300 f4 400] (splay (pan2 (sin-osc [f1 f2 f3 f4]) [-1 1 -1 1]))) (bar)

Joakim Verona 2025-02-06T01:02:51.672819Z

sorry, this: (definst bar [f1 100 f2 200 f3 300 f4 400] (splay :spread 1 :in-array (sin-osc [f1 f2 f3 f4])))

Joakim Verona 2025-02-06T01:04:49.628209Z

alright, this has a stereo effect, so theres something with inst that removes the stereo: (demo (splay :spread 2 :in-array (sin-osc [100 200 300 400 500])))

Joakim Verona 2025-02-17T23:16:03.745689Z

for reference, this is foo2, and it unexpectedly plays in mono

Joakim Verona 2025-02-17T23:16:07.690599Z

Joakim Verona 2025-02-17T23:17:43.187359Z

this is foo which plays in stereo, also unexpectedly, because why does it make a difference if i add an out

Joakim Verona 2025-02-17T23:17:47.424849Z

Joakim Verona 2025-02-22T11:39:17.273339Z

hmm i will try

Joakim Verona 2025-02-22T23:50:52.772009Z

@frankleonrose i dont think i understand what you mean. Do you mean i should make an fx that just copies input to output?

frankleonrose 2025-02-22T23:57:29.578019Z

Or ignores the input entirely. Just trying to come up with an effect that will show whether one or both of the stereo channels is dropped. If you made a stereo inst with sine wave on left channel and sawtooth on right, then apply an fx that halves the signal with an odd bus # and doubles the signal with even bus #, you could see in the output whether both input channels get through and are affected as intended. Basing the effect on bus # is just a strategy to do something different for the two channels, despite the fact that only the one fx is passed to inst-fx!. I’d try it myself, but AFK for a bit.

Joakim Verona 2025-02-22T23:58:45.065089Z

tnx

Joakim Verona 2025-02-09T23:11:33.331689Z

definst behaves oddly i think:

(definst foo[] (out 0 (splay :spread 2 :in-array (sin-osc [100 200 300 400 500]))))
(definst foo2[]   (splay :spread 2 :in-array (sin-osc [100 200 300 400 500])))

;; plays in mono, the sines are mixed down to mono
(foo2)
;; plays in stereo, the sines are distributed between the stereo channels
(foo)

;; examine the graphs they look very similar, except the out nodes are different
(show-graphviz-synth foo2)
(show-graphviz-synth foo)

Joakim Verona 2025-02-09T23:12:43.565589Z

my expectation was for foo to behave same as foo2

Joakim Verona 2025-02-09T23:13:23.427149Z

also foo doesnt work with inst-fx!

frankleonrose 2025-02-12T21:31:20.788429Z

(definst foo[] (out …. doesn’t survive. I think it’s https://github.com/overtone/overtone/blob/1cfc0a06eb39c913c318f6517a161952ef322e75/src/overtone/sc/synth.clj#L385-L388 that removes the out. So it’s surprising to me that the two have different graphs. definst routes stereo insts final ugen to the inst-bus (to merge with all notes from the inst) which then gets mixed down to master output (with pan & volume and bad values discarded and good values limited) with https://github.com/overtone/overtone/blob/master/src/overtone/studio/inst.clj#L54-L65. Note that :spread 1 results in -1 to 1 panning of input sines, by my read of https://github.com/overtone/overtone/blob/1cfc0a06eb39c913c318f6517a161952ef322e75/src/overtone/sc/cgens/mix.clj#L36-L41. That may account for how some of it sounds different from your expectation.

Joakim Verona 2025-02-21T23:53:24.062169Z

what about stereo effects?

Joakim Verona 2025-02-21T23:53:54.891779Z

I tried this with the foo2 stereo instrument above

Joakim Verona 2025-02-21T23:53:56.890349Z

(defsynth fx-chorus-stereo [bus 0 rate 0.002 depth 0.01] (let [src (in bus 2) dub-depth (* 2 depth) rates [rate (+ rate 0.001)] osc (+ dub-depth (* dub-depth (sin-osc:kr rates))) dly-a (delay-l src 0.3 osc) sig (apply + src dly-a)] (replace-out bus (* 0.3 sig))))

Joakim Verona 2025-02-21T23:54:50.403549Z

I just added 2 to the number of channels in the (in bus 2)

Joakim Verona 2025-02-21T23:55:14.742909Z

im not sure what should be the correct way of doing this

Joakim Verona 2025-02-21T23:55:48.575529Z

Intuitively the fx-chorus should adapt to stereo if the input is stereo

Joakim Verona 2025-02-21T23:58:56.549769Z

if you just use the standard fx-chorus some conversion to mono is done im not sure if conversion is done by ignoring one of the stereo chonnels or if a mix happens, but it sounds more like the right channel is being ignored

frankleonrose 2025-02-22T06:10:59.008499Z

The :stereo multimethod for inst-fx! looks like it should handle applying the fx to both channels:

(defmethod inst-fx! :stereo
  [inst fx & args]
  (ensure-node-active! inst)
  (let [fx-group (:fx-group inst)
        bus-l    (to-sc-id (:bus inst))
        bus-r    (inc bus-l)
        fx-ids   [(apply fx [:tail fx-group] :bus bus-l args)
                  (apply fx [:tail fx-group] :bus bus-r args)]]
    fx-ids))
What if you try an FX that just replaces the input with (dc (mod bus 2)) or some other expression that depends on bus. That way you could tell whether you’re getting two different channels of output.

frankleonrose 2025-02-23T08:12:13.572079Z

I did try it - seems to work fine.

(o/definst sin-saw []
    (-> [(o/sin-osc 500)
         (o/saw 500)]))

  (def snd (sin-saw))

  (o/defsynth split
    [bus 0]
    (let [dry (o/in bus)
          selector (- (o/round-up bus 2) bus)
          wet (o/select selector [(o/dc 1.0) (o/dc 0.5)])
          wet (* wet dry)]
      (o/replace-out bus wet)))

  (o/inst-fx! sin-saw split)
Specifically, adding split fx to sin-saw halves the amplitude of just one of the channels.

Joakim Verona 2025-02-23T18:20:57.684179Z

hmmm tnx for looking into this

Joakim Verona 2025-02-23T18:21:37.110919Z

how do you generate the graphs?

frankleonrose 2025-02-23T18:52:12.843389Z

Start Supercollider outside of Overtone and then connect. Scope in SC works.

Joakim Verona 2025-02-13T08:40:14.723959Z

tnx, @frankleonrose i will have a look