I had been meaning to play around with some additive synthesis in
overtone and I thought the best way to start was with synthesising a
bell sound - arguably the easiest of them all.
https://gist.github.com/1467356
Basically a bell is just a bunch of sine-oscs at relative frequencies
added together with varying levels and release times. I gave each one
its own envelope and mixed them down relatively too, following this
article:
http://www.soundonsound.com/sos/Aug02/articles/synthsecrets0802.asp
and this one too:
computermusicresource.com/Simple.bell.tutorial.html
You can mess around with partial ratios to get duller and brighter
sounding bells - I have two examples from those two articles making
two different bells: dull-bell and pretty-bell. Technically one is not
supposed to include the main frequency but I did to make it sound a
bit more musical (your ear is supposed to make up for it). The
partials start at 0.5 which is why everything sounds a bit low.
Problems seem to arise from having a long tail on the notes when
played in fast succession - I wonder if it would be better to mix in
some reverb rather than just having N perc envs at varying cutoffs.
To test it all, I added a small, festive demo. Note that this is
really slow but any faster and you get clipping as explained before.
Let me know what you think!
Jen
It would be interesting to know if the klang and klank ugens would be useful for this sort of stuff.
Sam
P.S. I'd definitely encourage you to flesh out the bell-partials cgen - i.e. add defaults and docstrings :-)
take a look here: https://gist.github.com/1467798
I worked out what was causing the weird clipping. It was a very subtle bug - unfortunately you weren't freeing your synths correctly, so SC started eating up more and more CPU the more synths you fired. If you look at your version of the defcgen you have this envelope def:
(env-gen (perc 0.01 (* dur %2) ) FREE)
Unfortunately, although you're on the right track, this doesn't work as expected. The signature for env-gen is:
[envelope :none, gate 1.0, levelScale 1.0, levelBias 0.0, timeScale 1.0, action 0]
so you're passing the value of the constant FREE (which happens to be 2) as the 2nd param which in this case is the gate. You could try fixing it as follows:
(env-gen (perc 0.01 (* dur %2) ) :action FREE)
which *would* be closer, but still wouldn't work as expected. This will free the synth, but it will free as soon as the shortest envelope has completed, which in the case of a larger number of partials will be very quick indeed :-)
Ideally, you want the synth to free itself when the bells have stopped ringing. Luckily there's a ugen that has exactly this behaviour and it's called #'detect-silence. You pass it a signal, and when it detects silence (with a modifiable threshold) you can trigger an 'action' which in this case you'd like to FREE the containing synth. In my version of your lovely Troika piece, I added this to the definst itself rather than in the bell-partial cgen (which I also spruced up with some docs and defaults).
Thanks once again for such lovely work. It was a real joy to play with! I'm looking forward to seeing what you come up with next. Keep on gisting!
Sam
On 12 Dec 2011, at 14:48, Jen Smith wrote:
> I was going to look next into getting numbers out of supercollider to see why it was getting crashy - possibly using the scope vizualisation thing. Might be good for debugging anyway.
It's a simple trick, but the way I realised something was wrong with the synth was by triggering it a few times on the REPL. Each time you trigger a synth, you get an id back representing the running instance of the synth that you triggered. Every new synth you trigger has a new id - it chooses the first available id. This means, if the second time you trigger the synth happens after the first synth has finished you'll get the same id. If the first synth hasn't finished you'll get a higher id. So, by triggering a synth multiple times, if you keep getting higher ids, you know that the previous synths haven't been freed. If the ids start cycling, you know the synths are being freed correctly :-)
Sam
would you mind if we included your Troika piece in the examples directory?
Sam
>
> Re. the synth IDs thing, is there some kind of call we can make to determine how many are currently active? That might be quite useful!
You can get all sorts of info about the server (including the number of active synths) with #'server-info and #'server-status :-)
Sam
Cheers,
Jeff
On Monday, December 19, 2011 at 1:54 AM, Jennifer Smith wrote:
> That would be really cool!
>
> I might look at how I can use that cgen to plug into other examples - like the wobble too. I haven't really figured out how all the bits plug in together.
>
> Re. the synth IDs thing, is there some kind of call we can make to determine how many are currently active? That might be quite useful!
>
> Jen
>