Tidal icon indicating copy to clipboard operation
Tidal copied to clipboard

Make 'controlpattern as string or number' default off

Open yaxu opened this issue 5 years ago • 1 comments
trafficstars

Adding # 1 and # 1.1 and # "foo" to a controlpattern will add an n, speed or sound control respectively. This seems helpful but can cause a lot of confusion. Lets not have that on by default.

yaxu avatar Jun 08 '20 08:06 yaxu

Naming control pattern as string default off is just a case of moving this:

instance {-# OVERLAPPING #-} IsString ControlPattern where
  fromString = s . parseBP_E

from Sound.Tidal.Simple into another module not included in Sound.Tidal.Context.

"controlpattern as number" is something we generally want though, so that e.g. (n 2) + (n 3) can work.

From Sound.Tidal.Pattern:

instance Num ControlMap where
  negate      = (applyFIS negate negate id <$>)
  (+)         = Map.unionWith (fNum2 (+) (+))
  (*)         = Map.unionWith (fNum2 (*) (*))
  fromInteger i = Map.singleton "n" $ VI $ fromInteger i
  signum      = (applyFIS signum signum id <$>)
  abs         = (applyFIS abs abs id <$>)

We could just make fromInteger raise an error, but probably not in an optional way.. hm

yaxu avatar Jun 13 '20 09:06 yaxu