dancasimiro/WAV.jl

wavrecord and simultaneous play and record

Opened this issue · 7 comments

thanks @mgkuhn for refactoring the wavplay function awhile back. in that PR you mention the possibility of adding a wavrecord function. how hard would that be for someone (like me) who is not familiar with apple's AudioToolbox?

i specifically need actually to play and record at the same time, making sure that the incoming and outgoing samples are in sync. is there a tutorial or example somewhere that demonstrates how to do this?

mgkuhn commented

I haven't done anything with the Core Audio API myself yet. In that wavplay PR, I just modernized existing Julia code that used it. (If one were to start adding recording or even a full-duplex audio interface to WAV, it would of course be nice to also cover the Win32 and PulseAudio interfaces eventually.)

I'd like to recommend portaudio.jl as a cross-platform abstraction for low-level audio APIs. It surely makes sense to avoid duplicating this effort.

i considered portaudio.jl, but it cannot do full-duplex as discussed in this to issue

ssfrr commented

PortAudio.jl can definitely do simultaneous playback+record, though I can see how that issue would cause confusion.

Older versions of PortAudio.jl had a specific synced keyword that controlled how underruns and overruns were handled, and guaranteed that the input->output latency wouldn't change. That functionality was lost when we switched away from a callback approach.

mgkuhn commented

@ssfrr Is there any alternative way in PortAudio.jl to retain guaranteed fixed input/output latency, which would be quite essential for real-time feedback algorithms, such as echo cancellation or a full-duplex modem.

ssfrr commented

Don’t want to hijack this issue too much, but there’s a little more detail here and here