Question about an example and inst-fx!

126 views
Skip to first unread message

wolf...@gmail.com

unread,
May 10, 2013, 7:23:34 PM5/10/13
to over...@googlegroups.com
Here is the example from the overtone source: https://github.com/overtone/overtone/blob/master/src/overtone/examples/instruments/external.clj#L16

I have my input routing to my output effectively, but inst-fx! is not doing anything for me (despite following the example file verbatim). I'm doubly confused by the comment at the end of the example file:
; you can't remove or insert fx currently, so you have to clear and add them again
What is this supposed to mean? Is inst-fx! currently not working, or is this just trying to say that the only way to remove a single effect is to clear them all and readd the ones you want?

Thanks!
-Kane

Roger Allen

unread,
May 11, 2013, 12:01:06 PM5/11/13
to over...@googlegroups.com
If I bring up a repl, I can hear inst-fx! doing something.  Maybe try an example that doesn't use the external input?

(definst sss [freq 440 gate 1]
  (* (sin-osc freq) (env-gen (adsr 0.1 0.1 0.8 0.1) :gate gate :action FREE)))
(sss)                         ;; simple sine wave
(ctl sss :gate 0)             ;; stop it
(inst-fx! sss fx-distortion2) ;; add distortion to that simple sine wave
(sss)                         ;; distorted sine wave, more like a square wave
(ctl sss :gate 0)             ;; stop it

The comment at the end means that there isn't a way to manipulate the fx chain you create.  You can only build up a chain of fx that connect to an instrument and clear that chain of fx and start again if you want to make a change.

Does that work for you?

--Roger

wolf...@gmail.com

unread,
May 11, 2013, 3:46:41 PM5/11/13
to over...@googlegroups.com
You're right, your code totally works. I should have thought to try it on an internal synth... so is the following use-case not supported?

  (definst output [vol 1]
    (do (out 0 (* (sound-in 0) vol))
        (out 1 (* (sound-in 1) vol))))

   (output)   ; turn output on, now I can hear the inputs from the outputs

   (inst-fx! output fx-distortion2) ; turn on distortion, no audible change. am i doing something wrong or is this broken atm?

I am using Overtone 0.9.0-SNAPSHOT, but this also did not work with Overtone 0.8.1.  Should I submit a bug report?

-Kane

p.s. Roger, I've put a good amount of work into a Shadertone project and am very appreciative of your help!
The project is for a class and is pretty cool, when I have it more completed I'll post a demo of it.

Roger Allen

unread,
May 11, 2013, 5:31:48 PM5/11/13
to over...@googlegroups.com
I'd never tried out sound-in before and it wasn't convenient to make noise earlier in the morning, but I just tried the external.clj example and it seems to work for me.  I put on headphones and found that fx-echo was a good fx to hear that something was happening.  

I'm on Mac OS 10.7.5 & overtone 0.8.1.  Maybe there is some bug with your particular setup?  I'm not sure, but an issue report might help with tracking it down.
 
For your code below, note that the definst will wrap your code in (out 0 (pan2 ...)) for you, so you probably don't want to add those (out ...) calls in your example.  

I just happened to be playing with chaining effects together this week and had to break things down and code up some simple defsynth (note--not definst) examples before things made sense.  Take a look at https://github.com/rogerallen/explore_overtone/blob/master/src/explore_overtone/synth_bus.clj and maybe it is helpful?  (Warning, I'm still learning, too)

--Roger

p.s. great to hear you are having success with shadertone.  I'd love to see/hear any uses of it...

Sam Aaron

unread,
May 13, 2013, 2:06:34 AM5/13/13
to over...@googlegroups.com
Hi Kane,

On 11 May 2013, at 20:46, wolf...@gmail.com wrote:

> You're right, your code totally works. I should have thought to try it on an internal synth... so is the following use-case not supported?
>
> (definst output [vol 1]
> (do (out 0 (* (sound-in 0) vol))
> (out 1 (* (sound-in 1) vol))))
>
> (output) ; turn output on, now I can hear the inputs from the outputs
>
> (inst-fx! output fx-distortion2) ; turn on distortion, no audible change. am i doing something wrong or is this broken atm?
>
> I am using Overtone 0.9.0-SNAPSHOT, but this also did not work with Overtone 0.8.1. Should I submit a bug report?

I've been working on a GraphViz viewer that should make it easier for you to see what's going on in this situation. In the next release, you'll be able to call:

(show-graphviz-synth output)

and provided that you've already manually installed Graphviz, it should pop up a graph version of your synth design. I've attached the currently generated graph of your output synth to this email.

Notice how it looks pretty messed up - it's got multiple output ugens (3 in fact!). The two connected outputs are the ones you've specified in your synth design, the third (with bus 55) is the one created by the definst for you.

As Roger suggested, you typically want to use defsynth when trying to debug things, as it doesn't do anything automatic for you. However, you *do* need definst if you want to use the inst-fx! stuff.

The reason why it's not working for you is that inst-fx! will work on the bus assigned to that inst (in this case bus 55). However, in your synth design nothing is being piped into bus 55, only bus 0 (which is directly out to the sound card, therefore bypassing any FX chain you set up).

Out of interest, why are you trying to read from sound-in 0 and 1? Do you have a stereo mic (or two mono mics) attached?

Sam

---
http://sam.aaron.name

output.pdf

wolf...@gmail.com

unread,
May 13, 2013, 2:27:08 PM5/13/13
to over...@googlegroups.com
I am using Supercollider in Jack, so I am routing audio streams into Overtone from other programs (ie Mixxx http://www.mixxx.org/).

The purpose of this is to use Overtone to control the audio with code while simultaneously leveraging ease of use / other advantages given by other software.

This was the only way I could find to read stereo input. Do you have another suggestion, one that would work with inst-fx!? Ultimately I want to route each deck from Mixxx separately, so I'll need 2 separate sets of stereo inputs.

Thanks for the help!
-Kane

Sam Aaron

unread,
May 13, 2013, 3:52:54 PM5/13/13
to over...@googlegroups.com
Hey Kane,

how about this:

(definst output2 [amp 1 initial-bus 0]
(* amp (in:ar (+ (num-output-buses:ir) initial-bus) 2)))

I've attached a Graphviz version of this synth if that helps.

Let me know if it works for you...

Sam

---
http://sam.aaron.name
output2.pdf

Sam Aaron

unread,
May 13, 2013, 5:33:17 PM5/13/13
to over...@googlegroups.com
Another, perhaps simpler, options is:

(definst output3 [amp 1]
(* amp (sound-in [0 1])))
output3.pdf

wolf...@gmail.com

unread,
May 29, 2013, 5:05:33 AM5/29/13
to over...@googlegroups.com
Hey Sam,

Thanks so much for the detailed responses! Option3 works beautifully :)

-Kane

p.s. sorry it took so long getting back to you on this - i was busy with finals and end-of-semester things.
> <output2.pdf>
>> --
>> You received this message because you are subscribed to the Google Groups "Overtone" group.
>> To unsubscribe from this group and stop receiving emails from it, send an email to overtone+u...@googlegroups.com.
>> For more options, visit https://groups.google.com/groups/opt_out.
>>
>>
>


--
You received this message because you are subscribed to a topic in the Google Groups "Overtone" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/overtone/GPZ56L4DJUc/unsubscribe?hl=en.
To unsubscribe from this group and all its topics, send an email to overtone+u...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Reply all
Reply to author
Forward
0 new messages