I’m starting a new topic to carry on the tangent I started in another topic over here.
For background, I noticed that the piano synth, which in Sonic Pi only supports whole midi notes, actually has a
tune parameter that looks like it should allow setting fractional notes (here in the Supercollider source).
So, I wanted to try compiling a synthdef that connected up the
tune input and see if I could get it working. However, I have no experience with Supercollider/Overtone/synthdefs etc., so there’s a bit of a learning curve.
After a bit of trial and error I managed to get the existing piano synthdef recompiled (I created a new Clojure Leiningen project with a dependency on overtone, and eval’d this line in a repl after pulling in
overtone.live, which wrote a new
My initial try at deriving the
tune parameter from the fractional part of the
note input caused it to fail to compile, with:
CompilerException java.lang.ClassCastException: overtone.sc.machinery.ugen.sc_ugen.ControlProxy cannot be cast to java.lang.Character, compiling:(sonic_pi/synths/traditional.clj:19:1)
I’m not sure exactly what that means, bit I think it means I can’t just use standard Clojure functions in the synthdef; is that the case?
In any case, to verify that the
tune parameter actual does what I suspect/hope, I decided for now to just add a parameter to the synthdef and wire it directly to the same parameter in the Supercollider synth. After recompiling the synthdef I copied the resulting file over the one in my downloaded Sonic Pi app, but changing the
tune parameter didn’t seem to do anything to the sound. I also tried modifying
synthinfo.rb to add the parameter but that didn’t help. The changes I made are here, and the code I tried in Sonic Pi is:
[-1, 0, 0.5, 1, 2].each do |t| synth :piano, note: :c4, tune: t sleep 0.2 end
I’m not sure that the parameter I’m setting in Sonic Pi is actually making it into the synth. Do I have to do anything else to make Sonic Pi aware of the new synth param?
Can I just patch my changes into a downloaded Sonic Pi release as I did, or do I need to compile it myself with the changes? I’ve spent a bit of time trying to get the build working, but have been unsuccessful so far.
Any help/pointers would be appreciated.