Closed rogerallen closed 11 years ago
There's definitely an issue. Crab canons should be reflecting the notes based on when they finish, not when they start.
The following now works as I'd expect:
((lc/simple 2) (lc/crab (lm/phrase [1 0.5 0.5] [4 5 6])))
I've offset the result by the full length of the melody, not the time of the last note.
Another possibility to reduce confusion here would be to incorporate the lc/simple
offset into crab
itself. Would that better fulfil people's expectations?
Another possibility to reduce confusion here would be to incorporate the lc/simple offset into crab itself. Would that better fulfil people's expectations?
That would match my usage. I'd like to transform a phrase and receive a phrase that I could play in its place. I don't know about others, but I'm not sure how I would use a phrase that starts before the given phrase.
You may also consider doing a sort-by :time in crab. When I pass a long phrase with multiple sub-sequences to live/play, it seems to get confused if some of the notes it plays are not sorted. Looking at the code, I'm not exactly sure how this happens, but I had some issues until I wrapped my own usage with sort-by :time.
So far, I'd only considered using crab in the context of canon, and so I relied on canon sorting things after the transformation. That assumption seems a little shaky on closer inspection.
Are you using crab on its own?
Chris
On 10 June 2013 05:51, Roger Allen notifications@github.com wrote:
You may also consider doing a sort-by :time in crab. When I pass a long phrase with multiple sub-sequences to live/play, it seems to get confused if some of the notes it plays are not sorted. Looking at the code, I'm not exactly sure how this happens, but I had some issues until I wrapped my own usage with sort-by :time.
— Reply to this email directly or view it on GitHubhttps://github.com/ctford/leipzig/issues/2#issuecomment-19179000 .
I have a function here: https://github.com/rogerallen/explore_overtone/blob/master/src/explore_overtone/song_algorithm.clj#L143
that takes a phrase as input, randomly alters the phrase and returns it. It is much like what you do with canon, but a replacement, rather than appending. I'm just "noodling" around, so take this as just one datapoint on how some J Random User might use Leipzig. Always returning time sorted phrases might be in line with the principle of least astonishment. But, you also might be counting on that ordering in how you use it, I don't know.
(defn alter-phrase
[the-phrase]
(let [r (wrand [3 1 2])]
(case r
0 ((lc/interval (rand-melody-pitch-step)) the-phrase)
1 (sort-by :time (lc/crab the-phrase))
2 ((lc/interval (rand-melody-pitch-step)) (lc/mirror the-phrase))
)))
That case does imply crab should be sorting. The way play works assumes time is ordered, so crab currently returns technically invalid melodies.
Also, sorting ruins laziness, so keeping it out of canon allows infinite canon.
I think I'm convinced sorting is best done on the transformation itself i.e. crab. On Jun 10, 2013 8:23 PM, "Roger Allen" notifications@github.com wrote:
I have a function here: https://github.com/rogerallen/explore_overtone/blob/master/src/explore_overtone/song_algorithm.clj#L143
that takes a phrase as input, randomly alters the phrase and returns it. It is much like what you do with canon, but a replacement, rather than appending. I'm just "noodling" around, so take this as just one datapoint on how some J Random User might use Leipzig. Always returning time sorted phrases might be in line with the principle of least astonishment. But, you also might be counting on that ordering in how you use it, I don't know.
(defn alter-phrase [the-phrase](let [r %28wrand [3 1 2]%29] %28case r 0 %28%28lc/interval %28rand-melody-pitch-step%29%29 the-phrase%29 1 %28sort-by :time %28lc/crab the-phrase%29%29 2 %28%28lc/interval %28rand-melody-pitch-step%29%29 %28lc/mirror the-phrase%29%29 %29))
— Reply to this email directly or view it on GitHubhttps://github.com/ctford/leipzig/issues/2#issuecomment-19213620 .
I've pushed the call to sort-by
back up into crab.
I'm not sure if this is an issue or just my misunderstanding. I'm trying to implement a "retrograde" function that will reverse a melody. I think I should be able to do something along the lines of (->> the-phrase crab (simple the-phrase-length)), but that doesn't quite work. I hope you can set me straight here.
Consider a simple example of a whole note followed by two half notes:
That almost works. Note 6 & 5 start at 0 and 0.5, but Note 4 is at time 1.5? Shouldn't it be at time 1?
I drew this out and it finally made sense to me. I think there is a missing step
Do you agree there's an issue? Or is this just a misunderstanding on my part?
Thanks in advance...
--Roger