need help with returned message

I am using Audacity and the Nyquist SilenceMarker to process files and would like to find out how to cause the following to be redirected to the commandline not a wxMessageBox.

;If no silence markers were found, return a message
(if (null l)
 (setq l "No silences found. Try reducing the silencenlevel and minimum silence duration.")
)
l

I see the last line of the script is the single char:
l
and wonder if this is a return value and I think in the above if it gets to

if (null l)

it uses setq to change the null return into a string but I am having a lot of trouble learning the scripting language! I have removed the entire

;If no silence markers were found, return a message
(if (null l)
 (setq l "No silences found. Try reducing the silencenlevel and minimum silence duration.")
)

and it does eliminate the message box but it would be nice to redirect (this as well as everything) to the commandline.

BTW, using a single char l as a variable is questionable at best–in many fonts it is visually extremely hard to distinguish from a 1 (one)!

l an el
1 a one

(I’ll use upper case for “L” - Nyquist is case insensitive anyway.)

The function (add-label …) , which is defined on line 49, returns a variable “L” which is a specially formatted list:

((int-or-float "string") (int-or-float "string") ... )

Note that this is a list of lists.
(int-or-float “string”) is a list with 2 elements.
The label list will be a list where each element is a list in the form (int-or-float “string”).

When a Nyquist script reaches the end, the final returned value is passed to Audacity.
If the value is a string or number, it is output to the primary display (screen).
If the value is a sound, it is output to the selected track.
If the value is a single channel sound and the track is a multi-channel (stereo) track, then the sound will be sent to all (both) channels.
If the value is a multi-channel sound and the track has less channels, an error is generated.
If the track contains channels with different sample rates (for example Left channel is 44.1 and right channel is 48 kHz), an error is generated.
If the value is a suitably formatted list, labels are generated. (if there is a label track selected the label(s) will be sent to the first label track. If there is no label track selected then a new label track is created).

Note that the format for labels has changed from 1.2.6 to 1.3.12
Audacity 1.2.6 requires the list to be in the form (where “number” is an integer or flonum)

((number "string") (number "string") ... )

Audacity 1.3.12 can either use that form (for point labels) or for “region” labels:

((number number "string") (number number "string") ... )

;If no silence markers were found, return a message
(if (null l)
(setq l "No silences found. Try reducing the silencenlevel and minimum silence duration.")
)

All that that code is doing is checking to see if “L” is still “NIL” (it was initialised to NIL in line 44).
If “L” is still NIL, then no label lists have been generated, so “L” is given a string value (the message) which Audacity then sends to the screen.


Sorry, I can’t help you with how Audacity captures the returned data from Nyquist, or how it then sends it to the appropriate place - that’s all in the Audacity code and I’ve no idea when it comes to C+.


I’ve hated the use of the l char in this script.
If you’re after votes for changing it, put me down for +L

Thanks for the details, it gives me more to search for. Unfortunately the c++ code is not well commented and often the variables are either abstruse or duplicated all over the place.

L++

Thanks! That was all I needed got it now.