Page 1 of 1

wav-recording and crashs?

Posted: Mon May 30, 2011 6:12 am
by Tomka
Good morning all,

my first problem is about recording sound in windows. Found alot of entries about this in the forum but theyrent uptodate.
The whole program is a little to big so i will post only the important parts for you.

cardscript:

Code: Select all

on preOpenCard
   get QTVersion()                     
   set the filename of player "p1" to ""
   //... other stuff
end preOpenCard
There is a button which starts/stops recording sound:

Code: Select all

global g_sel_groupID
global g_soundarray
global g_name

on mouseUp
   if recording is false then
      set the filename of player "p1" to ""
    // changes the buttonskin to "stop"
      set the icon of me to THE ID of image "Aufnahme_stop_0.png" of stack "Untitled 2"
      set the armedicon of me to THE ID of image "Aufnahme_stop_0.png" of stack "Untitled 2"
      set the hovericon of me to THE ID of image "Aufnahme_stop_1.png" of stack "Untitled 2"
      
      set the recordFormat to "wave"  //fileformat to .wav
      put "Sitzungen/"&g_name&"_"&system date&"_"&ID of me&"_antwort.wav" into wavefile //set Filepath
      put wavefile into g_soundarray[g_sel_groupID]["antwort"]
      if there is a file g_soundarray[g_sel_groupID]["antwort"] then delete file g_soundarray[g_sel_groupID]["antwort"]
    record sound file wavefile 
 else
    stop recording
    set visible of btn "Button_Abspielen" to true
    set visible of btn "Button_Sound_löschen" to true
    
    //Glow an der Figurnamen setzen
    
    set the outerglow["color"] of fld "Field" of g_sel_groupID to "0,255,0"
    set the outerglow["size"] of fld "Field" of g_sel_groupID to 14
    
    //changes the buttonskin to "record"
    set the icon of me to THE ID of image "Aufnahme_0.png" of stack "Untitled 2"
    set the armedicon of me to THE ID of image "Aufnahme_0.png" of stack "Untitled 2"
    set the hovericon of me to THE ID of image "Aufnahme_1.png" of stack "Untitled 2"
  end if
end mouseUp
So far this script seems to work well but sometimes the application crashs when I stop recording. For example, I record a sound, listen to it and start a new record in the same file... when I hit the button again to stop recording it crashs. I checked, in this cases there are empty .wav-files.

Made I some misstakes?

Best
Thomas

Re: wav-recording and crashs?

Posted: Fri Jun 03, 2011 4:50 pm
by Mark
Hi Thomas,

I don't remember seeing those crashes while recording sound. You might try to make sure that no sound is being played when you start a new recording (play stop). Check the result for errors after deleting the file.

Kind regards,

Mark

Re: wav-recording and crashs?

Posted: Fri Jun 03, 2011 11:04 pm
by Tomka
ok, i ll do so.

thanks mark :)