Coder Social home page Coder Social logo

aiotone's People

Contributors

ambv avatar jpetazzo avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

aiotone's Issues

Question: why locking countdowns?

Hi Łukasz

I followed your awesome PyCon talk. I did a few similar experiments and I just started to write some music with aiotone.

I have a question about this:

async with self.countdowns_lock:
self.countdowns.append(countdown)

I have used async back in the tornado days and didn't do much recently. I would only lock if the code was:

 async with self.lock: 
     await ...
     .....
     await ...

(Of course we had only yield)

Otherwise there is nothing that can run in between, right? I guess you write it like that in case you change the code to something more complex.

Some additional findings [not a bug]

First of all, thank you Łukasz, for the wonderful pycon presentation, and this really inspiring library!

I've tried to get things working on Linux (a somewhat older Ubuntu), and mostly things just work, so that may be a thing that could be noted in the documentation (though I totally understand if you didn't want to add that so as not to have to support it, but perhaps this issue will be helpful to others looking to do similar things in the future.)

For RTMidi to work I had to install the following header packages:

  • libasound2-dev
  • libjack-dev

I also worked around a fairly different hardware setup:

I don't have any hardware that can function as a MIDI sequencer so I installed seq24 and had it send MIDI clock events to a MIDI through port.

I have two volca's (beats and nubass) that I'm driving, but they don't have USB, so I got some cheap USB to 5 pin MIDI cables, which works right away. I'm not sure if it's the cables or that my elderly laptop is not processing the queue fast enough, but I ran into a lot of missing notes, and pretty widely varying pulse delta's. The way I solved this was to not send the clock events through to the synths, since they don't really need the clock, when they get the notes sent to them. (It does lose the nice synced step lights, though.)

Hope this helps someone in the future, if there is a better place to put this please let me know, and thanks again, driving hardware synths from Python is turning out to be so much fun!

Less jitter with spin_sleep()

For anyone who is interested. I built sequencer based on aiotone that is sync-master and drives my DAW. I had quite some jitter compared to other midi-sequencers. Using spin_sleep() in the main loop, there is much less jitter. Of course there is a tradeoff: higher CPU load.

sleep_resolution is platform dependent. On linux 0.001s should be a good value. I am not aware of a good way to detect sleep_resolution.

import asyncio
from time import time

sleep_resolution = 0.001


async def spin_sleep(sleep_time):
    deadline = sleep_time + time()
    await asyncio.sleep(sleep_time - sleep_resolution)
    while deadline > time():
        await asyncio.sleep(0)

Currently my code isn't in a state for sharing, but I will put it on github soonish.

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.