Re: [LAD] prototyping callback based architecture in python?
2011/11/4 Iain Duncan iainduncanli...@gmail.com: Thanks for the opinion Emmanual, very helpful. Yeah, it may be better to just start off in C++ for the engine side and bite the bullet there. You can use C++ for it. - that doesn't mean you should ;) There may be more appropriate progr. languages. For example look at Processing http://processing.org/ Serpent is close to what you are watching out, it has a Syntax very close to Python. http://www.cs.cmu.edu/~music/aura/serpent-info.htm If you remain with C++, you have to decide for a cross-platform framework. For example JUCE, SFML or LGI. More here: http://wiki.linuxaudio.org/wiki/programming_libraries#dimensional -- E.R. ___ Linux-audio-dev mailing list Linux-audio-dev@lists.linuxaudio.org http://lists.linuxaudio.org/listinfo/linux-audio-dev
Re: [LAD] prototyping callback based architecture in python?
2011/11/2 Iain Duncan iainduncanli...@gmail.com: Hi, I'm working on an a project that I intend to do using the STK in a callback style, but am hoping I can prototype the architecture in python ... ... ... until I've figured out the various components and their responsibilities and dependencies. Does anyone know of any kind of python library ( or method? ) that would let me simulate the way callback based STK apps using RTAudio work? IE You could implement the callbacks (and link it to STK) with Cython. (not CPython) This would require you to write a Cython-Header file for the called STK functions. Cython works very well for this, although you have to learn it, because it's neither real C nor real Python, but it's close. With some attentiveness, you could write rt- functions in Cython, because they compile to pure C / binary. I want to have a python master callable that gets called once per audio sample No, Once per audio buffer, consisting of many (e.g. 128) samples. That's a better choice, usually, even if you do sample-by-sample processing within the function/callback. and has a way of sending out it's results to the audio subsystem. I've found a bunch of python audio libs but it doesn't seem like they work that way, Note: Don't use python threads (as implemented in CPython), they do not work for this. You might have more luck with the more recent multiprocessing module, ( http://docs.python.org/library/multiprocessing.html ) It was introduced to circumvent some of PythonThreads limitations. -- E.R. ___ Linux-audio-dev mailing list Linux-audio-dev@lists.linuxaudio.org http://lists.linuxaudio.org/listinfo/linux-audio-dev
Re: [LAD] prototyping callback based architecture in python?
On Fri, Nov 4, 2011 at 10:36 AM, Emanuel Rumpf xb...@web.de wrote: 2011/11/2 Iain Duncan iainduncanli...@gmail.com: Hi, I'm working on an a project that I intend to do using the STK in a callback style, but am hoping I can prototype the architecture in python ... ... ... until I've figured out the various components and their responsibilities and dependencies. Does anyone know of any kind of python library ( or method? ) that would let me simulate the way callback based STK apps using RTAudio work? IE You could implement the callbacks (and link it to STK) with Cython. (not CPython) This would require you to write a Cython-Header file for the called STK functions. Cython works very well for this, although you have to learn it, because it's neither real C nor real Python, but it's close. With some attentiveness, you could write rt- functions in Cython, because they compile to pure C / binary. I was wondering about that, has anyone here had real success with Cython? I want to have a python master callable that gets called once per audio sample No, Once per audio buffer, consisting of many (e.g. 128) samples. That's a better choice, usually, even if you do sample-by-sample processing within the function/callback. oops, yeah, I realizes I was mistaken there after sending it. That's what I'm doing, thanks and has a way of sending out it's results to the audio subsystem. I've found a bunch of python audio libs but it doesn't seem like they work that way, Note: Don't use python threads (as implemented in CPython), they do not work for this. You might have more luck with the more recent multiprocessing module, ( http://docs.python.org/library/multiprocessing.html ) It was introduced to circumvent some of PythonThreads limitations. thanks for the tips! iain ___ Linux-audio-dev mailing list Linux-audio-dev@lists.linuxaudio.org http://lists.linuxaudio.org/listinfo/linux-audio-dev
Re: [LAD] prototyping callback based architecture in python?
Thanks guys, it looked from what I could see on the port audio page that only non-blocking was supported, but Gary said on the stk list that it might be possible with the python wrappers in the rtaudio package. I realize it's probably not going to be practical as a long term solution ( though I sure with it were possible ) but as I actually earn my living coding python and am a total C++ amateur, it's probably worth saving some frustration figuring out architecture in a python prototype. I'm ok with high latency for now. Kjetil, do you know if anyone has experimented with a real time memory allocator for Python? No, I don't know. Are you sure you need to use Python? There are other high level languages letting you do this, which are much faster than Python. LuaAV for Lua is the most obvious since Lua is the same type of language as Python. Other alternatives I know of are Faust, Kronos (if it's available now) and Snd-RT. (Of those last three, you should look at Faust first.) ___ Linux-audio-dev mailing list Linux-audio-dev@lists.linuxaudio.org http://lists.linuxaudio.org/listinfo/linux-audio-dev
Re: [LAD] prototyping callback based architecture in python?
Thanks guys, it looked from what I could see on the port audio page that only non-blocking was supported, but Gary said on the stk list that it might be possible with the python wrappers in the rtaudio package. I realize it's probably not going to be practical as a long term solution ( though I sure with it were possible ) but as I actually earn my living coding python and am a total C++ amateur, it's probably worth saving some frustration figuring out architecture in a python prototype. I'm ok with high latency for now. Kjetil, do you know if anyone has experimented with a real time memory allocator for Python? No, I don't know. Are you sure you need to use Python? There are other high level languages letting you do this, which are much faster than Python. LuaAV for Lua is the most obvious since Lua is the same type of language as Python. Other alternatives I know of are Faust, Kronos (if it's available now) and Snd-RT. (Of those last three, you should look at Faust first.) I also forgot ChucK. But last time I checked, it was a bit inconvenient to do sample-by-sample programming in Chuck, plus that it was very inefficient. ___ Linux-audio-dev mailing list Linux-audio-dev@lists.linuxaudio.org http://lists.linuxaudio.org/listinfo/linux-audio-dev
Re: [LAD] prototyping callback based architecture in python?
On Fri, Nov 4, 2011 at 11:32 AM, Kjetil Matheussen k.s.matheus...@notam02.no wrote: Thanks guys, it looked from what I could see on the port audio page that only non-blocking was supported, but Gary said on the stk list that it might be possible with the python wrappers in the rtaudio package. I realize it's probably not going to be practical as a long term solution ( though I sure with it were possible ) but as I actually earn my living coding python and am a total C++ amateur, it's probably worth saving some frustration figuring out architecture in a python prototype. I'm ok with high latency for now. Kjetil, do you know if anyone has experimented with a real time memory allocator for Python? No, I don't know. Are you sure you need to use Python? There are other high level languages letting you do this, which are much faster than Python. LuaAV for Lua is the most obvious since Lua is the same type of language as Python. Other alternatives I know of are Faust, Kronos (if it's available now) and Snd-RT. (Of those last three, you should look at Faust first.) Well, I code in Python for a living, so as far as maximizing developer time it makes sense! And there are a lot of nice libraries out there for doing things in Python ( gui, midi, osc interfaces, etc ) iain ___ Linux-audio-dev mailing list Linux-audio-dev@lists.linuxaudio.org http://lists.linuxaudio.org/listinfo/linux-audio-dev
Re: [LAD] prototyping callback based architecture in python?
2011/11/4 Iain Duncan iainduncanli...@gmail.com: On Fri, Nov 4, 2011 at 11:32 AM, Kjetil Matheussen Are you sure you need to use Python? There are other high level languages letting you do this, which are much faster than Python. LuaAV for Lua is the most obvious since Lua is the same type of language as Python. Other alternatives I know of are Faust, Kronos (if it's available now) and Snd-RT. (Of those last three, you should look at Faust first.) Well, I code in Python for a living, so as far as maximizing developer time it makes sense! And there are a lot of nice libraries out there for doing things in Python ( gui, midi, osc interfaces, etc ) While I can understand your desire to code in Pyhton, what you are trying to accomplish is not simple with Pyhton (if possible at all), not even with C. All your questions are just the beginning of a very huge problem ;) I presume: by trying to use Python for this, dev-time will grow exponentially ... Do you have any experience in connecting python to C, wrapping ? I would advice (if asked ;) to skip Python for the real-time part. Use any language that is capable. (Apparently, most Python Modules are actually Wrapper-Classes for C - would you call that a capable language ? ;) You could still write the GUI in Python, choosing any applicable protocol (OSC, D-Bus, ...) l in order to connect to the non-rt part of the engine. -- E.R. ___ Linux-audio-dev mailing list Linux-audio-dev@lists.linuxaudio.org http://lists.linuxaudio.org/listinfo/linux-audio-dev
Re: [LAD] prototyping callback based architecture in python?
On Fri, Nov 4, 2011 at 1:42 PM, Emanuel Rumpf xb...@web.de wrote: 2011/11/4 Iain Duncan iainduncanli...@gmail.com: On Fri, Nov 4, 2011 at 11:32 AM, Kjetil Matheussen Are you sure you need to use Python? There are other high level languages letting you do this, which are much faster than Python. LuaAV for Lua is the most obvious since Lua is the same type of language as Python. Other alternatives I know of are Faust, Kronos (if it's available now) and Snd-RT. (Of those last three, you should look at Faust first.) Well, I code in Python for a living, so as far as maximizing developer time it makes sense! And there are a lot of nice libraries out there for doing things in Python ( gui, midi, osc interfaces, etc ) While I can understand your desire to code in Pyhton, what you are trying to accomplish is not simple with Pyhton (if possible at all), not even with C. All your questions are just the beginning of a very huge problem ;) I presume: by trying to use Python for this, dev-time will grow exponentially ... Do you have any experience in connecting python to C, wrapping ? I would advice (if asked ;) to skip Python for the real-time part. Use any language that is capable. (Apparently, most Python Modules are actually Wrapper-Classes for C - would you call that a capable language ? ;) You could still write the GUI in Python, choosing any applicable protocol (OSC, D-Bus, ...) l in order to connect to the non-rt part of the engine. Thanks for the opinion Emmanual, very helpful. Yeah, it may be better to just start off in C++ for the engine side and bite the bullet there. iain ___ Linux-audio-dev mailing list Linux-audio-dev@lists.linuxaudio.org http://lists.linuxaudio.org/listinfo/linux-audio-dev
Re: [LAD] prototyping callback based architecture in python?
On Wed, Nov 2, 2011 at 12:23 AM, Iain Duncan iainduncanli...@gmail.com wrote: Hi, I'm working on an a project that I intend to do using the STK in a callback style, but am hoping I can prototype the architecture in python until I've figured out the various components and their responsibilities and dependencies. Does anyone know of any kind of python library ( or method? ) that would let me simulate the way callback based STK apps using RTAudio work? IE I want to have a python master callable that gets called once per audio sample and has a way of sending out it's results to the audio subsystem. I've found a bunch of python audio libs but it doesn't seem like they work that way, maybe I'm missing something? the obvious choices would be the python wrappers for JACK and/or PortAudio. note, however, that the chances of using Python for per-sample processing at low latency without intense dropouts are low. ___ Linux-audio-dev mailing list Linux-audio-dev@lists.linuxaudio.org http://lists.linuxaudio.org/listinfo/linux-audio-dev
Re: [LAD] prototyping callback based architecture in python?
to clarify a bit more: although callback style APIs do exist (even for *nix systems), AFAIK STK is one of the very few APIs that does sample-by-sample processing. ___ Linux-audio-dev mailing list Linux-audio-dev@lists.linuxaudio.org http://lists.linuxaudio.org/listinfo/linux-audio-dev
Re: [LAD] prototyping callback based architecture in python?
Paul Davis: On Wed, Nov 2, 2011 at 12:23 AM, Iain Duncan iainduncanli...@gmail.com wrote: Hi, I'm working on an a project that I intend to do using the STK in a callback style, but am hoping I can prototype the architecture in python until I've figured out the various components and their responsibilities and dependencies. Does anyone know of any kind of python library ( or method? ) that would let me simulate the way callback based STK apps using RTAudio work? IE I want to have a python master callable that gets called once per audio sample and has a way of sending out it's results to the audio subsystem. I've found a bunch of python audio libs but it doesn't seem like they work that way, maybe I'm missing something? the obvious choices would be the python wrappers for JACK and/or PortAudio. note, however, that the chances of using Python for per-sample processing at low latency without intense dropouts are low. Actually, since Python has an incremental garbage collector, it should in theory only require replacing the memory allocator with a real time memory allocator to make Python pretty hard real time capable. I think. I also think I remember someone using Python for real time sample by sample signal processing in Pd... Efficiency is another story though ___ Linux-audio-dev mailing list Linux-audio-dev@lists.linuxaudio.org http://lists.linuxaudio.org/listinfo/linux-audio-dev
Re: [LAD] prototyping callback based architecture in python?
On Wed, Nov 2, 2011 at 9:24 AM, Kjetil Matheussen k.s.matheus...@notam02.no wrote: I also think I remember someone using Python for real time sample by sample signal processing in Pd... right, but not sample-by-sample, or am i misremembering Pd internals? ___ Linux-audio-dev mailing list Linux-audio-dev@lists.linuxaudio.org http://lists.linuxaudio.org/listinfo/linux-audio-dev
Re: [LAD] prototyping callback based architecture in python?
On Wed, Nov 2, 2011 at 9:24 AM, Kjetil Matheussen k.s.matheus...@notam02.no wrote: I also think I remember someone using Python for real time sample by sample signal processing in Pd... right, but not sample-by-sample, or am i misremembering Pd internals? It is possible (and quite simle) to write a wrapper for letting python do sample-by-sample processing in Pd. I remember someone mentioning someone doing it, but this was in 2005, and the performance was so bad it wasn't useful. But I might remember wrong. ___ Linux-audio-dev mailing list Linux-audio-dev@lists.linuxaudio.org http://lists.linuxaudio.org/listinfo/linux-audio-dev
Re: [LAD] prototyping callback based architecture in python?
Thanks guys, it looked from what I could see on the port audio page that only non-blocking was supported, but Gary said on the stk list that it might be possible with the python wrappers in the rtaudio package. I realize it's probably not going to be practical as a long term solution ( though I sure with it were possible ) but as I actually earn my living coding python and am a total C++ amateur, it's probably worth saving some frustration figuring out architecture in a python prototype. I'm ok with high latency for now. Kjetil, do you know if anyone has experimented with a real time memory allocator for Python? Thanks Iain On Wed, Nov 2, 2011 at 6:37 AM, Kjetil Matheussen k.s.matheus...@notam02.no wrote: On Wed, Nov 2, 2011 at 9:24 AM, Kjetil Matheussen k.s.matheus...@notam02.no wrote: I also think I remember someone using Python for real time sample by sample signal processing in Pd... right, but not sample-by-sample, or am i misremembering Pd internals? It is possible (and quite simle) to write a wrapper for letting python do sample-by-sample processing in Pd. I remember someone mentioning someone doing it, but this was in 2005, and the performance was so bad it wasn't useful. But I might remember wrong. ___ Linux-audio-dev mailing list Linux-audio-dev@lists.linuxaudio.org http://lists.linuxaudio.org/listinfo/linux-audio-dev ___ Linux-audio-dev mailing list Linux-audio-dev@lists.linuxaudio.org http://lists.linuxaudio.org/listinfo/linux-audio-dev
Re: [LAD] prototyping callback based architecture in python?
For anyone interested, it turns out there is an alpha package in rtaudio that wraps RTAudio's callback facility in python, added this year by one of Gary Scavone's students, Antoine Lefebvre. It's incomplete (doesn't yet support all the rtaudio options) so it's hard to tell whether it's working super well on my machine, but it compiles and runs and makes a sine wave ok. It'll give me something to port with for now at any rate, and maybe I can help complete it. it's in rtaudio-4.0.10/contrib/python/pyrtaudio iain On Wed, Nov 2, 2011 at 10:02 AM, Iain Duncan iainduncanli...@gmail.comwrote: Thanks guys, it looked from what I could see on the port audio page that only non-blocking was supported, but Gary said on the stk list that it might be possible with the python wrappers in the rtaudio package. I realize it's probably not going to be practical as a long term solution ( though I sure with it were possible ) but as I actually earn my living coding python and am a total C++ amateur, it's probably worth saving some frustration figuring out architecture in a python prototype. I'm ok with high latency for now. Kjetil, do you know if anyone has experimented with a real time memory allocator for Python? Thanks Iain On Wed, Nov 2, 2011 at 6:37 AM, Kjetil Matheussen k.s.matheus...@notam02.no wrote: On Wed, Nov 2, 2011 at 9:24 AM, Kjetil Matheussen k.s.matheus...@notam02.no wrote: I also think I remember someone using Python for real time sample by sample signal processing in Pd... right, but not sample-by-sample, or am i misremembering Pd internals? It is possible (and quite simle) to write a wrapper for letting python do sample-by-sample processing in Pd. I remember someone mentioning someone doing it, but this was in 2005, and the performance was so bad it wasn't useful. But I might remember wrong. ___ Linux-audio-dev mailing list Linux-audio-dev@lists.linuxaudio.org http://lists.linuxaudio.org/listinfo/linux-audio-dev ___ Linux-audio-dev mailing list Linux-audio-dev@lists.linuxaudio.org http://lists.linuxaudio.org/listinfo/linux-audio-dev
[LAD] prototyping callback based architecture in python?
Hi, I'm working on an a project that I intend to do using the STK in a callback style, but am hoping I can prototype the architecture in python until I've figured out the various components and their responsibilities and dependencies. Does anyone know of any kind of python library ( or method? ) that would let me simulate the way callback based STK apps using RTAudio work? IE I want to have a python master callable that gets called once per audio sample and has a way of sending out it's results to the audio subsystem. I've found a bunch of python audio libs but it doesn't seem like they work that way, maybe I'm missing something? thanks! Iain ___ Linux-audio-dev mailing list Linux-audio-dev@lists.linuxaudio.org http://lists.linuxaudio.org/listinfo/linux-audio-dev