-
-
Notifications
You must be signed in to change notification settings - Fork 263
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
OSC shapes need additional logic #1178
Comments
Maybe it is easiest to add additional minimal OSC shape for dsp (might need more than one for each dsp parameter, if they are separable) That would also require ignoring the dsp parameters in the OSC message. This could either be on the tidal side by adding a exclusion list of parameters to the shape (needs a bit of work) or on the superdirt side by ignoring dsp parameters if a sound parameter is present (because they will also come in a separate message). It seems tidiest to not send the parameters in the first place so I think option 1 would be nice. Also tagging @telephon |
Oh but I guess the dsp does need to go in the same message as the sound. In fact am I right that in some sense the dsp is the sound? In that case maybe what gets sent is an OSC message with Then on the tidal side it would just need something like But I remember @ahihi you wanted to explicitly set |
the |
what if it was something like this? data BoolExpr a
= Val a
| Not (BoolExpr a) -- not sure if useful
| All [BoolExpr a]
| Any [BoolExpr a]
data Args
= Named {requiredArgs :: BoolExpr String}
… then superdirtShape = OSC "/dirt/play" $ Named {requiredArgs = Any [Val "s", Val "dsp", Val "gdsp"]} maybe with a couple of helpers to keep the simple cases easy to write allArgs = All . map Val
anyArgs = Any . map Val
superdirtShape = OSC "/dirt/play" $ Named {requiredArgs = anyArgs ["s", "dsp", "gdsp"]} |
Would it be OK to use a different param for processing sound, vs generating it? |
it would complicate the SuperDirt side, where also, one thing to note regarding this:
a pattern can have both tidal.gdsp.mp4 |
i tried out #1178 (comment) and i think it does not complicate things much. the only thing that changes is that toData :: OSC -> Event ValueMap -> Maybe [O.Datum]
toData (OSC {args = ArgList as}) e = fmap (fmap toDatum) $ mapM (\(n, v) -> Map.lookup n (value e) <|> v) as
toData (OSC {args = Named rqrd}) e
| hasRequired rqrd = Just $ concatMap (\(n, v) -> [O.string n, toDatum v]) $ Map.toList $ value e
| otherwise = Nothing
where
hasRequired (Val k) = k `elem` ks
hasRequired (Not x) = not $ hasRequired x
hasRequired (All xs) = all hasRequired xs
hasRequired (Any xs) = any hasRequired xs
ks = Map.keys (value e)
toData _ _ = Nothing it occurs to me that the intermediate data structure could even be skipped by making data Args
= Named {requiredArgs :: [String] -> Bool}
… superdirtShape = OSC "/dirt/play" $ Named {requiredArgs = any (`elem` ["s", "dsp", "gdsp"]) } toData :: OSC -> Event ValueMap -> Maybe [O.Datum]
toData (OSC {args = ArgList as}) e = fmap (fmap toDatum) $ mapM (\(n, v) -> Map.lookup n (value e) <|> v) as
toData (OSC {args = Named rqrd}) e
| rqrd ks = Just $ concatMap (\(n, v) -> [O.string n, toDatum v]) $ Map.toList $ value e
| otherwise = Nothing
where
ks = Map.keys (value e)
toData _ _ = Nothing
though then we lose the automatically derived |
Maybe it could be even more general as a field |
you mean data Args
= Custom {filterValues :: Maybe (ValueMap -> Bool)} -- "Named" didnt seem very descriptive anymore
| ArgList [(String, Maybe Value)] seems reasonable, but what is the another direction of generalizability could be to allow transforming the event data in addition to filtering, e.g. |
With SuperDirt PR musikinformatik/SuperDirt#309 from @ahihi, it would be nice to send a message if either the 'sound' or 'dsp' message was present. Probably needs extra logic in the shape.
The text was updated successfully, but these errors were encountered: