You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Below is a script that is meant to do something simple:
Create a finite PSequence (pat) from 10 hardcoded notes with repeats=1
Create another pattern (dur) using PScaleLinLin to scale the notes in pat to the range 0.2 to 1.2
Create reversed copies of each (rpat and rdur)
Schedule pat notes to play for duration dur
Schedule rpat notes to play for duration rdur
Run timeline.
You would expect both tracks to finish at the same time, because the sums of dur and rdur are the same forwards or backwards. But the first track finishes well before the second, as you can hear and see from the logging messages:
But I am wondering why this happens. I looked at the code for PScaleLinLin and PMap which it calls, but nothing jumps out at me. It seems that when the PScaleLinLin pattern is iterated "live" (while scheduled on the timeline) something happens and it finishes early.
Not a huge deal since I have a workaround but thought it was worth reporting, and I'm curious what this turns out to be.
I'm on an M1 Mac Mini running macOS 12.3/Monterey and Python 3.10.2 (native ARM build) and the latest version of isobar from PyPI (0.1.1) (but it also happens when I install the latest version from GitHub).
This seems like a weird interaction between the PReverse class and using a PScaleLinLin object as input. It's also interesting to note that putting dur in both schedule functions, they still don't match up unless you copy the object, so it could also be an issue with scheduling non-constant durations
Late response but found the issue, when making the dur variable, it pulls from pat by reference instead of by value, the easiest way to see this is getting the length of dur, running nextn on pat, and getting the length again:
The workaround you listed seems to work because PSequence copies the input list. Another way to solve this issue would be to use iso.PScaleLinLin(pat.copy(), ..., but I'll put in a push request to copy the list by value for PMap and any other needed functions
Below is a script that is meant to do something simple:
pat
) from 10 hardcoded notes with repeats=1dur
) using PScaleLinLin to scale the notes inpat
to the range 0.2 to 1.2rpat
andrdur
)pat
notes to play for durationdur
rpat
notes to play for durationrdur
You would expect both tracks to finish at the same time, because the sums of
dur
andrdur
are the same forwards or backwards. But the first track finishes well before the second, as you can hear and see from the logging messages:I found a workaround which is to pre-iterate through
dur
:When I uncomment that line, the tracks finish in the same millisecond:
But I am wondering why this happens. I looked at the code for
PScaleLinLin
andPMap
which it calls, but nothing jumps out at me. It seems that when the PScaleLinLin pattern is iterated "live" (while scheduled on the timeline) something happens and it finishes early.Not a huge deal since I have a workaround but thought it was worth reporting, and I'm curious what this turns out to be.
I'm on an M1 Mac Mini running macOS 12.3/Monterey and Python 3.10.2 (native ARM build) and the latest version of isobar from PyPI (0.1.1) (but it also happens when I install the latest version from GitHub).
Here is the full script:
The text was updated successfully, but these errors were encountered: