Git Product home page Git Product logo

Comments (6)

TatriX avatar TatriX commented on May 27, 2024 1

Magic! It's almost perfectly in sync now. Thank you as always!

from cl-patterns.

defaultxr avatar defaultxr commented on May 27, 2024

With the recent changes to it, by default the clock skips any events that are "expired", i.e. occur in "the past". If *latency* is 0 then the clock has no time to calculate events from a pattern, so all events it generates will technically occur in the past. If you want the clock to play all events even if they're "expired", you can do this:

(setf (slot-value cl-patterns:*clock* 'cl-patterns::play-expired-events) t)

Then even if the latency is 0 it will still play all events. However, you may still get warnings from SuperCollider (i.e. "late 0.004638016" and similar) when it plays them. It's also possible that with 0 latency there may be more "jitter" between events since the clock processes events in batches and the backend will be told to play them as soon as it receives them. For example:

(pb :test
  :instrument :kick ;; or any percussive sound
  :dur 1/8
  :pfindur 4)

If you play that pattern with *latency* set to 0 you should hear the jitter between notes. You can compare it to when *latency* is at its default 1/10 value which sounds much smoother and consistent, as expected.

If you're curious, the "skip expired events" change to the clock was made in order to prevent tons of events from being played after the user recovers from an error. i.e. if you do:

(pb :test
  :instrument :default
  :dur 1
  :x (p/ 1 (pseq (list 1 2 3 0)))
  :pfindur 4)

...you'll get an error every 4th event on this pattern since it's attempting to divide by 0. If you wait a bit and then choose the SKIP-EVENT restart you'll likely get a bunch of late messages and maybe hear a few of the events. You probably won't hear them all since they're being told to end as soon as they've started. However if you do (cl-collider::server-query-all-nodes) you'll be able to see all of those notes still running in the background. They will stay running even though you never hear them because of this bug in scsynth where notes that are short enough aren't cleaned up. Just something to be aware of; if you notice scsynth using an abnormal amount of CPU, it may be these "ghost notes" lingering.

from cl-patterns.

defaultxr avatar defaultxr commented on May 27, 2024

Oh, also, unfortunately the ALSA MIDI backend doesn't support timestamps yet. So SC and MIDI likely won't be 100% in sync even with *latency* set to 0... Though it's possible they may still sound synced enough for your purposes.

But yeah, MIDI timestamps are definitely something I should fix when I'm able to; I'll leave this issue open as a reminder to do that.

from cl-patterns.

defaultxr avatar defaultxr commented on May 27, 2024

Ahh, actually it looks like even with play-expired-events set to t the MIDI backend will throw errors because it's trying to sleep a negative amount. Fortunately this won't be too hard to fix; one moment.

from cl-patterns.

defaultxr avatar defaultxr commented on May 27, 2024

Fixed in c27c6e0 :)

from cl-patterns.

defaultxr avatar defaultxr commented on May 27, 2024

Also I did see that the ALSA MIDI backend was erroneously adding *latency* to the event timing even though the clock already includes latency in its calculations. I fixed that in 37dc8f2 which should bring the backends even more in sync with each other.

from cl-patterns.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.