brianhouse / braid

Polyrhythms in Python: a sequencer and musical notation system for monophonic MIDI synths
http://braid.live
GNU General Public License v3.0
47 stars 6 forks source link

Playing notes separately from patterns #19

Closed tamirelazar closed 3 years ago

tamirelazar commented 3 years ago

Hi,

I'm pretty sure there is no way to use your package to play a single note or bar without repetition (outside of using a trigger set on 1 to play a pattern and stop it after first time). It would be convenient for me to write this functionality into my project (which uses braid) - would you like me to try and integrate it with braid itself?

brianhouse commented 3 years ago

hi there—

This should work to play a single note outside of pattern: thread_object.play(step_number)

For a whole bar, yes, you'd have to just stop it after the first time. But I'm also more than happy to take a look at pull requests if there's a way to integrate that functionality.

tamirelazar commented 3 years ago

Right! thanks, that works for a single note. Not sure I still need the bar thing, but if I'll find myself writing something for that purpose I'll try to integrate it, and send a PR.

brianhouse commented 3 years ago

Sorry for the delayed response. I think the difficulty is that patterns are “unrolled” in order to calculate the number steps and therefore to know what step the thread is on. I’m not sure how this aspect would work if the patterns were generated dynamically. But take a look at pattern.py for how the patterns are processed, and then line 128 in thread.py for where the pattern is actually chosen. Let me know if you get anywhere with it!

On 2021 04 19, at 05:09, Tamir Elazar @.***> wrote:

Okay, i am going to try to implement it in a more general way - I'll be very happy if you could point me to the relevant functions.

What I want is this: to implement the ability to insert a function call to a pattern. This is different from the current state, if I'm not mistaken, because now the thread calls the function only when building the pattern.

What would help me: a pointer to the place where a function is called, if you put it inside a pattern. Also, the place where the choice element of patterns is implemented (a tuple inside the pattern list).

Don't feel obligated to help, of course - I'll manage. Thanks!

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/brianhouse/braid/issues/19#issuecomment-822416826, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAAFVIESV3TXJC2QULLCWOLTJQMOZANCNFSM42PBKWPQ.