Forum Rule: Always post complete source code & details to reproduce any issue!
Results 1 to 3 of 3

Thread: Advice for low latency audio

  1. #1
    Junior Member
    Join Date
    Dec 2018
    Posts
    2

    Advice for low latency audio

    Hi!

    This is my first post here, although I've spent many hour browsing this forum over the years and learned lots of things here!

    Anyway, here is my issue:
    Iím contemplating a project that requires one or two simple delay lines with decent audio quality. My problem is that I need a minimum delay time of ~0.5ms or shorter, including the latency of the system itself. Also, the delay time needs to be continuously variable with high resolution, so Iíll probably have to sample the input as fast as possible. From what Iíve gathered, this rules out the audio library and itís block based processing scheme, as well as the audio board, because of the delay in the ADCs/DACs filters.

    Since all the filtering and mixing will be done with analogue circuitry, thereís not a lot left to do for the processor. Get a value from the ADC, feed it into a ring buffer, lookup the correct position for the read pointer, interpolate between two adjacent samples and pass the result to a DAC, thatís about it.

    Hereís my questions:
    Do you think that per-sample processing at, letís say 196kHz is a realistic goal for a otherwise simple task like this? If so, what kind of converters should I be looking at?

    Apart from dabbling around with the teensy+audio board or the Axoloti, I donít have any experience with embedded DSP, especially when it comes to the hardware setup, so Iíd be happy for every suggestion!

    Thanks in advance,

    Robin

  2. #2
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    18,655
    You could try editing AudioStream to set the block size to something small, like 16 samples. There's also some delay in the ADC and DAC, assuming you use the audio shield or similar hardware.

    Most of the audio library will adapt to smaller block size. The delay effect will. Some stuff, like SD card playing and FFT also work in blocks and depend on fixed ratio between block sizes, so those tend to fail if you edit AudioStream.h.

    so Iíd be happy for every suggestion!
    How about the suggestion to consider whether such a short delay is meaningful? The speed of sound is approx 1 foot per millisecond, so a 0.5 ms delay corresponds to moving your ear only several inches relative to the speaker.

  3. #3
    Junior Member
    Join Date
    Dec 2018
    Posts
    2
    Hi Paul, thanks for the quick reply!

    How about the suggestion to consider whether such a short delay is meaningful? The speed of sound is approx 1 foot per millisecond, so a 0.5 ms delay corresponds to moving your ear only several inches relative to the speaker.
    You are right of course, I should have explained my need for such short delays in my first post. The goal is to implement Karplus Strong and other physical modelling techniques within a (mostly) analog modular synthesizer. So, 0.5ms equals a pitch of 2kHz in my case. Fully digital implementations are great and I use them a lot, but I still think it would be worthwhile to experiment with these things in a analog and freely patchable system. Right now I'm using a BBD-based device to do this, but I'd love to have a more "hifi" option available.

    Yes, I'm aware of the inherent latency of audio codec ICs. Since there will be an analog filter involved in my circuit anyway, I thought about using regular converters instead. I'm looking into alternatives that will offer a good compromise between speed and accuracy (low noise) right now, but the vast amount of different converters out there makes this difficult. So before I go out and buy several expensive ADCs/DACs, I thought it would be a good idea to ask around for a bit of advice on this first.

    Also, since there is not a lot of processing to do in my case, I was unsure if there's any benefit in using a block based approach at all. I though I might get away with doing everything per sample instead? However, a blocksize of 16 samples at 88kHz would leave me with a latency of ~0.18ms on the processor side, so that's not too bad either.

    Robin

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •