p-groarke / wsay

Windows "say"
BSD 3-Clause "New" or "Revised" License
141 stars 11 forks source link

Device detection bug. #32

Closed p-groarke closed 3 months ago

p-groarke commented 4 months ago

Report :

There's one peculiar issue. In my test version, with everything local to my exe everything worked like a charm. Now that the speech & sound module is completely rewritten from using MS SAPI, and then Sox ( https://sourceforge.net/projects/sox/) to apply filters, I moved this module over to Codeblocks. After further editing of my code wsay suddenly stopped working. It gave exit code -1073740791.

According to chatGPT: "An exit code of -1073740791 in Windows typically corresponds to the hexadecimal value 0xC0000409, which indicates an "Unknown Exception" or "STATUS_STACK_BUFFER_OVERRUN".

Testing further, I found that it only happens when starting wsay from a subfolder (in the user %AppData% folder) I was intending to use in release versions. The idea is to have my main program run in a working directory with subfolders like bin, data, sound, etc.

Running it from the command line I got this :

*C:\Users\Ivan\AppData\LocalLow\Icarus\ReVoice\bin>wsay "test"Couldn't
detect default audio device, using first.Please report this so I can
improve default device detection,
ty!C:\Users\Ivan\AppData\LocalLow\Icarus\ReVoice\bin>wsay -l1 : Microsoft
Hazel Desktop - English (Great Britain)2 : Microsoft David Desktop -
English (United States)3 : Microsoft Zira Desktop - English (United
States)4 : Microsoft James - English (Australia)5 : Microsoft Catherine -
English (Australia)6 : Microsoft Linda - English (Canada)7 : Microsoft
Richard - English (Canada)8 : Microsoft George - English (United Kingdom)9
: Microsoft Hazel - English (United Kingdom)10 : Microsoft Susan - English
(United Kingdom)11 : Microsoft Sean - English (Ireland)12 : Microsoft David
- English (United States)13 : Microsoft Mark - English (United States)14 :
Microsoft Zira - English (United States)15 : Microsoft Bart - Dutch
(Belgium)16 : Microsoft Frank - Dutch (Netherlands)17 : Microsoft Matilda -
English (Australia)18 : Microsoft Eva - English (Canada)19 : Microsoft Eva
- English (United States)Couldn't detect default audio device, using
first.Please report this so I can improve default device detection, ty!*

So it may be Windows related, maybe it doesn't like executables being there ? Anyway I can work around that and place wsay.exe in "Program Files" or a bin folder in the user's home directory and use that AppData subfolder as a working directory. However, in the long run, for compability and a clean setup it might be better to have wsay in that AppData/../ReVoice/bin folder.

p-groarke commented 3 months ago

@IvanScheers Was able to repro :)

The problem is actually a permission's issue. You can't enumerate the audio playback devices from LocalLow, at least not without futzing around with permissions.

Instead, you can put your files in Local (Local\Icarus\ReVoice\bin). Which is the expected location anyways (LocalLow is for web "safe mode" things from what I could find). That should fix your issue. I'll add a better warning in the future whenever no devices are detected.

Thx again for reporting this, keep em coming! XD

IvanScheers commented 3 months ago

Thanks for investigating. I thought it would boil down to something like that.

I'll decide later where to put my stuff when release is imminent. I'll be spending some time porting from Nim (www.nim-lang.org) to C++. I love the language, but I had no idea my executables would be false flagged by so many virus scanners, just because it's Nim code. Apparently it is/was popular among virus creators, so a lot of anti-virus software flags software if it detects Nim features.

ChatGPT is helping, but it's going to be quite a task. Being false flagged by 48 out of 72 virus scanners doesn't make a happy day :-(

Anyway, wsay to generate the TTS as .wav, combined with miniaudio to play them, proves to be a great asset. I had to rewrite some of the code. Initially I was threading playback (it has waits for the right instant, background noise, filtering...) but it ate up over 20% of processor resources. Looping over everything in the main thread only uses 1 to 3%. Kind of important as an addon for a resources heavy simulator.

Thanks again for creating wsay. I'm very glad I stumbled onto it.

Oh, maybe one remark. It's of no importance to me, but in interactive mode, it might be interesting that if -o is given, there would be one wav per sentence passed to wsay. Like out0001.wav out0002.wav ... instead of one big out.wav file at the end.

Kind regards, Ivan

On Fri, 17 May 2024 at 18:21, p-groarke @.***> wrote:

@IvanScheers https://github.com/IvanScheers Was able to repro :)

The problem is actually a permission's issue. You can't enumerate the audio playback devices from LocalLow, at least not without futzing around with permissions.

Instead, you can put your files in Local (Local\Icarus\ReVoice\bin). Which is the expected location anyways (LocalLow is for web "safe mode" things). That should fix your issue. I'll add a better warning in the future whenever no devices are detected.

Thx again for reporting this, keep em coming! XD

— Reply to this email directly, view it on GitHub https://github.com/p-groarke/wsay/issues/32#issuecomment-2118051276, or unsubscribe https://github.com/notifications/unsubscribe-auth/ASQMO4OJSGM7LIS2W65WABDZCY375AVCNFSM6AAAAABH2OZ72WVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCMJYGA2TCMRXGY . You are receiving this because you were mentioned.Message ID: @.***>

p-groarke commented 3 months ago

Ugh antivirus false-positives -___- Microsoft enabled machine learning on Windows 11 and there's not one release of mine it won't false detect. I have to send every wsay update in to microsoft for analysis.

Had never heard of nim, looks interesting. Sucks to have to port like that :( But I'm glad my little tool is saving you some time. Take care!