(there was a recent question about speed
with splice
, this is about begin
and end
with slice
)
This is fine (selected part of sample gets cut in half):
ghci> chop 2 $ s "led" # begin 0.03 # end 0.86
(0>½)|begin: 3.0e-2f, end: 0.44499999999999995f, s: "led"
(½>1)|begin: 0.44499999999999995f, end: 0.86f, s: "led"
but this is surprising (does not cut the sample):
ghci> slice 2 0 $ s "led" # begin 0.03 # end 0.86
(0>1)|begin: 3.0e-2f, end: 0.86f, s: "led"
this only works when no begin/end are given:
ghci> slice 2 0 $ s "led"
(0>1)|begin: 0.0f, end: 0.5f, s: "led"
To add to the confusion, function _slice
does ignore begin/end:
ghci> _slice 2 0 $ s "led" # begin 0.03 # end 0.86
(0>1)|begin: 0.0f, end: 0.5f, s: "led"
Implementation of slice (https://hackage.haskell.org/package/tidal-1.9.4/docs/src/Sound.Tidal.Control.html#slice) has
slice pN pI p = P.begin b # P.end e # p where ...
so if p
does have begin/end, then these take precedence, by the semantics of #
.
Implementation of _slice
(https://hackage.haskell.org/package/tidal-1.9.4/docs/src/Sound.Tidal.Control.html#_slice) has this
_slice n i p = p # P.begin ... # P.end ...
and this will ineed ignore begin/end attributes in p
.
Implementation of chop
(https://hackage.haskell.org/package/tidal-1.9.4/docs/src/Sound.Tidal.Control.html#chop) contains some local magic (chomp) for begin/end computations.
Shouldn't chomp
be applied in slice
as well?
NB: I found the "led" sample tricky to handle, but finally came up with this:
let frev n = rev . fast n . rev . slow n
in d1
$ (segment 2 $ fmap (2^) $ 0.1 ~> irand 4) >>= \ j ->
slow (segment 2 $ fmap (2^) $ 0.2 ~> irand 3)
$ frev (pure j)
$ chop 32
(s "led" # begin 0.03 # end 0.86 # speed 0.96 # pan rand)
* speed (segment 2 $ fmap (2^) $ 0.3 ~> irand 2)
# delay 1 # delayfb (choose [0,0.5]) # delayt (120/135/4 )
# room 1 # size 0.8
(the hard part was to figure out numerical values 0.03, 0.86, 0.96
)
[EDIT] rendered audio: tidal/code/led.ogg · master · waldmann / computer-mu · GitLab