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

Thread: When does receiveReadOnly return null?

  1. #1

    When does receiveReadOnly return null?

    Under what circumstances does receiveReadOnly return null? The library documentation says it's possible, and that you should treat this like a block of silent audio. I'm writing a looper effect which uses the SD card to save the loop. I get receiveReadOnly returning null every few seconds (so it's clearly worked fine thousands of times in between). I'm recording a loop of continuous audio (with no silence), so inserting blocks of silence into the loop seems wrong? I assumed update() on the effect was only called when the next sample block was ready?

    I'm allocating 512 blocks of AudioMemory, and only allocating 1 per update, so I don't think that's the issue. I just wanted to understand the reasons it returns nulls to help me debug some audio glitches I'm having.


  2. #2
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    You'll get null when whatever is connected to the input doesn't send any data. Some things, like I2S input, always output data. Most of the synth stuff outputs only when generating sound, since all objects receiving are supposed to treat no data as silent input. This is by design, since no data is more efficient and uses less memory. Some effects will output data when they get data input. Others like freereverb will continue making small echo sounds for a very long time after their input goes silent.

  3. #3
    Thanks, Paul! My effect is connected AudioInputAnalog so I would expect to always receive input? I suspect it's down to something else I'm doing wrong. I'm writing to the SD card, and communicating with another chip via I2C, so maybe these are interfering in some way. My source code is currently too large to post (, but I'll try and reproduce the behaviour in a smaller example.

  4. #4
    So, as predicted, it was all my fault! I was trying to do too much in a single audio effect update() interrupt. Basically I was trying to write to the SD card inside the update, which just takes too long. Which leads me to my next issue, which I'll ask about in a separate post If I can't resolve

Posting Permissions

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