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.

Reply via email to