Sound Record revSpeak

LiveCode is the premier environment for creating multi-platform solutions for all major operating systems - Windows, Mac OS X, Linux, the Web, Server environments and Mobile platforms. Brand new to LiveCode? Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

deeverd
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 165
Joined: Mon Jul 16, 2007 11:58 pm

Sound Record revSpeak

Post by deeverd » Tue Jan 26, 2010 11:42 pm

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

bn
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 4172
Joined: Sun Jan 07, 2007 9:12 pm

Re: Sound Record revSpeak

Post by bn » Wed Jan 27, 2010 12:30 am

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

deeverd
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 165
Joined: Mon Jul 16, 2007 11:58 pm

Re: Sound Record revSpeak

Post by deeverd » Wed Jan 27, 2010 5:37 pm

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

Klaus
Posts: 14199
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: Sound Record revSpeak

Post by Klaus » Thu Jan 28, 2010 10:13 am

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

bn
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 4172
Joined: Sun Jan 07, 2007 9:12 pm

Re: Sound Record revSpeak

Post by bn » Thu Jan 28, 2010 11:38 am

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

treefolk
Posts: 16
Joined: Tue May 21, 2013 10:54 pm

Re: Sound Record revSpeak

Post by treefolk » Sat Jul 20, 2013 10:23 pm

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.

Klaus
Posts: 14199
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: Sound Record revSpeak

Post by Klaus » Sun Jul 21, 2013 5:07 pm

I think this requires QuickTIme to be installed, is it?

treefolk
Posts: 16
Joined: Tue May 21, 2013 10:54 pm

Re: Sound Record revSpeak

Post by treefolk » Sun Jul 21, 2013 5:21 pm

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

Klaus
Posts: 14199
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: Sound Record revSpeak

Post by Klaus » Sun Jul 21, 2013 5:40 pm

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

treefolk
Posts: 16
Joined: Tue May 21, 2013 10:54 pm

Re: Sound Record revSpeak

Post by treefolk » Sun Jul 21, 2013 5:48 pm

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.....
Last edited by treefolk on Sun Jul 21, 2013 5:56 pm, edited 1 time in total.

Klaus
Posts: 14199
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: Sound Record revSpeak

Post by Klaus » Sun Jul 21, 2013 5:56 pm

Ah, OK, just wanted to be sure :-)

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

treefolk
Posts: 16
Joined: Tue May 21, 2013 10:54 pm

Re: Sound Record revSpeak

Post by treefolk » Sun Jul 21, 2013 6:10 pm

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......

Klaus
Posts: 14199
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: Sound Record revSpeak

Post by Klaus » Sun Jul 21, 2013 6:27 pm

Hm, sorry, no idea in the moment...

treefolk
Posts: 16
Joined: Tue May 21, 2013 10:54 pm

Re: Sound Record revSpeak

Post by treefolk » Sun Jul 21, 2013 6:30 pm

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

Klaus
Posts: 14199
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: Sound Record revSpeak

Post by Klaus » Sun Jul 21, 2013 9:27 pm

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

Post Reply