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

Something's wrong with squeezeJoin (was: silence when using slow before chop) #216

Closed
felixroos opened this issue Sep 21, 2022 · 8 comments
Labels
bug Something isn't working

Comments

@felixroos
Copy link
Collaborator

when slowing down a pattern before calling .chop , the pattern will return nothing:

let p = s("hh").chop(4) // this works
let p = s("hh").chop(4).slow(2) // this also works
let p = s("hh").slow(2).chop(4) // this doesnt work

repl link

Could this be a bug in _squeezeJoin ? I am not entirely sure what the expected result should be, probably the same as line 2.

@felixroos felixroos added the bug Something isn't working label Sep 21, 2022
@felixroos
Copy link
Collaborator Author

same with ply, which also uses squeezeJoin: https://strudel.tidalcycles.org?SB-hFm0uROHV

@yaxu
Copy link
Member

yaxu commented Sep 21, 2022

s("hh").slow(0.5).chop(4)

is ok..

In tidal chop 4 $ slow 2 $ s("hh") seems OK but ply 4 $ slow 2 $ s("hh") is not.

In tidal ply is implemented using a squeezeJoin and chop isn't.. Which backs up your theory that there's something up with squeezeJoin.

@yaxu
Copy link
Member

yaxu commented Sep 22, 2022

This does work in tidal:

*Sound.Tidal.Context> ply 2 $ slow 2 $ s "bd sd"
(0>½)|s: "bd">1)|s: "bd"

this doesn't

*Sound.Tidal.Context> ply 2 $ slow 4 $ s "bd sd"

works

*Sound.Tidal.Context> ply 2 $ slow 2 $ s "hh hh"
(0>½)|s: "hh"
(½>1)|s: "hh"

doesn't

*Sound.Tidal.Context> ply 2 $ slow 2 $ s "hh"

@yaxu
Copy link
Member

yaxu commented Sep 22, 2022

Doesn't work in tidal 2.0 either..

*Sound.Tidal.Signal.Base> _ply 2 $ _slow 4 $ fastcat [sigAtom "hh" :: Signal String, sigAtom "bd"]
[]

@yaxu
Copy link
Member

yaxu commented Sep 22, 2022

I think the problem starts here:

  _compress(b, e) {
    if (b.gt(e) || b.gt(1) || e.gt(1) || b.lt(0) || e.lt(0)) {
      return silence;
    }
    return this._fastGap(Fraction(1).div(e.sub(b)))._late(b);
  }

squeezeJoin is trying to get _compress to expand a pattern into a hap larger than a cycle, and it's refusing..

yaxu added a commit that referenced this issue Sep 22, 2022
@yaxu
Copy link
Member

yaxu commented Sep 22, 2022

Getting somewhere, not quite there yet though..

yaxu added a commit to tidalcycles/Tidal that referenced this issue Sep 23, 2022
@yaxu yaxu closed this as completed in 5b56fbe Sep 23, 2022
yaxu added a commit to tidalcycles/Tidal that referenced this issue Sep 23, 2022
@yaxu
Copy link
Member

yaxu commented Sep 24, 2022

Continuing from comments on #220

Ok this returns 0.5 and not 3.5, so there's definitely something wrong with squeezeJoin.. So something makes sense now.

pure(time.struct(true))._squeezeJoin().queryArc(3,4)

@yaxu yaxu reopened this Sep 24, 2022
@yaxu yaxu changed the title silence when using slow before chop Something's wrong with squeezeJoin (was: silence when using slow before chop) Sep 24, 2022
@yaxu
Copy link
Member

yaxu commented Sep 24, 2022

Now I understand - the inner pattern of ply is just the original value wrapped in pure, repeating forever. So, it doesn't matter that you always get the first cycle of that. All the cycles are the same. The progression of time comes from the outer pattern.. But squeezeJoin still needs fixing for other cases like the above, where the inner pattern isn't the same every cycle.

yaxu added a commit that referenced this issue Sep 24, 2022
@yaxu yaxu closed this as completed in 513e0d7 Sep 24, 2022
yaxu added a commit to tidalcycles/Tidal that referenced this issue Sep 25, 2022
* fix for squeezejoin (ref tidalcycles/strudel#216), moving some supporting functions up to the pattern module
* fix benchmark imports
yaxu added a commit to tidalcycles/Tidal that referenced this issue Nov 8, 2022
* fix for squeezejoin (ref tidalcycles/strudel#216), moving some supporting functions up to the pattern module

* get right cycle number from inner pattern in squeezeJoin

* fix benchmark imports

* stop moving old tidal binary, fixes #964

* reinstate step commented in error
yaxu added a commit to tidalcycles/Tidal that referenced this issue Dec 4, 2022
* fix for squeezejoin (ref tidalcycles/strudel#216), moving some supporting functions up to the pattern module

* get right cycle number from inner pattern in squeezeJoin

* fix benchmark imports
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants