I’ve created 3 squares. I want the first square to record and save the recording. Second square to stop the recording. Third square to get the recording and play it back.
I’m able to get a response when I use the app on my computer, but the results aren’t very clear(I don’t have a mic). When I test on my phone I don’t get any response.
How to make this app work?
function startRecording ()
print( “startRec tap” )
recordPath = system.pathForFile( “recordings.wav”, system.DocumentsDirectory )
recording = media.newRecording( recordPath )
recording:startTuner( )
recording:startRecording( )
proof1 = display.newText( “proof1”, 80, 300,nil , 20 )
end
function stopRecording( )
print( “stopRec tap” )
proof2 = display.newText( “proof2”, 280, 300,nil , 20 )
recording:stopRecording( )
recording:stopTuner( )
end
function playRecording ()
print( “Play back recording” )
findRecording = audio.loadSound( “recordings.wav” , system.DocumentsDirectory )
audio.play( findRecording)
proof3 = display.newText( “proof3”, 400, 300,nil , 20 )
end
*UPDATE: I’ve loaded an .wav file with actual sound into the system.DocumentsDirectory. Results: It works in corona simulator(hear sound), but it doesn’t work on my phone (no sound). ***I believe the problem is that my phone can’t access the files in system.DocumentsDirectory.
Following is my code that I’ve edited to test, and sample.wav is audio that has actual sound.
function playRecording ()
print( “Play back recording” )
findRecording = audio.loadSound( “sample.wav” , system.DocumentsDirectory )
audio.play( findRecording)
proof3 = display.newText( “proof3”, 400, 300,nil , 20 )
end
Thank you for your time