Skip to content
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

irand, choose, etc are incompatible with once & asap ? #476

Closed
jarmitage opened this issue Feb 14, 2019 · 7 comments
Closed

irand, choose, etc are incompatible with once & asap ? #476

jarmitage opened this issue Feb 14, 2019 · 7 comments
Projects

Comments

@jarmitage
Copy link

Examples:

asap $ n (irand 20) # s "fx"
once $ choose [(run 10)] # s "fx"
@bgold-cosmos
Copy link
Contributor

The new transition-based onceFor will fix this for once. After toplap15 I'll give a look at asap and see if something can be done there too, I think there's probably an easy fix.

@yaxu
Copy link
Member

yaxu commented Mar 7, 2019

I'm guessing the problem here is that arbitrary values are returned correctly, but the same ones each time. I just want to flag that this will be desired behaviour some of the time.

@yaxu yaxu added this to TODO in Tidal 1.5 via automation Mar 7, 2019
@jarmitage
Copy link
Author

Yes, I understand this to be "expected behaviour" as far as the current implementation goes, just not "desirable" in this very specific case!

@yaxu
Copy link
Member

yaxu commented Mar 7, 2019

I think most would want it to be different each time, just flagging it could be nice to have the option

@yaxu
Copy link
Member

yaxu commented Sep 24, 2019

Here's a pseudorandom once:

import System.Random (getStdRandom, randomR)
randOnce p = do i <- getStdRandom $ randomR (0, 8192)
                once $ rotL (toRational i) p

A different version that plays whatever the current cycle is:

randOnce p = do now <- O.time
                tempo <- readMVar $ sTempoMV tidal
                let cyc = timeToCycles tempo now
                once $ rotL (sam cyc) p

The first one is better I think, the second one only plays something different every cycle.

We just need a nice name for it. Suggested names from the channel:
onceMore freshOnce onceUnique newOnce newOne onceReseed onceOrig

@yaxu
Copy link
Member

yaxu commented Sep 24, 2019

Howabout once for a random cycle and first for the first one (the current behaviour)?

@yaxu yaxu closed this as completed in 6b72e0f Sep 24, 2019
Tidal 1.5 automation moved this from TODO to Done Sep 24, 2019
@jarmitage
Copy link
Author

Separate once and first are nice solutions.

If once is random, maybe there could be onceAt c where c is a given cycle number to enable a deterministic option. This would cover the case where you want repeatability, but you're looking for something alternative to the first cycle's output.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
No open projects
Tidal 1.5
  
Done
Development

No branches or pull requests

3 participants