Random Audio Recording Error on Win32 Player

Visuals, audio, animation. Blended, not stirred. If LiveCode is part of your rich media production toolbox, this is the forum for you.

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
bziegler
Posts: 4
Joined: Mon May 07, 2012 4:04 am

Random Audio Recording Error on Win32 Player

Post by bziegler » Mon May 07, 2012 4:16 am

After years of providing programs for special needs students I was just made aware of my programs failing at random times, making it difficult to debug.
It only happens on Windows machines and not at the same location. The Mac player works fine.
User get an error box- "Revolution Engine for Win32 has encountered a problem and needs to close. We are sorry for the inconvenience."
I am using the REV Player Engine 3.0.0 Build 750 and not a standalone because the same stack need to run on Macs and Pcs.

I am testing it now on a Macbook pro with VMware Fusion.

If a scripter with PC access has time to put this script into a button and try recording, if you have time, I would appreciate feedback on why it fails.
The programs have numerous places for students to record their ideas. I have found the problem occurs whether the script is on multiple buttons or just one.

I have distilled the script down to the basics to eliminate other scripting factors.
All you should need to do is hold the mouse down on the button to record. It should repeat back on mouseUp.
It rarely happens the first time but always randomly within 15 attempts.


on mouseDown
if there is an audioClip "test" then stop playing audioClip "test"
set the recordFormat to "wave"
set the recordSampleSize to 16
set the recordChannels to 1
set the recordRate to 44.1
record sound file "Test"
end mouseDown

on mouseUp
wait 1 second
stop recording
if there is an audioClip "test" then delete audioClip "test"
if there is a file "test" then
import audioClip from file "test"
end if
play audioClip "test"
end mouseUp



Thanks,

Bill

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

Re: Random Audio Recording Error on Win32 Player

Post by Klaus » Mon May 07, 2012 10:20 am

Hi Bill,

I don't have a PC with sound recording capabilities, but here some general thoughts.

1. "record sound" uses QuickTime so make sure this is installed on all target machines
Check "the qtversion" first!

2. You do not specify a directory for the recording, but you need write permission in "the defaultfolder",
whereever this may be currently!
Better use something like e.g. -> specialfolderpath("desktop") & "/test.wav"

3. I takes a little time until everything is initialized "behind the curtains" before the actual recording starts
so maybe doing this on "mousedown" is not a good idea.
Triggering actions "on mousedown" is always a bad idea in my opninion 8)

4. No need to IMPORT the sound!
You can also use the filename with "play", saves some memory!

Try this:

Code: Select all

on mouseDown

  ## no need to check, just stop any eventually playing sound
  play stop ac

  ## We have write permissions here!
  put specialfolderpath("desktop") & "/test.wav" into tSoundFile

  ## Delete old sound? optional :)
  if there is s file tSoundFile then
    delete file tSoundFile
  end if

  set the recordFormat to "wave"
  set the recordSampleSize to 16
  set the recordChannels to 1
  set the recordRate to 44.1
  record sound file tSoundFile

   ## If there is something going wrong we might get a hint WHAT is going wrong:
  if the result <> empty then
     answer "Error:" & CR & the result
     exit to top
  end if
end mouseDown

on mouseUp
   put specialfolderpath("desktop") & "/test.wav" into tSoundFile
   wait 1 second
   stop recording

   if there is a file tSoundFile then
       play ac tSoundFile
   else
       answer "No file!"
  end if
end mouseUp
This is out of my head, but you get the picture :)

Best

Klaus

bziegler
Posts: 4
Joined: Mon May 07, 2012 4:04 am

Re: Random Audio Recording Error on Win32 Player

Post by bziegler » Mon May 07, 2012 2:32 pm

Thanks Klaus

The code does work though. It may work once or even 15 times before the error. My full code does save temporarily to a default folder but it still fails at Stop Recording, even before it gets to the importing the sound file and deleting.

bill

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

Re: Random Audio Recording Error on Win32 Player

Post by Klaus » Mon May 07, 2012 2:46 pm

Hi Bill,

hmm, sorry, no idea.

BUT :D
You could try to use the very old MCI interface to record sound on Windows.
I found a VERY old stack from the MetaCard days and will attach it here.

Maybe NOT using QuickTime will give better results 8)


Best

Klaus
Attachments
mci.rev.zip
(7.44 KiB) Downloaded 369 times

bziegler
Posts: 4
Joined: Mon May 07, 2012 4:04 am

Re: Random Audio Recording Error on Win32 Player

Post by bziegler » Mon May 07, 2012 3:16 pm

Just tried it with your code and it still fails after about 6 recordings. I'll try it on a full pc in case it's the emulator.

Thanks for the try,

Bill

bziegler
Posts: 4
Joined: Mon May 07, 2012 4:04 am

Re: Random Audio Recording Error on Win32 Player

Post by bziegler » Tue May 08, 2012 4:10 am

Thanks Klaus,

I'll Try it.

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

Re: Random Audio Recording Error on Win32 Player

Post by Klaus » Tue May 08, 2012 10:52 am

bziegler wrote:Thanks Klaus,

I'll Try it.
Déjà vue? :D

Post Reply