2022-02-09
Various changes to text based modules.
Published as pre-release. 2022.2.9.0]
I wanted Wren to be able to react to what goes on in the electro-music.com chat, and as I already run an IRC bot which can produce a log file I’ve decided on making some modules able to read the last line of that log. This involves the following modules:
- Morse
- eSpeakVoice
- TSS
- Song
- SapiVoice
These all have an input field for text to process, what I did was to allow for special text that will be interpreted and it may read from a file now.
When you use ‘file:filespecs’ the filespecs will be split in two parts, the first being the filename to use and the second (optional) part makes a filter. It will be the last non-empty line from that file whih is read and when the filter is present it will process that line and that will be the text to be used by the modules.
The syntax to be used is :
file:fillename
or
file:fillename regular-expression
The regular expression being the filter, and the file name can not have spaces in it.
The last non-empty line of the file will be read (or an error message will be returned) and that line will be filtered with the optional regular expression.
When the regular expression contains a group named ‘result’ that will be the matched bit from that last line.
Example:
file:X:\filedir\filename.log (?:msg\s\[)(?<result>.*?)(?:\]\shost) pointing to some file on drive X: with a specified filter which has a group named 'result' (and two other un-named groups of stuff we are not interested in). the last non empty line of the specified file could be (this is from a log of an IRC chat session, a private message from jan to IRC channel #electro): '2022-02-09 01:30:23.784 | priv : [jan -> #electro] msg [pwew .. filter is hard o_o] host [~jan@xxx-xx-xxx-xxx.yyy.zzz.nl]' The regular expression matches: 'msg [pwew .. filter is hard o_o] host'. The named group 'result' matches: 'pwew .. filter is hard o_o' and that in this case is the bit we want.
Then, in addition I’ve made the TSS module work by default by setting it’s speed parameter to be 1.0 initially (it was zero, and with that the module will not actually run).
Also I’ve added simple SolReSol support to the Morse module, it has no knowledge of grammar and it has a limited set of words - the output is available as the blue output of the Morse module and is meant to be processed by a ScaleQuantizer (being set to a Major sccale for a strict implementation, but other scales with seven notes are usable too (less than seven notes would strip out some of the output values)).
A note about SapiVoice - it does not seem to work ok in the 64 bit Wren version.