Text-to-speech

andy's Avatar

andy

31 Oct, 2014 03:38 PM

It would be really nice if I could click/tap an icon on a card to have the system (iOS or OS X) read it to me. The "say" utility on OS X could be shelled out to (but you'd need to choose a voice/language - as my cards are half-Korean and half-English - it's the Korean sides that I want reading out).

Since iOS7 there's AVSpeechSynthesizer and AVSpeechUtterance that allow you to utilise text-to-speech.

Failing this, is there any AppleScript interface, so that I can loop through my cards, pull out the first facet's text content and then upload an MP3 back in to the app - all automated. I can use "say" and "lame" to convert a piece of text to an MP3, but doing this manually for every card (now and as I add them) will be a major pain in the ass...

Great software though guys, I'm new to it but loving it.

  1. 1 Posted by Justin on 31 Oct, 2014 06:39 PM

    Justin's Avatar

    I second this feature request. There's a free app for iOS, Flashcards, that does this already.

  2. Support Staff 2 Posted by drewmccormack on 01 Nov, 2014 07:52 AM

    drewmccormack's Avatar

    I’ve added this request to our list.

    In the meantime, on OS X, there is a standard Edit > Speech menu that you can use to speak the slides. I think you can add a keyboard shortcut using the System Preferences.

    I just tried this, and it didn’t read my foreign words well, but I think if you changed your keyboard or language settings, you can probably get the Korean.

    If you want to try adding the sound files with ‘say’, there is no applescript, but there is an export/import format that is editable: Study Archive. If you export your notes in Study Archive format, the file you get is a zip archive (change extension to zip in order to unzip, or use command line tool).

    It is a basic comma-separated values format. You can read more here: http://www.mentalcaseapp.com/studyarch/ <http://www.mentalcaseapp.com/studyarch/>

    I think it should not be too hard to extract a value from one column, run it through ‘say’ to generate a file, and append an audio column. The advantage of this is that it would also work on iOS.

    If you manage to generate the new files, just zip it up again, and change the extension to studyarch.

    Kind regards,
    Drew

    PS If you like the app, please consider writing an app store review. They really help us.

  3. 3 Posted by andy on 01 Nov, 2014 08:27 PM

    andy's Avatar

    Thanks Drew. I tried the Edit > Speech menu item here and it did nothing in the slideshow view (and I definitely have the voice for Korean installed).

    I had a look at the Study Archive and there were 6 columns - nothing for audio attachment. If I just add a column prefixed with the facet number 1 referencing the filename, zip it back up - how would I get this back in to the app?

    Would be good to get this in the app sooner rather than later (should be quite easy - I'm a developer too). There's another issue I'm having with sync. I'll hold off on writing a review until these are resolved as they will definitely affect my review score.

  4. Support Staff 4 Posted by drewmccormack on 01 Nov, 2014 08:52 PM

    drewmccormack's Avatar

    I tested the speech menu today and it was working for me. What version do you have?

    If you add an Audio column, as the web page describes, then zip, and change the file extension to studyarch, you can just double click to reimport the data.

    Kind regards,
    Drew

  5. 5 Posted by andy on 03 Nov, 2014 08:41 AM

    andy's Avatar

    Sorry Drew, I'd skipped the link you sent me as I'd already been nosey and looked at the contents of the file :-)

    I'll write a little Ruby script to unzip the archive, add the audio for any missing ones and then zip it back up again. I'll post a link when I'm done for anyone else.

    Regarding the Edit menu option, I'm running MC 2.6.6. However it is probably the fact that there's no way of choosing the language/voice for my Facet 1s. If I run the following at the command line:

    say "안닝 하세요"

    I get nothing. But if I change it to:

    say -v "Yuna" "안닝 하세요"

    It correctly says it in Korean.

    Anyway, it will be lovely when this functionality is integrated in some way, but for now I'll write a script as a work around. I don't suppose there's any command line utility to export/import these studyarch files so I can automate it more completely? I had a nose around in Mental Case.app/Contents but couldn't find anything.

  6. Support Staff 6 Posted by drewmccormack on 03 Nov, 2014 08:47 AM

    drewmccormack's Avatar

    Hi Andy,
    No, there is no command line tool. You can export multiple stacks at once though, and have your script iterate over the directories.
    I played a little with the voice, and it seems like if you change your keyboard selection to Korean, it then will use the Korean voice. I am pretty sure you should be able to find a combination of language options in the System Preferences to speak in Korean.
    Drew

  7. 7 Posted by andy on 03 Nov, 2014 08:52 AM

    andy's Avatar

    Hmmmm... I have a global keyboard shortcut that I use a lot to switch between keyboard layouts, whether it's currently in English or HNC Romaja (one of the Korean input styles) seems to make no difference to the Edit > Speech menu.

    For me when I click Start speaking, if I go back to the menu both are still enabled (start and stop). Is that the same for you? Or does the Start speaking item become disabled (because it's already started)?

    I definitely have the Voice installed and the Keyboard layout installed and working fine outside of Mental Case. Any other ideas to help debug it?

    The only error I am getting in "Console.app" is:

    03/11/2014 08:50:01.791 Mental Case[26198]: Error merging: Error Domain=CDEErrorDomain Code=201 "The operation couldn’t be completed. (CDEErrorDomain error 201.)"

    I don't think that will help though as that seems to be related to your Ensembles framework.

    For now, don't worry about it - I'll go down the MP3 route. I can hold off on native functionality until the Text to Speech API is more fully integrated.

  8. 8 Posted by andy on 03 Nov, 2014 09:07 AM

    andy's Avatar

    From my script so far, it seems the CSV file in the Study Archive isn't in UTF-8? I've tried reading it as BINARY but Ruby's CSV library really doesn't like that...

  9. Support Staff 9 Posted by drewmccormack on 03 Nov, 2014 09:15 AM

    drewmccormack's Avatar

    I think it should definitely be UTF8.

    Drew

  10. 10 Posted by andy on 03 Nov, 2014 09:18 AM

    andy's Avatar

    It's definitely not showing correctly as UTF-8 in Atom either (aside from Ruby 2.1's CSV library).

  11. Support Staff 11 Posted by drewmccormack on 03 Nov, 2014 09:18 AM

    drewmccormack's Avatar

    Ah, sorry, I was wrong. I remember now: we changed it to UTF16, because windows didn’t handle UTF8 well. That seemed to be an option that worked well for most.

    Drew

  12. 12 Posted by andy on 03 Nov, 2014 09:24 AM

    andy's Avatar

    Ahh OK. Now I've converted to using UTF-16 I get a different issue (something internal to Ruby's CSV library). I think I'll just have to do this by hand...

  13. support closed this discussion on 06 Nov, 2014 07:09 AM.

Comments are currently closed for this discussion. You can start a new one.

Keyboard shortcuts

Generic

? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac