In the last days I added some code to allow realtime and asynchronous IO. I think it is still quite hackish, but absolutely have no clue how to pass something like a callback object in Julia.
The thing is I want to open a stream and pass it an initialized "processor" object which is then doing the realtime processing in the background until the stream is closed. My current solution looks like shown in this example: https://github.com/seebk/PortAudio.jl/blob/master/examples/async_processing.jl Maybe the whole concept of async IO as I have planned it is not possible in Julia? Any ideas how this could be done more in a smart (Julia style) way? Sebastian Am Montag, 22. Februar 2016 09:51:04 UTC+1 schrieb CrocoDuck O'Ducks: > > Cool! I will stay updated. Thanks! > > On Monday, 22 February 2016 07:50:39 UTC, Sebastian Kraft wrote: >> >> Please only stick to the examples given in the Readme.md file. Single >> buffer IO is not working properly, yet. >> My current plan is to extend open() so you can pass a callback function >> which does the processing asynchronously. However, it does not seem to work >> when C code is called in an @async block... Have to investigate that >> further in the next days... >> >> Am Sonntag, 21. Februar 2016 16:44:50 UTC+1 schrieb CrocoDuck O'Ducks: >>> >>> Hi there! >>> >>> I got into PortAudio.jl <https://github.com/seebk/PortAudio.jl> >>> recently (see this >>> <https://groups.google.com/forum/#!topic/julia-users/ooyT55TI-jk> >>> thread). I would like to code realtime digital filters. By that I mean that >>> I would like to acquire data from sound-card input(s) and, while the >>> acquisition goes on, filter the acquired samples and write the result to >>> the sound-card output(s). Latency does not need to be low. I have mostly >>> loudspeaker pre-hemphasis applications for acoustic measurements in mind >>> for that, that means I will time align what I need later on... I think the >>> PortAudio module should make me able to do that... but I have not figured >>> out how. Here what I have (very naively) tried: >>> >>> iostream = open(devID, (max_input_channels, max_output_channels), >>> sample_rate, buf_size) >>> >>> # Use a loop. Ctrl + C to exit the loop. >>> >>> doloop = true >>> >>> try >>> while doloop >>> >>> ibuffer = read(iostream, buf_size) # Collect Input >>> obuffer = some_filtering_of(ibuffer) # Do some processing >>> write(iostream, obuffer) # Write it to output >>> >>> end >>> catch excp >>> >>> if isa(excp, InterruptException) # Ctrl + C generates an >>> InterruptException >>> doloop = false >>> end >>> >>> end >>> >>> Of course, there are many problems with that (it is not collecting >>> consecutive buffers, for example). I guess it can help you understanding >>> what I have in mind though. >>> >>
