signalflow icon indicating copy to clipboard operation
signalflow copied to clipboard

'Warning: buffer overrun?': when does it happen and how to silence it?

Open balintlaczko opened this issue 10 months ago • 2 comments

Hi! I am often getting this warning after I rendered something in non-real-time and then call graph.start(). I think that in my case this warning is harmless, although I would be interested how I could avoid it? Just raise the graph.output_buffer_size? Also, these warnings might spook users even if they (the warnings) don't have a negative effect (I think/hope) on the rendered result. Is there a way to silence these warnings?

balintlaczko avatar Apr 24 '25 10:04 balintlaczko

This is a great point and does happen in benign situations. It basically looks at the processing time taken, compares it with the expected duration of a block (i.e., output_buffer_size / sample_rate), and if the first exceeds the second, generates a warning.

If you're doing offline processing, of course, this is completely spurious! One option could be to silence these warnings if a dummy output device is used. Additionally, it would really be nice to disable/re-route such warnings (and all internal messages, really), using Python's logging module. I've not yet done the work to incorporate internal error messages with Python logging, but having both of these options would definitely be the optimal way to handle this kind of console spam.

A third way might be to have more fine-grained bespoke controls over log messages like this, but that opens the door to having heaps of different output config settings which might get messy. Any thoughts that you have on all of the above would be welcomed.

As a workaround, yes, I think increasing output_buffer_size might help, but of course you'll then be processing more samples so I'm afraid you will likely still see warnings if you're doing heavy processing.

The good news is that I have a small grant to dedicate some focused development time to SignalFlow later in the year (probably July-October), which means I will be able to make much better progress on fixing these kinds of issues and starting to establish a proper community discussion forum. More on this soon!

ideoforms avatar Apr 24 '25 10:04 ideoforms

Oh that's great news, congrats! 🚀 And thanks for the explanation, now I get it why I always get the warning after booting from NRT. I am not using the dummy device anymore (just a stopped graph), so for me it would be handy to have some kind of global switch for this. I have never used the logging module before, so I don't know if with that you could do something like this:

import signalflow as sf
sf.verbose = False # silence warnings
# or
sf.log_level(0) # ints from 0 to N denoting different levels 

I may want to keep the warnings in a real-time scenario and only silence them during NRT rendering:

sf.log_level(0) # silent
my_nrt_render()
sf.log_level(1) # warnings are on

balintlaczko avatar Apr 24 '25 13:04 balintlaczko