spell-music / csound-expression

Haskell Framework for Electronic Music
320 stars 31 forks source link

how to suppress messages from csound and from jack? #60

Closed jwaldmann closed 3 years ago

jwaldmann commented 3 years ago

Hi. When I use jack output, I am getting a ton of messages each time I call dacBy from ghci

dacBy (setJack "ce" <> setRates 48000 128 <> setBufs 2048 4096  ) $   (0.05 *) $ fromMono $ osc 200

0dBFS level = 32768.0
--Csound version 6.15 (double samples) Aug 24 2020
[commit: none]
libsndfile-1.0.28
WARNING: could not open library '/usr/lib64/csound/plugins-6.0/libpy.so' (/usr/lib64/csound/plugins-6.0/libpy.so: undefined symbol: PyFile_AsFile)
UnifiedCSD:  tmp.csd
STARTING FILE
Creating options
Creating orchestra
closing tag
Creating score
rtaudio: JACK module enabled
rtmidi: ALSA Raw MIDI module enabled
Elapsed time at end of orchestra compile: real: 0.006s, CPU: 0.006s
sorting score ...
    ... done
Elapsed time at end of score sort: real: 0.006s, CPU: 0.006s
displays suppressed
0dBFS level = 1.0
orch now loaded
audio buffered in 2048 sample-frame blocks
reading 8192-byte blks of shorts from adc (RAW)
Jack: JackClient::ClientNotify ref = 6 name = ce-01 notify = 0
Jack: JackClient::AddClient name = ce-01, ref = 6 
Jack: JackLinuxFutex::Connect name = jack_sem.1000_default_ce-01
Jack: JackClient::kAddClient fName = ce name = ce-01
Jack: JackClient::ClientNotify ref = 5 name = ce notify = 18
Jack: JackClient::ClientNotify ref = 5 name = ce notify = 18
Jack: JackClient::SetupDriverSync driver sem in flush mode
Jack: JackLinuxFutex::Connect name = jack_sem.1000_default_ce-01
Jack: Clock source : system clock via clock_gettime
Jack: JackLibClient::Open name = ce-01 refnum = 6
system sr: 48000.000000

...

new alloc for instr 18:
new alloc for instr 20:
new alloc for instr 21:
WARNING: rtjack: xrun in real time audio
Jack: JackClient::ClientNotify ref = 5 name = ce notify = 18
Jack: JackClient::ClientNotify ref = 5 name = ce notify = 18
^C
csound command: Interrupt

csound command: Terminated
Interrupted.

it's no different when I add <> noTrace.

I don't want these messages - I just want to see the expression that I just typed in ghci.

I understand that it's good to have the messages available (e.g., for debugging), and I understand that there are use cases where the messages don't hurt (e.g., when you mainly want to work with a GUI, not the console). But my application is for teaching - just evaluating an expression: while the sound is playing, students should study the expression. I can get this by scrolling back several pages - that's entirely possible, but inconvenient.

anton-k commented 3 years ago

Ok, I've investigated this topic.

noTrace - sets message level to minimum, but unfortunately it still shows the preamble of setting things up, though it does not show any notes or midi trigers.

There is option in csound called --logfile=FILE and we can set it to null. This way it supresses all debug output from csound.

But unfortunately right now it's not possible to use it since it works only if it's passed to csound command line directly and right now this part is hardcoded.

With data type Options we can control only options that are set within the .csd file. i was not aware that --logfile needs special treatment. I'll try to fix that.

If you need it I can add specific options that are passed to csound during invokation.

anton-k commented 3 years ago

I've fixed that. Now on it's default behavior. To print no trace info. To get it back use setTrace.

jwaldmann commented 3 years ago

Great! I confirm that it works (csound-expression-5.3.4 from hackage of today)

To be precise - works with pulseaudio, but does not silence jack output.