-
-
Notifications
You must be signed in to change notification settings - Fork 256
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
slice
of 1 doesn't work
#979
Comments
I took a look at this today and came up with two possible fixes: I didn't like this as much as it handles n = 1 as a special case, but it 'does less': slice' :: Pattern Int -> Pattern Int -> ControlPattern -> ControlPattern
slice' pN pI p = P.begin b |> P.end e |> p
where b = div' <$> pI <* pN
e = ((\i n -> if n == 1 then 1 else div' i n + div' 1 n) <$> pI) <* pN
div' num den = fromIntegral (num `mod` den) / fromIntegral den Then I tried patterning the sample width to calculate the end parameter pattern: slice'' :: Pattern Int -> Pattern Int -> ControlPattern -> ControlPattern
slice'' pN pI p = P.begin b |> P.end e |> p
where
b = div' <$> pI <* pN
e = b + pWidth
pWidth = (\x -> 1.0 / fromIntegral x) <$> pN
div' :: Int -> Int -> Double
div' num den = fromIntegral (num `mod` den) / fromIntegral den It looks like this issue is also true for
I can put a PR together if this will work with tidal 2.0 |
Hi @grddavies, a PR would be very welcome. Please target the |
slice "1" "0" $ s "bd"
produces the following pattern(0>1)|begin: 0.0f, end: 0.0f, s: "bd"
. This doesn't seem to be correct—a slice of 1 should produce the full sample.Incidentally,
randslice
behaves correctly:randslice "1" $ s "bd"
produces(0>1)|begin: 0.0f, end: 1.0f, s: "bd"
The text was updated successfully, but these errors were encountered: