ImperialSquid / zotero-zotts

A Zotero plugin adding text to speech (TTS) functionality to various screens
GNU Affero General Public License v3.0
80 stars 1 forks source link

No voice output nor plugin settings on Arch Linux #79

Open atlantic-amber opened 2 months ago

atlantic-amber commented 2 months ago

Excuse any haphazardry, I'm not used to writing bug reports.

I've got zotts 1.1.1 installed on Zotero 7.0.0-beta.117+794dc6bf0, both latest releases. Zotero's installed manually, so I'm not having any of the Flatpak-related issues from the similar thread. My TTS backend is Piper via speech-dispatcher, similarly to https://github.com/ImperialSquid/zotero-zotts/issues/74, but I'm having different issues.

Upon startup, the debug output puts out a bunch of lines along the lines of the following, with the only difference being that the line number is sometimes 6779 or 6776:

JavaScript Error: "TypeError: addon.data.tts.engines[addon.data.tts.current] is undefined" {file: "jar:file:///home/user/.zotero/zotero/o8s1njjj.default/extensions/zotts@ImperialSquid.com.xpi!/chrome/content/scripts/zotts.js" line: 6773}]

I'm not sure whether that's relevant at all. Anyways, to answer the same things you asked in the thread, when I open Firefox (through Zotero's own Firefox browser, this is the exact same Firefox Zotero is running on) and go to the TTS testing site https://mdn.github.io/dom-examples/web-speech-api/speak-easy-synthesis/ Piper shows up just fine and can be used. Additionally, when I run window.speechSynthesis.getVoices(), the output seems appropriate, as though all is well:

[
    "0": [object SpeechSynthesisVoice] {
        "voiceURI": "urn:moz-tts:speechd:Piper?en-us"
        "name": "Piper"
        "lang": "en-us"
        "localService": false
        "default": false
    }
]

However, whenever I press any of the buttons or use the keyboard shortcuts, nothing happens! When I press them for the first time after opening Zotero I'll hear the small pop in my headphones that sometimes accompanies the beginning of an audio track, but nothing else! Also, the section in Zotero's settings that are supposed to house the settings for the plugin never shows up, nor do the "Read Title" "Read Abstract" buttons that are supposed to appear in the right click menu. I'm aware that there are issues with startup time on Mac and Linux, but this issue persists no matter how long I leave Zotero open! I've done various permutations of troubleshooting the issue but can't seem to crack it.

Thanks for your time.

ImperialSquid commented 2 months ago

Hi,

Sorry to hear you're having issues, thanks for taking the time to do your own troubleshooting and writing this all out though, it's very helpful!

I have some ideas about why it's not working for you but I'm a bit confused about the order of events, (the pop you hear when you first play something would indicate it's all loaded fine, but the lack of preferences window seems like it should've crashed while starting up)

Could you:

  1. Give an exact timeline of what you did for the JavaScript Error: ... error to occur
    • Open the debug menu before trying to use zotts
    • If the error is already there before you do anything else let me know
  2. In that javascript console where you ran window.speechSynthesis.getVoices(), type in Zotero.ZoTTS.data.tts.engines and let me know what value it has
  3. Tell me what config settings you see for zotts
    • Go to Zotero settings > Advanced > Config Editor
    • Search for "zotts"
    • Tell me what values you see (the ones in bold will be more important)
atlantic-amber commented 2 months ago

Confusingly, the audio pop is gone this morning. Note that I wrote this in concert with troubleshooting, so some of my initial answers are obsoleted by later discoveries. Leaving them in to help you debug.

  1. Took me a while to figure out, but the error pops up whenever I press the pause or stop buttons, or ask it to "read selection" or annotation or comment. 6779 corresponds to pause, 6776 corresponds to stop, 6773 corresponds to selection/annotation/comment. The errors will pop up every time I press one of these buttons no matter whether I just opened Zotero or have done other futzing. Pressing the regular play button has no effect anywhere as far as I can discern.
  2. The result is simply {}. I'm assuming there's supposed to be more there.
  3. Everything is prefixed with extensions.zotero.ZoTTS but for ease of transcription I'm just going to format it as key-value pairs. The only bolded one is extensions.zotero.ZoTTS.ttsEngine with a value of webSpeech
    newItemBehaviour: cancel
    cancel: C
    pause: P
    speak: S
    swapAnnotation: false
    swapLibraryItem: false
    ttsEngine: webSpeech // this one is bold!
    webSpeech.pitch: 100
    webSpeech.rate: 100
    webSpeech.voice: // this one was blank
    webSpeech.volume: 50

    Now, after finding that webSpeech.voice was blank, I did the obvious thing and put Piper as the value and re-opened Zotero. Now, the buttons for reading annotations, comments, and highlighted selections all work, as does the stop button/ctrl+shift+C. When I have an annotation selected, pressing the play button or ctrl+S reads the annotation as expected, and pressing ctrl+shift+S reads the comment as expected. When I click on things in the Library tab, pressing ctrl+S reads the title as expected, and ctrl+shift+S reads the abstract as expected.

Bizarrely, when I have text highlighted, both ctrl+S and ctrl+shift+S read the selection. Aren't these supposed to have different behavior, like one reads the document and the other reads the selection?

As you might have guessed, pressing the play button or ctrl+S without anything selected does not begin reading the document as expected. I've tested this with like 5 different documents of varying types. There is nothing relevant in the debug window, nothing happens at all. The settings section for ZoTTS is still not visible in Zotero settings, nor are the "Read Title" and "Read Abstract" options that are supposed to be in the right click menu in the library. I'm at a loss here.

New output from Zotero.ZoTTS.data.tts.engines:

{
    "webSpeech": {
        "name": "Web Speech API"
        "speak": function speak(text) {...}
        "stop": function stop() {...}
        "canPause": true
        "pause": function pause() {...}
        "resume": function resume() {...}
        "extras": {
            "getVoices": function getVoices() {...}
            "populateVoiceList": function populateVoiceList(doc) {...}
        }
    }
}
ImperialSquid commented 2 months ago

Hi @atlantic-amber

I've just spent the day overhauling how ZoTTS does it's loading/initialising. It might still take a while to start up but should hopefully give you better feedback in terms of errors, as well as only adding UI elements after the engine has loaded so you won't have any weird unresponsive elements.

Do let me know how you get on with this version, hopefully it's much more stable!

ImperialSquid commented 2 months ago

Oh also,

As you might have guessed, pressing the play button or ctrl+S without anything selected does not begin reading the document as expected.

I'm very aware this is a desired feature, unfortunately I couldn't do it for the first versions since accessing the full text of a document is harder than accessing the selected text. Rest assured this is a priority feature for the future though!

ImperialSquid commented 2 weeks ago

Hi @atlantic-amber, just checking up on old bug reports, are you still having issues?