Suppressing text messages/warnings in scamp

How can I suppress text messages/warnings from scamp or its dependencies from being printed to the terminal?

For example, I often get “WARNING:root:Clocl is running noticeably behind real time…”

or “Using preset Acoustic Bass…”

Thanks in advance.

There should be a simple flag to do this (I’ll look to add one), but I believe the following should work:

import clockblocks
clockblocks.settings.running_behind_warning_threshold_long = \
    clockblock.settings.running_behind_warning_threshold_short = \
    clockblock.settings.catching_up_child_clocks_threshold_min = \
    clockblock.settings.catching_up_child_clocks_threshold_max = float("inf")

Another possibility would be something like this:

import logging

Since the messages are all warnings, if you set the logging library to only print actual errors, that should suppress the warnings (although it will do so for anything else that uses the logging library as well).

Changing the logging settings worked to suppress the warnings but I still got the warning after changing the clockblocks setting (I just copied and pasted your code). Note that I am running scamp Let me know if there’s something else to try with the clockblocks.settings.

Also, I’m still getting text output from fluidsynth that I would prefer not to see for the (for now) text-based interactive exercises I am developing. Do you know how to suppress the following messages?

fluidsynth: error: no MIDI in devices found
Using preset Acoustic Bass for acoustic_bass

Thanks again in advance.

Ah, I see; that makes sense why you would want to suppress them. I’m not sure if there’s a good way of suppressing that output, but there should be and I’ll look into it.

By the way, if it’s an interactive text-based thing, do you know about Session().run_as_server()? See this thread: Note durations clipping in interactive session

It could be part of the reason you’re getting all those warnings.

Thanks for any further fixes/tips you can provide for controlling text output. It would be nice to not have to change the logging setting so would welcome you adding a flag fix for the “clock running behind real-time” warning in a future version.

Thanks also for the tip on run_as_server(). I did notice the note duration being clipped on the first note in a sequence but found that adding a wait(1) at the beginning of the sequence eliminated it. Maybe run_as_server() is a more robust/flexible fix.