12 December 2022

NaturalReader 9 running on Linux Wine...


  The installation of Mint 17.3 Rosa, (Trusty), 64-bit, on an adjacent partition got me wondering if there were any performance improvements to be had when running Windoze app$ on Linux Wine 64-bit.  I was particularly interested to see how NaturalReader 9 fared.  As I've alluded to in past posts, I bought NR 6.6 way back in 2007 and qualified for upgrades up to NR 9 - or until I didn't - the NR download-link just went dead on me!

 My opinion of NR has always been, at best, luke-warm.  NR is basically a poorly implemented front-end for the AT&T text-to-speech engine.  An apples-to-oranges comparison might be with one of my favourite M$ apps, Wavepad, which similarly, is a front-end for the excellent 'ffmpeg' command-line media tool.  Except that Wavepad is an order of magnitude better programmed!  NR's annoyances I've already commented on in the past, but to its credit, when running on a Windows box, all of the options available on the 'Standard' version (which I bought), do work.

 Which is not the case with Linux Wine.  In fact, NR 6.6 was the only NR I ever managed to get running with Wine, and barely at that.  It would load, and I could play back audio from text in its editor.  Occasionally, it would allow me to save small text-to-audio files as WAV's but never as compressed mp3 or ogg files.  NR 9 on the other hand proved a complete disaster.  I never even managed to get it to install & run, so  was limited to running it on a Windows computer, or from within Virtualbox - both tedious affairs.  So, that's literally 15 years of masochistic involvement with NR & Linux Wine I've endured thus far!

 Fast-forward to today.  While trying to formulate yet another plan to get NR 9 running on Wine, I happened across online, the 'ppa' of a more recent version of Wine, v1.8 versus the ancient v1.62 I've been using for more than a decade.  Up until that 'discovery', I had always assumed that given Mint 17.3's EOL status, newer ppa's had long ago gone off-line - apparently not!  That revelation was followed in short order by yet another find - an even more recent Wine ppa that included 'Trusty' support, this time sporting version 4.0!!!  Within the space of 30min, I had Wine 4 installed and the fun began.

 Or more of the same, take your pick.  On the one hand, NR 9 for the first time, installed & ran.  On the other, the same problem that had blighted NR 6.6, was present with NR 9 as well - it could not detect any 'voices', so no audio play-back was possible!  When initially installed, this horrible software assumes that all of the essentials it requires to operate, were previously installed.  It is only when the program is run, that it realises its mistake, and issues the vague warning about the 'missing voices', but nothing specific that might help correct the issue.

 The dilemma I've faced for more than a decade is, what exactly needs to be installed in order to enable these damn voices?

 This is where I finally made some progress.  'SpeechSDK', a M$ library installable through 'Winetricks', was always conspicuous as a requirement.  And with NR 6.6, once installed, it usually provided the missing voices - though not always - it was temperamental!  But the voices were always missing with NR 9.  After hours of searching, I made the enlightening discovery that 'SpeechSDK' was a '32-bit-only' package - only supporting 32-bit OS's up to WinXP.  Yet, despite this, it would still install on a Wine's 64-bit emulation of a 64-bit Windows OS - it just wouldn't work!  Maddening!!!  The next 'solution' I learnt, was to create a new 32-bit Wine 'Profile', set the OS type as say, Win XP, install SpeechSDK followed by NR 9, and everything would 'just work'.  Except it didn't...

 When it was appearing that installing Mint 17.3 64-bit had been a huge mistake, I eventually hit on a Winetricks-provided solution that worked.

1)    Through 'Wine Configure', set 'Windows version' as 'Windows 2000'.

2)    Create a 32-bit Wine Profile.

3)    Remove 'Mono' if installed (otherwise prevents NET 2.0 install).

4)    Install NET 2.0 (otherwise NR crashes during install).

5)    Install Richedit 3.0 (otherwise manual file-splits painfully slow).

6)    Install SpeechSDK.

7)    Install NR 9.

 Sorted!  'sapi' it turns out was Microsoft's answer to voices for 64-bit machines and is a tiny part of a relatively massive 550MB Service Pack Upgrade for Win7.  On the face of it, this shouldn't work either,  given we're working with a 32-bit Wine Profile, but it does.  All of this of course would have been unnecessary had the crappy NR software checked for missing libraries at installation time and provided what was missing.

 But alas, there's no happy endings where NR is concerned.  I found that with NR 9, I still cannot save converted audio files as mp3, and for the most part, as ogg files either - specifically, with 'normal' settings selected, ogg encoding doesn't work, but with an 'Advanced settings/Customize' option that encodes a stereo ogg-file, encoding works.  This however, is unsatisfactory for 2 reasons; 1) the TTS engine can only produce monaural speech files, and 2) encoding as stereo will double the size of the ogg file that's produced - so my audio-book archives would be twice the size necessary.  What does now seem to work properly is saving as WAV files.  I've just created an entire audio-book this way without a hitch.

 After spending further hours of searching for a solution to the mp3/ogg dilemma, I've come to the conclusion that there isn't one.  NR uses the standard 'lame_enc.dll' for its mp3 encoding.  Apart from it being a relatively ancient single-thread encode version, it works perfectly when run natively on Windows.  It just won't run at all on Wine.  I can only conclude that the idiot(s) that programmed NR, are passing parameters to the encoder dlls in a non-standard way.  'foobar2000', the excellent & free M$ media player employs the same encoders and it works perfectly.  To pour salt in the wound, I recently came across another piece of TTS software - TextAloud.  As luck would have it, this works perfectly - it includes & installs if necessary, the M$ TTS 'voices', so that playback, encoding etc. 'just works', out of the box.  Coming across this 15 years ago (had it existed) would have made my life so much easier.

Edit:

 I should have guessed that the somewhat ebullient tone of this post would prove fleeting & short-lived.  I presumed that the results above, other more up-to-date Linux distros, would also inherit - but this has proven not to be the case.

  Having tried & failed to get Chrome Remote Desktop working properly with ANY of the distros I have installed on various computers, I stumbled across another remote access piece of software from https://www.dwservice.net (DWS) that works fantastically on everything I've been able to try it with, namely Windoze, Linux & Raspberry, but it also works with Mac and a couple of others I can't remember.  Unfortunately, with Linux, it's a newish 64-bit OS only affair, but the performance of DWS convinced me that it was worth the effort of installing Mint 21.1 64-bit on my old laptop workhorse.  I may actually review this here at some stage, but for now, suffice it to say that it performed better than I expected it to, and DWS worked perfectly with it.

  Mint 21.1 'seemed' to work so well, I decided to install all of the 'essentials' I rely on, and this obviously included Natural Reader 9.  So imagine my disgust when after installing Wine 6 from the repositories, NR9 refused to run without crashing.  Indeed, it sometimes refused to even install, and despite trying everything possible, going as far as installing a pre-6 version binary of Wine, I'm back to square-one, with none of the above working with Wine 6.  Sickening.

 The fairly lengthy period of time I've spent trying (again) to crack this problem has only managed to highlight glaring problems with Mint 21.1 itself, the most damning of which are frequent system lock-ups - along the lines of 'kernel-panic' errors - and for no obvious reason.  In one instance, the power-off button itself had no effect, removal of the laptop's battery being the only solution to restart the OS.

 So, all in all, a demoralising experience.  NR9 when coupled with Wine is still the shitiest piece of software I've ever come across, and Mint 21.1 just doesn't make the grade as a permanent replacement for Mint 17.3 - so a double-whammy!

Edit1:

  I've edited the above 'How-to' slightly, casting aside 'sapi', and reverted back to using just 'SpeechSDK'.  Technically, while 'sapi' was a replacement for SpeechSDK, developed in readiness of the switch-over from 32 to 64-bit OS's (Win7 64-bit and up) it also works fine with the 32-bit version of Win7.  Since most M$ apps that I use worked fine running on Wine 4.0, I built a 4.0 binary from the Wine 4.0 source but on Mint 21.1 64-bit, fully expecting the same apps to run perfectly on it.  They didn't!  In fact, all that would run were parts of Wine itself, such as 'winecfg' & 'wine uninstall' - no Windows app would run!  After a bit of reading, I learned that Wine relies almost exclusively on 32-bit libraries in order to run Windows apps.  Given that practically all Linux OS's are now 64-bit in nature, this complicates matters out of all proportion - for a usable Wine setup, you have to somehow build it on a 64-bit system, but using 32-bit libraries!  According to the online How-to's, 'chroot' & 'lxc' are the two most viable options.  I've tried & failed using the 'lxc' method - I managed to create the 'lxc-container' ok, but couldn't for the life of me get it to 'Start'.  But even if I had succeeded in this 'first-step' of creating a build-container environment, I then have to locate all of the essential 32-bit Wine libraries.  The crazy thing is that there is no step-by-step information on how to do all of this online, that I've been able to find anyway.  So right now, I'm done with it.

 What I did manage to do was build from source, Wine 4.0 on my old 32-bit Trusty (pun intended) setup and have uploaded the binary to Google-drive, with the link provided here.  Remarkably, 'ogg' encoding now works perfectly!  This 'success'  prompted me to spend loads of more time trying to get 'mp3' encoding to work as well - unfortunately, all for naught.  Out of boredom, I also tried installing this on Mint 21.1 64-bit - knowing 'full-well' that it wouldn't allow it - but install it did, and without issue!  What it didn't do was run Windows apps or give any indication that Wine had even installed!!!  I felt like I was being toyed with...

 As the saying goes;

     "Those whom the Gods want to destroy, they first make mad". 

 Edit2:

    Yep, NR is proving to be the gift that keeps on giving.  I decided to set up a fresh Mint 17.3 32-bit on another PC, complete with NR.  Following the above list in order to get it going, I found it didn't work!!!  The issue turned out to be that the version of 'winetricks' used is of over-riding importance - I'm including it here for completeness.  Whatever magic this version manifests, it appears to be a necessary ingredient in getting this crap to run with voices enabled!  Although above I include creating a new Wine profile as a necessary step, it isn't really, so can be left out.