First time here? Check out the FAQ!

ways to do a physical model of a bouncing ball in kyma

0 votes


i just looked into kurt´s BouncingBallSequencer example to get an idea how we could achieve a physical model of a bouncing ball in kyma. i bet there are other ways to do it, but i couldnt found examples in the kyma soundlib yet. maybe a combination of swarmFollowFromPosition and the threshold prototype would work? any ideas/ feedback on this is very much appreciated…

as a start i stick with kurts sound and made some changings, add a random deviation on timing/duration so every single bounce has a slight offset for more liveliness.

here is the sound:

trigger the bouncing-sequence (no loop) via !keydown. 

anyway, it doesnt work 100% like it should. for example at the end of the sequence there is kind of a burst and the random devialtion seems to skip some of the "bounces" (when using higher values in the vcs for randDurDev). so if you have an idea how i could improve it…

thanks for taking the time. ciao, johannes


EDIT: here is the bouncing ball version using swarmFollowFromPosition:

asked Aug 9 in Using Kyma by x (Practitioner) (550 points)
edited Aug 10 by x
The burst at the end sounds natural to me (like when you restrict a bouncing ping pong ball with a paddle & it gets faster & faster).  Maybe you have to restrict the random deviations to some fraction of the fastest bounce to avoid skipping bounces?
thanks ssc. the random deviation restriction is a good idea… will give it a try.
i add another kym. you can find it in my first post in this thread.

i found an alternative way to create the bouncing ball model using "swarmFollowFromPosition". the sound isn't perfect yet but now started to sound like a sequence if bounces… in combination to the randomtimedeviation i add some decent amp and freq modulations for the individual bounces.

the capytalk-scripts to create the random amps/freqmods might be a bit complicated. so iam
looking forward to hear from you and get some feedback. thanks
Interesting idea; it looks like you are using the exponentially decaying oscillation of the swarmFollow to get the accelerating timing of the bounce and the threshold to model collision with a surface.  It sounds good!
exactly, its getting really interesting now. iam using the decaying envelope for the amplitudes and decay-times of the bounces. so the bounces gets quiter and bit shorter at the end.  

the tricky part of the bouncing ball is the transition from the fast bounces (at the end) to the point where the ball stopped moving.  iam thinking about using some feedback delay to get this dense noise like sound at the end… we will see if this work.
this is dope, thanks for uploading it! Stoked to look through how you implemented it, as I can fumble around in capytalk but smalltalk (other than the collect message) is still pretty foreign to me. I'm really excited to experiment w/ physical modeling in kyma but other than karplus-strong stuff, it's all pretty difficult to grasp at this point.
thanks aaron, i am at the very beginning of understanding kyma too.

if you connect a constant with swarmFollowFromPosition (short: sftp) and an oscilloscope and look at the output of sffp signal you will notice, that when triggered the sftp outputs an oscillation with decaying amplitude. of couse sftp is more complex than this, but for the bouncing ball example thats what i use for the triggering (via the threshold prototype). the threshold parameter is set to 0.01, so it sends a trigger when sffps output (centered at 0) exceed it. but this would leed to a steady bouncing ie. with a constant rate. what we need for our bouncing ball model is an decreasing interval between the bounces. to achieve this i control the velocity parameter, which defines the speed of the oscillations, with the inversed and smoothed amplitude of sftps output (using the amplitude follower prototype).

btw. i can recommend andy farewell´s book on physical modelling called designing sound. its splitted into a theoretic and and a practical part – with puredata code examples (freeware).

hope you get an idea…

1 Answer

+1 vote
Best answer

Hey Johannes,

Have you had a look at gateTimeToNext:dutyCycle: (and its little brother triggerTimeToNext:). Looking at your Sound all you need are the exponentially decaying gates, which totally resembles a ball. Everytime it bounces up it reaches a percentage of the previous height it fell from before it bounced back.

For example:

| dur |

dur := EventVariable new.

((!Reset ramp) gateTimeToNext: 
(dur <~ (!Reset true: !StartTime false: (dur * !DecayFactor)))
dutyCycle: !DutyCycle)
* (dur ge: !MinDur)

Here is an example Sound as well:

Does that help?



answered 5 days ago by kymaguy (Master) (8,230 points)
selected 4 days ago by x
wow gustl, that definitely helps and is exactly what i was looking for.

no i didn't know about: gateTimeToNext. it seems to be more efficient and precise (timing wise) than using bpm with an incrementing rate.
i wonder if it would be possible to change the decay factor over time – while running the script – from lets say 0.9 to 0.5. so at the end the duration decreases much faster than at the beginning … danke
Sure, the DecayFactor is a hotValue so you can change it manually as the Sound runs. Or you could use any Capytalk expression. You could even make it a function of dur, like
((dur gt: 0.5) true: 0.9 false: 0.5) or
(dur into: #({1@0.9}{0.5@0.5}).
Many many ways ;)
great input, specially using it as a function of dur.  2 fliegen, 1 klappe…