# External synth has distorted lissajous art rendering

**URL:** <https://in-thread.sonic-pi.net/t/external-synth-has-distorted-lissajous-art-rendering/3189>\
**Category:** Support, Help & Resources\
**Created:** [January 24, 2020, 1:24pm UTC](https://in-thread.sonic-pi.net/t/external-synth-has-distorted-lissajous-art-rendering/3189 "2020-01-24T13:24:44Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![gedobbles](https://avatars.discourse-cdn.com/v4/letter/g/eb9ed0/32.png) [@gedobbles](https://in-thread.sonic-pi.net/u/gedobbles)\
**Post date:** [January 24, 2020, 1:24pm UTC](https://in-thread.sonic-pi.net/t/external-synth-has-distorted-lissajous-art-rendering/3189/1 "2020-01-24T13:24:44Z")

</div>

Hello everybody.  
In order to try producing some oscilloscope music using sonic-pi I created a new Ugen in Supercollider as a plugin and wrapped it with a synthdef.  
When creating a synth from that synthdef with the Supercollider-IDE there are no problems and everything works fine.  
However, when I try to play that synth from sonic-pi and display the result in the scope in Lissajous mode or on a real oscilloscope attached to my soundcard,  
the pattern is disturbed and somehow rotated.  
Therefore I think this might be a sonic-pi problem.  
Can anyone please try to reproduce this or suggest a fix?  
You can find the needed files on github: [https://github.com/gedobbles/oszi-music](https://github.com/gedobbles/oszi-music).  
Thank you for your help.

Copy files to:  
MyOsc.sc -\> to Supercollider plugins dir  
build/MyOsc.so -\> to Supercollider plugins dir

if that doesnt work, try to execute build/make\_commands to rebuild the plugin

In SupercolliderIDE:

```
(
var syn = SynthDef("tbaum",{arg out_bus=0, amp=1, note=60, sustain = 1;
	var freq = note.midicps;
	o = Out.ar(out_bus, MyOsc.ar([freq,freq],0,[0,1]) * Line.kr(amp,amp,sustain,doneAction: 2), 0.0);
});
syn.add;
syn.writeDefFile("/whatever/dir/");
)

```

In sonic-pi:

```
load_synth_defs "/whatever/dir/"
use_synth :tbaum
play 52
```

---

<div class="post-metadata">

**Author:** ![gedobbles](https://avatars.discourse-cdn.com/v4/letter/g/eb9ed0/32.png) [@gedobbles](https://in-thread.sonic-pi.net/u/gedobbles)\
**Post date:** [January 24, 2020, 3:12pm UTC](https://in-thread.sonic-pi.net/t/external-synth-has-distorted-lissajous-art-rendering/3189/2 "2020-01-24T15:12:01Z")

</div>

I found a kind of workaround, however i still want to know, why SonicPi distorts my synth.  
Something like this works:

In SupercolliderIDE

```ruby
(
var syn = SynthDef("tbaum",{arg out_bus=0, amp=1, note=60, sustain = 1;
	var freq = note.midicps;
	o = Out.ar(out_bus, MyOsc.ar([freq,freq],0,[0,1]) * Line.kr(amp,amp,sustain,doneAction: 2), 0.0);
});
syn.add;
syn.writeDefFile("/media/ext/music/oszi/synth");
)

o = OSCFunc.newMatching({|msg, time, addr, recvPort| Synth(\tbaum)}, '/play', n);

```

In SonicPi:

```ruby
use_osc "localhost", 57120
osc "/play", "Hello"

```

---

<div class="post-metadata">

**Author:** ![samaaron](https://dub1.discourse-cdn.com/flex017/user_avatar/in-thread.sonic-pi.net/samaaron/32/7_2.png) [@samaaron](https://in-thread.sonic-pi.net/u/samaaron)\
**Post date:** [February 18, 2020, 11:49am UTC](https://in-thread.sonic-pi.net/t/external-synth-has-distorted-lissajous-art-rendering/3189/3 "2020-02-18T11:49:21Z")

</div>

Hi, when you say “distorted” does your synth sound like it is being passed through a distortion effect? Or are you just saying that the wave form looks slightly different? Can you hear any difference between your synth played with standard supercollider and with Sonic Pi?

Sonic Pi has a master mixer synth which all sound is passed through which has a compressor and a number of other ugens which act as a safety system. This will definitely be affecting your sound - although it shouldn’t be audibly different.

---

<div class="post-metadata">

**Author:** ![gedobbles](https://avatars.discourse-cdn.com/v4/letter/g/eb9ed0/32.png) [@gedobbles](https://in-thread.sonic-pi.net/u/gedobbles)\
**Post date:** [February 18, 2020, 11:52am UTC](https://in-thread.sonic-pi.net/t/external-synth-has-distorted-lissajous-art-rendering/3189/4 "2020-02-18T11:52:38Z")

</div>

Thanks a lot for your fast reply.  
If you plot the outcome on the sillajous view, a tree should be visible.  
However the problem is, that the edges are not too sharp and the whole graphic is sheared to the right quite a bit, that means that probably one audio channel has a higher latency than the other I guess.  
So to fully answer your question, I at least can not hear a difference.

---

<div class="post-metadata">

**Author:** ![samaaron](https://dub1.discourse-cdn.com/flex017/user_avatar/in-thread.sonic-pi.net/samaaron/32/7_2.png) [@samaaron](https://in-thread.sonic-pi.net/u/samaaron)\
**Post date:** [February 18, 2020, 11:56am UTC](https://in-thread.sonic-pi.net/t/external-synth-has-distorted-lissajous-art-rendering/3189/5 "2020-02-18T11:56:05Z")

</div>

Ah, so you’re not talking about a distorted sound, but a distorted lissajous visualisation.

Try bypassing the global mixer and see if that helps:

```ruby
set_mixer_control! hpf_bypass: 1, lpf_bypass: 1, limiter_bypass: 1, lead_dc_bypass: 1

```

---

<div class="post-metadata">

**Author:** ![gedobbles](https://avatars.discourse-cdn.com/v4/letter/g/eb9ed0/32.png) [@gedobbles](https://in-thread.sonic-pi.net/u/gedobbles)\
**Post date:** [February 18, 2020, 12:09pm UTC](https://in-thread.sonic-pi.net/t/external-synth-has-distorted-lissajous-art-rendering/3189/6 "2020-02-18T12:09:45Z")

</div>

I just tried it out, you had a little tipoe at lpf:\_bypass (there was a : too much),  
however the same issue still occurs. Have a look:  
When i run it it Supercollider directly it is perfect and straight.

 ![screenshot_SonicPi_tree](https://europe1.discourse-cdn.com/flex017/uploads/sonic_pi/original/2X/9/9ab6c229c1ada61cf80a7ceba8fda53e9ab98333.png)

---

<div class="post-metadata">

**Author:** ![samaaron](https://dub1.discourse-cdn.com/flex017/user_avatar/in-thread.sonic-pi.net/samaaron/32/7_2.png) [@samaaron](https://in-thread.sonic-pi.net/u/samaaron)\
**Post date:** [February 18, 2020, 12:13pm UTC](https://in-thread.sonic-pi.net/t/external-synth-has-distorted-lissajous-art-rendering/3189/7 "2020-02-18T12:13:47Z")

</div>

OK, something odd is going on here then.

There’s either something happening in the signal chain to modify the sound before it gets to the visualiser, or the visualiser isn’t rendering it correctly.

I’ll take a closer look, although it might not be easy to resolve before the next release depending on how long it takes…

---

<div class="post-metadata">

**Author:** ![gedobbles](https://avatars.discourse-cdn.com/v4/letter/g/eb9ed0/32.png) [@gedobbles](https://in-thread.sonic-pi.net/u/gedobbles)\
**Post date:** [February 18, 2020, 12:15pm UTC](https://in-thread.sonic-pi.net/t/external-synth-has-distorted-lissajous-art-rendering/3189/8 "2020-02-18T12:15:56Z")

</div>

In my opinion you don’t have to concentrate on the visualizer rendering, because on a real oscilloscope attached to my soundcard, the graphings just look the same.

---

<div class="post-metadata">

**Author:** ![samaaron](https://dub1.discourse-cdn.com/flex017/user_avatar/in-thread.sonic-pi.net/samaaron/32/7_2.png) [@samaaron](https://in-thread.sonic-pi.net/u/samaaron)\
**Post date:** [February 18, 2020, 12:17pm UTC](https://in-thread.sonic-pi.net/t/external-synth-has-distorted-lissajous-art-rendering/3189/9 "2020-02-18T12:17:39Z")

</div>

Unfortunately, you’re using your own ugen here, so it’s not trivial for me to try it out without building it locally. Also, we have a new lissojous renderer in the upcoming release, so there may also be some new problems with that - so it will be useful to test it out there.

---

<div class="post-metadata">

**Author:** ![gedobbles](https://avatars.discourse-cdn.com/v4/letter/g/eb9ed0/32.png) [@gedobbles](https://in-thread.sonic-pi.net/u/gedobbles)\
**Post date:** [February 18, 2020, 12:19pm UTC](https://in-thread.sonic-pi.net/t/external-synth-has-distorted-lissajous-art-rendering/3189/10 "2020-02-18T12:19:23Z")

</div>

Yes of course it is not trivial. I have a prebuilt version on github as I mentioned in my first post.  
Thank you very much for your great effort.

---

<div class="post-metadata">

**Author:** ![samaaron](https://dub1.discourse-cdn.com/flex017/user_avatar/in-thread.sonic-pi.net/samaaron/32/7_2.png) [@samaaron](https://in-thread.sonic-pi.net/u/samaaron)\
**Post date:** [February 18, 2020, 12:24pm UTC](https://in-thread.sonic-pi.net/t/external-synth-has-distorted-lissajous-art-rendering/3189/11 "2020-02-18T12:24:49Z")

</div>

Is it prebuilt for either macOS or Windows?

---

<div class="post-metadata">

**Author:** ![gedobbles](https://avatars.discourse-cdn.com/v4/letter/g/eb9ed0/32.png) [@gedobbles](https://in-thread.sonic-pi.net/u/gedobbles)\
**Post date:** [February 18, 2020, 12:33pm UTC](https://in-thread.sonic-pi.net/t/external-synth-has-distorted-lissajous-art-rendering/3189/12 "2020-02-18T12:33:23Z")

</div>

No, it is build for  
Linux 4.15.0-76-generic #86-Ubuntu SMP Fri Jan 17 17:24:28 UTC 2020 x86\_64 x86\_64 x86\_64 GNU/Linux

---

<div class="post-metadata">

**Author:** ![samaaron](https://dub1.discourse-cdn.com/flex017/user_avatar/in-thread.sonic-pi.net/samaaron/32/7_2.png) [@samaaron](https://in-thread.sonic-pi.net/u/samaaron)\
**Post date:** [February 18, 2020, 12:34pm UTC](https://in-thread.sonic-pi.net/t/external-synth-has-distorted-lissajous-art-rendering/3189/13 "2020-02-18T12:34:09Z")

</div>

Also, one more thing to try if you have a sound card with more than 2 outputs is to use the `sound_out_stereo` FX to output to channels 3 and 4 as that currently doesn’t have a global mixer in its signal chain:

```ruby
with_fx :sound_out_stereo, output: 3 do
  # play sound here
end

```

---

<div class="post-metadata">

**Author:** ![samaaron](https://dub1.discourse-cdn.com/flex017/user_avatar/in-thread.sonic-pi.net/samaaron/32/7_2.png) [@samaaron](https://in-thread.sonic-pi.net/u/samaaron)\
**Post date:** [February 18, 2020, 12:35pm UTC](https://in-thread.sonic-pi.net/t/external-synth-has-distorted-lissajous-art-rendering/3189/14 "2020-02-18T12:35:02Z")

</div>

> [@gedobbles](#):
>
> No, it is build for  
> Linux 4.15.0-76-generic #86-Ubuntu SMP Fri Jan 17 17:24:28 UTC 2020 x86\_64 x86\_64 x86\_64 GNU/Linux

Ah ok, I currently don’t have a linux machine set up as I don’t currently have the resources to support linux at this stage. Sorry.

---

<div class="post-metadata">

**Author:** ![gedobbles](https://avatars.discourse-cdn.com/v4/letter/g/eb9ed0/32.png) [@gedobbles](https://in-thread.sonic-pi.net/u/gedobbles)\
**Post date:** [February 18, 2020, 12:38pm UTC](https://in-thread.sonic-pi.net/t/external-synth-has-distorted-lissajous-art-rendering/3189/15 "2020-02-18T12:38:16Z")

</div>

I’m sorry, I am working on my laptop here which has only got 2 channel audio, my Clavinova too.  
I could route the audio from SonicPi outputs 3 and 4 to my main out with jack audio but then I guess I could not use the lissajous view in SP any more.  
I just attach my oscilloscope for you and check whats going on on audio 3 and 4.  
The problem may also not be a linux specific problem but please try on Windows or MacOS even if it’s a little bit harder to build.

---

<div class="post-metadata">

**Author:** ![gedobbles](https://avatars.discourse-cdn.com/v4/letter/g/eb9ed0/32.png) [@gedobbles](https://in-thread.sonic-pi.net/u/gedobbles)\
**Post date:** [February 18, 2020, 1:03pm UTC](https://in-thread.sonic-pi.net/t/external-synth-has-distorted-lissajous-art-rendering/3189/16 "2020-02-18T13:03:43Z")

</div>

I just tried it out:  
On Audio 3/4 a little bit better (at least there’s hope 😄)

 ![191_IMG_20200218_134728](https://europe1.discourse-cdn.com/flex017/uploads/sonic_pi/original/2X/3/3bdd732020fae1f3de5c6c9a42e82c1bc6d4fa76.jpeg)  
But directly from Supercollider it looks like this:  
 ![192_IMG_20200218_135055](https://europe1.discourse-cdn.com/flex017/uploads/sonic_pi/original/2X/2/22bf44b89c364d22db2aa32b53868951802614a1.jpeg)

---

<div class="post-metadata">

**Author:** ![samaaron](https://dub1.discourse-cdn.com/flex017/user_avatar/in-thread.sonic-pi.net/samaaron/32/7_2.png) [@samaaron](https://in-thread.sonic-pi.net/u/samaaron)\
**Post date:** [February 18, 2020, 3:03pm UTC](https://in-thread.sonic-pi.net/t/external-synth-has-distorted-lissajous-art-rendering/3189/17 "2020-02-18T15:03:48Z")

</div>

OK, that suggests the global mixer is having an effect on the output - even with the bypassing options set. I suspect there’s more work I can do to bypass it.

However, it’s odd that using the `:sound_out_stereo` FX still produces quirks as it _should_ be piping your synth straight to the sound card’s output.

Here’s the design for that FX and you can see it just routes the audio with no modifications at all:

> <https://github.com/samaaron/sonic-pi/blob/master/etc/synthdefs/designs/overtone/sonic-pi/src/sonic_pi/fx.clj#L1310>

---

<div class="post-metadata">

**Author:** ![gedobbles](https://avatars.discourse-cdn.com/v4/letter/g/eb9ed0/32.png) [@gedobbles](https://in-thread.sonic-pi.net/u/gedobbles)\
**Post date:** [February 20, 2020, 5:51am UTC](https://in-thread.sonic-pi.net/t/external-synth-has-distorted-lissajous-art-rendering/3189/18 "2020-02-20T05:51:32Z")

</div>

I just remembered, that I had forgotten to disconnect audio channels 1 and 2 from my stereo output, when trying to use the `:sound_out_stereo` fx. Therefore, the output from the fx still being passed through to the main context (, because I did not set mix: 0 on the fx,) may have influenced the waveform on my oscilloscope.  
I will do some further testing having channels 1 and 2 completely disconnected from any output as soon as I passed my university exam today 😉 .

---

<div class="post-metadata">

**Author:** ![samaaron](https://dub1.discourse-cdn.com/flex017/user_avatar/in-thread.sonic-pi.net/samaaron/32/7_2.png) [@samaaron](https://in-thread.sonic-pi.net/u/samaaron)\
**Post date:** [February 20, 2020, 9:13am UTC](https://in-thread.sonic-pi.net/t/external-synth-has-distorted-lissajous-art-rendering/3189/19 "2020-02-20T09:13:32Z")

</div>

Good luck with your exam!!! 🙂

---

<div class="post-metadata">

**Author:** ![gedobbles](https://avatars.discourse-cdn.com/v4/letter/g/eb9ed0/32.png) [@gedobbles](https://in-thread.sonic-pi.net/u/gedobbles)\
**Post date:** [March 5, 2020, 10:37am UTC](https://in-thread.sonic-pi.net/t/external-synth-has-distorted-lissajous-art-rendering/3189/20 "2020-03-05T10:37:27Z")

</div>

Sorry for my late response, I had a couple of things to do these weeks.  
I just tried with the `:sound_out_stereo` on channels 3, 4 which worked perfectly when having SonicPi outputs 1 and 2 disconnected from my sound card or with

```ruby
with_fx :sound_out_stereo, output: 3, amp: 0 do
  play 40
end

```

I suggest the problem is the main mixer, as I described in my last post.  
By the way, do you think there might be problems building the latest SonicPi on Linux?  
And did you already think about some changes concerning the global mixer bypass opts?  
Another question: Is it possible to select channels 3 and 4 (or any other) to be rendered in the lissajous art view?

[Next page](https://in-thread.sonic-pi.net/t/external-synth-has-distorted-lissajous-art-rendering/3189.md?page=2)
