Jump to content

Put a "Pronounced" sound as a file in a container - use "Say" command line with Perform AppleScript


This topic is 2740 days old. Please don't post here. Open a new topic instead.

Recommended Posts

  • Newbies

Hi,

I try to put in a container an audio file with the text pronounced by FM from a text field.

As I didn't see how to do it from FM, I tried to build my first Perform AppleScript [] using the terminal command "Say"

On the terminal : (say "hello") works fine.

and (say "hello" -o filename.aiff) => creates a file with the sound "hello".

 

From filemaker, Perform AppleScript ["say \"hello\”"] : make the Mac pronounce correctly.

But I can't run :  Perform AppleScript ["say \"hello\” -o filename.aiff"]

I have a error message "Identificator can't be after identificator".

I couldn't find anyway out.

Does any of you have an idea ? 

Link to comment
Share on other sites

I am afraid you are confusing AppleScript and Terminal. Both have a say command, but the behavior is different.

To make the AppleScript say command save the result to a file, use something like:

set myFile to (((path to desktop folder) as string) & "filename.aiff")
say "hello" saving to myFile

 

Alternatively, you can use AppleScript's do shell script command to execute Terminal commands from AppleScript. So something like:

do shell script "say -o filename.aiff hello"

 

 

Link to comment
Share on other sites

  • Newbies

Hi,

Thank you very much for explaining me that there are two "say" commands which I was confusing. It is much clearer to me now.

Still, I did not manage to save the file which any of the 2 options.

 

Option 1: I wrote Perform AppleScript[say "hello" saving to "/User/Antoine/hello.aiff"]. Nothing happened (Antoine is my User name)

Option 2: I wrote Perform AppleScript[do shell script "say \"hello\" -o filename.aiff"]. I have error message "Opening output file failed: -54"

Do you have any suggestions to help me solve this situation ?

Antoine

Link to comment
Share on other sites

1 hour ago, AntoineD said:

Do you have any suggestions to help me solve this situation ?

I suggest you start by composing your AppleScript in the Script Editor application. Once you have it working there, ask how to implement it in Filemaker's Perform AppleScript[] script step - if you cannot work it out yourself). Until then, this is not a Filemaker-related question. I will give you this hint, though: "/User/Antoine/hello.aiff" is a string, not a file path. And you need to use AppleScript syntax for file paths - see: http://www.satimage.fr/software/en/smile/external_codes/file_paths.html

Link to comment
Share on other sites

  • Newbies

Hi, 

Great, it works !!!

Thank you so much for your help

 

For any futur reader in the forum, here is the final code: 

Perform AppleScript["set myFile to \"Macintosh HD:Users:Antoine:Desktop:" & Memrise::Russian & ".aiff\""&"¶say " & Citation(Memrise::Russian) & " using \"Yuri\" saving to myFile"]

Note 1: I had to use Yuri voice because the text to read is in Russian.

Note 2: The file is created on my desktop, which is fine for me.

Note 3: "Memrise" is the name of my FM file and table. "Russian" is the name of the field I wanted to "say" and save in audio file.

Antoine

Link to comment
Share on other sites

This topic is 2740 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.