Page 1 of 2

Sound Record revSpeak

Posted: Tue Jan 26, 2010 11:42 pm
by deeverd
Hello Forum,

I've been experimenting unsuccessfully for a couple days with trying to use revSpeak to turn text to audio that is recorded as a wav file automatically.

Specifically, what I'm trying to do is to create a little program that would read aloud an article or book, and also record the audio through the internal mic while rev is speaking.

When it comes to using revSpeak and revStopSpeech, I'm quite proficient, but I've never created an audio recorder with Rev before and hence the difficulties.

Here is some of the script that I've tried (some of which works):

on mouseUp
set the recordInput to "imic" -- internal microphone
set the recordRate to 48 -- 44.1 is CD quality
put the platform into tPlatform

if tPlatform is "win32" then
set the recordFormat to wave
else
set the recordFormat to aiff
end if

set the playLoudness to 100
record sound file "revTest.wav"
revSpeak field "audioTextField"

end mouseUp

To stop the reading and recording, I'm using:

on mouseUp
revStopSpeech
wait 10 ticks
stop recording
end mouseUp


I'm sure there's plenty wrong with this script. For one thing, I'm especially unsure with the "record sound file" command. In this case, I am asking it to save to a non-existent file "revTest.wav" How does one actually get that to occur? How does one actually find where "revTest.wav" is located after it has been successfully created?

My hope for the near future is to be able to turn text into wave files, so I can create my own audio books to listen to while driving (I have a 120 mile commute every day), so any insights along these lines would be greatly appreciated.

Thanks in advance, deeverd

Re: Sound Record revSpeak

Posted: Wed Jan 27, 2010 12:30 am
by bn
Hi deeverd,
I tried your script and it works for me on a macbook pro.(the quality is less then stellar, because of the speakers, but anyways)

I just added a path to the file you create when recording. The way it set up now the file will be stored on the desktop. Any new recording will overwrite a previous recording into that file. Without that path your file would be created in the default folder, which is, if not set otherwise, the application folder of the Rev application on a mac.

Code: Select all

on mouseUp
   set the recordInput to "imic" -- internal microphone
   set the recordRate to 48 -- 44.1 is CD quality
   put the platform into tPlatform
   
   if tPlatform is "win32" then
      set the recordFormat to wave
   else
      set the recordFormat to aiff
   end if
   set the playLoudness to 100
   --------- here is the folderpath
   put specialfolderpath("desktop") & "/" into tPathToDesktop
   --------- use the folderpath and combine it with the fileName
   record sound file (tPathToDesktop & "revTest.wav")
   revSpeak field "audioTextField"
end mouseUp

Re: Sound Record revSpeak

Posted: Wed Jan 27, 2010 5:37 pm
by deeverd
Hello bn,

Thank you very much. When you said that my code actually worked for you, I double-checked what I wrote in this forum, and compared it to what I actually put in the script in my program, and found out that I had forgotten to put the quotation marks around "revTest.wav" in my test program.

The folder path info that you gave me was definitely needed, so thanks again for that insight.

All the best,
deeverd

Re: Sound Record revSpeak

Posted: Thu Jan 28, 2010 10:13 am
by Klaus
Hi friends,

I would recommend a tiny change:

Code: Select all

...
 if tPlatform is "win32" then
      set the recordFormat to "wave"
      put ".wav" into tSuffix
   else
      set the recordFormat to "aiff"
      put ".aif" into tSuffix
   end if
   set the playLoudness to 100
   record sound file (specialfolderpath("desktop") & "/revTest" & tSuffix)
...
The devil is in the details & Murphy's law :)


Best

Klaus

Re: Sound Record revSpeak

Posted: Thu Jan 28, 2010 11:38 am
by bn
Hi Klaus,
thanks for pointing that out. It slipped my attention when it worked as posted. I was startled that revspeak and and sound recording at the same time worked at all...
And the way you treat the path & suffix is a lot cleaner.
regards
Bernd

Re: Sound Record revSpeak

Posted: Sat Jul 20, 2013 10:23 pm
by treefolk
Hi, Does this still work with Livecode Community edition and Windows platform? I have been trying to use the scripts here to no avail. The file does not get created as far as I can tell.

Re: Sound Record revSpeak

Posted: Sun Jul 21, 2013 5:07 pm
by Klaus
I think this requires QuickTIme to be installed, is it?

Re: Sound Record revSpeak

Posted: Sun Jul 21, 2013 5:21 pm
by treefolk
I have quicktime installed, and the revSpeak command works, it just doesn't start actually recording(as far as I can tell) or saving the file. I'm not sure why not. I am using Bernds record script with the stop button from Deeverds original post. Not sure what I'm doing wrong.

Thanks,
Treefolk

Re: Sound Record revSpeak

Posted: Sun Jul 21, 2013 5:40 pm
by Klaus
Hi Treefolk,

stupid question (maybe ;-) ) but do you "stop recording" at some time, and does the file THEN exist?

Maybe recording will go to a temporary file and saved to the actual file AFTER the recording is finished?
Just a guess...


Best

Klaus

Re: Sound Record revSpeak

Posted: Sun Jul 21, 2013 5:48 pm
by treefolk
I am using deeverds record script on one button, and then have a stop button with this script:

on mouseUp
revStopSpeech
wait 10 ticks
stop recording
end mouseUp


I hit the record button,( with deeverds script) then when the field is done being spoken I press my stop button with the above script, still no file...

edit: I have tried deeverds script as is, as well as with the changes Klaus recommended, still no file.....

Re: Sound Record revSpeak

Posted: Sun Jul 21, 2013 5:56 pm
by Klaus
Ah, OK, just wanted to be sure :-)

Does it work if you do NOT use revspeak at the same time?
Sorry, just wildly guessing...

Re: Sound Record revSpeak

Posted: Sun Jul 21, 2013 6:10 pm
by treefolk
Well, I commented out the revspeak line in the script, and still no file. So i'm not sure if perhaps it's a hardware/software problem on my end? Running windows 7 x64 and Livecode Community. I also have a personal licence for livecode 5.5, but it seems that this doesn't work in either version......

Re: Sound Record revSpeak

Posted: Sun Jul 21, 2013 6:27 pm
by Klaus
Hm, sorry, no idea in the moment...

Re: Sound Record revSpeak

Posted: Sun Jul 21, 2013 6:30 pm
by treefolk
Klaus,

No worries, from what I can tell you are this forums resident livecode super-hero, and I appreciate your input. I shall keep digging around, and if i ever figure it out I will be sure to post my results back here!

--treefolk

Re: Sound Record revSpeak

Posted: Sun Jul 21, 2013 9:27 pm
by Klaus
Hi treefolk,

thank you for the kind words, much flattered :-)

I don't know if this does also work with record, but try this:
...
record sound ...
## THE RESULT should be empty on success, otherwise we might get a hint, if this woks with "record sound"!
put the result into fld "debuggy" # which needs to be created! ;-)
...

Best

Klaus