After looking around to find some different ways of using a TempoClock, I was interested to see this video on Risset rhythms (on YouTube by ‘Polo’). I thought I’d copy out the code and try something myself, but for some reason it doesn’t seem to work.
So, here’s the bit of code I was using to try out the basic idea/syntax, which from what I can see is correct. Could someone explain why nothing is happening?
Just tried some extra ideas to see if I can get something to work, and found a very odd behaviour. I just tried replacing poll with the following, which worked for a few minutes.
As you see I put in postln to see if anything worked, and indeed I got the key values printed out in the post window. I then paused the players to make some adjustments, and since then it’s back to radio silence!?
I’m trying this at the moment and it seems to work again. However, if you notice, in my second post I say that the whole pattern just seemed to stop work - it didn’t produce sound, or print out the key values. Could using poll somehow have bugged/blocked a Pdef/Pbind process in some way?
What I found strange was that when running the two patterns, Pdef(\melody) happily played away, just ignoring Pdef(\tempo), which I assume meant Pdef(\tempo) wan’t producing anything. And, as I said, at one point neither of them seemed to work - they just sat and did nothing, not even produce sound!
Also, in Pbind(... stuff...).collect { |ev| ... do stuff... }, it’s essential that the collect function returns the event. Yours ends with i.postln so for each event, it’s waiting for an integer duration, and not the 0.25 you expected.
If I had a nickel for every time I made that same mistake…
Never mind, you confused me by naming your event i
Ooops. Actually, I just called it 'i' because it was going to produce the 'index'. If I understand correctly, you can call your argument anything, but I guess there’s some automatic conventions for certain functions.
Anyhow, it seems to working no, so I guess there was probably a bug somewhere in/on my computer. I remember Daniel Mayer helping me out with a Pbindef which sort of ‘hung’, but wouldn’t restart. It might have been a similar problem to that I guess.
There aren’t any automatic conventions in the interpreter – you can, in fact, call it whatever you like. It happens in this case that i collides with one more or less standard naming convention, that i is typically used for a numeric index, as in array.do { |item, i| ... } or in C, for(i = 0; i < n; i++).
The name isn’t wrong per se, but for programmers reading the code, it’s a bit like deciding that rust is the word you’re going to use for the color of a banana – even with an explanation, when readers see the word “rust,” they are likely to think of a dark burnt orange rather than the yellow that was intended. (It isn’t an index that you’re getting the index from – it’s an event – so IMO event.index or ev.index would be clearer for humans.)
I can’t see from the examples here why the pattern(s) might have gotten stuck, I’m afraid.
As I said, I hadn’t thought about that, but now you mention it I guess it’s a good habit to try and get into. As for the code, it seems to working fine now, so I guess I’ll forget about it for now.
In the meanwhile, I liked the rust - bananas comparison, definitely a title in there somewhere.