Yeah that is cool, I guessed that was what's happening..

Just gotta get the mergAV player to work.. Can't even get your test stack to 
work on my system here...



Sent from my iPhone

> On 27 Apr 2014, at 1:40 pm, "Stephen MacLean" <smacl...@madmansoft.com> wrote:
> 
> Hi Nakia,
> 
> Ok, so here is what I think is happening is this.
> 
> It does seem that the recording is continuing, as you do get the entire 
> thing. Must be the OS not updating the file size in real time.
> 
> I'm thinking the problem lies in that when you issue the LC play command, it 
> reads the file as it stands at that point in time and plays what it read in. 
> So you get your 2 secs worth of audio and that's it.
> 
> To work around that you'd either need to do what I did or using mergAV create 
> a new player on your callback to the playBackJammerStream that will re-read 
> the file and then start the new player playing at the point in time when the 
> other player ended. 
> 
> You just don't have that level of control with the LC play command that you 
> do with the mergAV player.
> 
> Does that make sense? Give it a shot if you want and let me know.
> 
> Best,
> 
> Steve
> 
>> On Apr 26, 2014, at 11:13 PM, Nakia Brewer <nakia.bre...@westrac.com.au> 
>> wrote:
>> 
>> Hey Steve,
>> 
>> Check this stack out, it might explain what I am trying to explain.
>> 
>> https://www.dropbox.com/s/2u1m4c0r0kew5l2/Speech%20Scrambler%20copy.livecode
>> 
>> Press the start recording button and start speaking.. you should hear you 
>> voice in 2000 milliseconds.
>> Keep talking for a further few seconds.. now press stop recording..
>> 
>> Now press the play back entire recording button and you will hear the entire 
>> recording....
>> 
>> 
>> 
>> 
>> ________________________________________
>> From: use-livecode [use-livecode-boun...@lists.runrev.com] on behalf of 
>> Nakia Brewer [nakia.bre...@westrac.com.au]
>> Sent: Sunday, April 27, 2014 12:48 PM
>> To: How to use LiveCode
>> Subject: RE: Record and Play sound at same time IOS
>> 
>> Any chance you could email me that test stack?
>> 
>> 
>> nakia-brewer[at]bigpond[dot]com
>> ________________________________________
>> From: use-livecode [use-livecode-boun...@lists.runrev.com] on behalf of 
>> Nakia Brewer [nakia.bre...@westrac.com.au]
>> Sent: Sunday, April 27, 2014 12:18 PM
>> To: How to use LiveCode
>> Subject: Re: Record and Play sound at same time IOS
>> 
>> Thanks mate,
>> 
>> Will give this a crack!
>> 
>> Btw, how did you come to the assumption the file was not being written to 
>> real time ?
>> 
>> In my testing I could start playing the file whilst I was still recording it 
>> which indicated to me it was being written real time.
>> 
>> Sent from my iPhone
>> 
>>> On 27 Apr 2014, at 12:12 pm, "Stephen MacLean" <smacl...@madmansoft.com> 
>>> wrote:
>>> 
>>> Hi Nakia,
>>> 
>>> Ok, played around some, and found that while the file is created when you 
>>> start to record, it doesn't write any data to it until you stop recording. 
>>> That's not going to work, so I came up with a little something that does. 
>>> It rotates the file that is being recorded and the file that is playing. 
>>> Works pretty good, lol, but there sometimes a slight pop when switching 
>>> files. Your milage may vary!
>>> 
>>> See what you think. It was an interesting exercise!
>>> 
>>> Put 2 buttons on a card. Name one Record and the other Stop
>>> 
>>> Out this into the script of the Record button:
>>> 
>>> global gFileNamePath1,gFileNamePath2,gFileNamePath3
>>> global gRecFileName1,gRecFileName2,gRecFileName3
>>> global gRecPointer1,gRecPointer2,gRecPointer3
>>> global gCurrentFileNum
>>> global gSendJammerID
>>> 
>>> on mouseUp
>>> #Setup mergMicrophone
>>> if the environment is "mobile" then
>>>    mergMicrophoneSetNumberOfChannels "Stereo"
>>>    mergMicrophoneSetSampleRate 44100
>>>    mergMicrophoneSetAudioFormat "MP4-AAC"
>>>    mergMicrophoneSetTargetBitRate 65536
>>>    mergMicrophoneSetAudioQuality "High"
>>> end if
>>> 
>>> # Setup up AV Session
>>> if the environment is "mobile" then
>>>    mergAVAudioSessionSetCategory "play and record",false,false,true,true
>>> end if
>>> 
>>> # Setup file names & current file number
>>> put UUID ("random") into tUUID1
>>> put UUID ("random") into tUUID2
>>> put UUID ("random") into tUUID3
>>> put 1 into gCurrentFileNum
>>> if the environment is "mobile" then
>>>    put specialFolderPath("cache") & slash & tUUID1 & ".m4a" into 
>>> gFileNamePath1
>>>    put specialFolderPath("cache") & slash & tUUID2 & ".m4a" into 
>>> gFileNamePath2
>>>    put specialFolderPath("cache") & slash & tUUID3 & ".m4a" into 
>>> gFileNamePath3
>>>    put tUUID1 & ".m4a" into gRecFileName1
>>>    put tUUID2 & ".m4a" into gRecFileName2
>>>    put tUUID3 & ".m4a" into gRecFileName3
>>>    # Start Recording with file 1
>>>    mergMicrophoneStartRecording gFileNamePath1
>>>    send "playBackJammerStream" to me in 500 millisec
>>>    put the result into gSendJammerID # To cancel sends when stop is pressed
>>> end if
>>> end mouseUp
>>> 
>>> on playBackJammerStream
>>> #stop recording current file, start recording on next, start playing 
>>> current file
>>> switch gCurrentFileNum
>>>    case 1
>>>       mergMicrophoneStopRecording # Stop recording to current file so data 
>>> is written to disk
>>>       mergMicrophoneStartRecording gFileNamePath2 # Start recording to new 
>>> file so you don't lose anything in the stream
>>>       put "file:" & gFileNamePath1 into tGetFile  # Set up file we just 
>>> stopped recording for playback
>>>       put mergAVPlayerCreateFromURL (tGetFile) into gRecPointer1 # Create 
>>> the AV player for that file
>>>       mergAVPlayerDo gRecPointer1,"play" # Start playing file
>>>       put 2 into gCurrentFileNum # Advance counter for next callback
>>>       send "playBackJammerStream" to me in 500 millisec # Call me back to 
>>> do all over again
>>>       put the result into gSendJammerID # To cancel sends when stop is 
>>> pressed
>>>       break
>>>    case 2
>>>       mergMicrophoneStopRecording
>>>       mergMicrophoneStartRecording gFileNamePath3
>>>       put "file:" & gFileNamePath2 into tGetFile
>>>       put mergAVPlayerCreateFromURL (tGetFile) into gRecPointer2
>>>       mergAVPlayerDo gRecPointer2,"play"
>>>       put 3 into gCurrentFileNum
>>>       send "playBackJammerStream" to me in 500 millisec
>>>       put the result into gSendJammerID # To cancel sends when stop is 
>>> pressed
>>>       break
>>>    case 3
>>>       mergMicrophoneStopRecording
>>>       mergMicrophoneStartRecording gFileNamePath1
>>>       put "file:" & gFileNamePath3 into tGetFile
>>>       put mergAVPlayerCreateFromURL (tGetFile) into gRecPointer3
>>>       mergAVPlayerDo gRecPointer3,"play"
>>>       put 1 into gCurrentFileNum
>>>       send "playBackJammerStream" to me in 500 millisec
>>>       put the result into gSendJammerID # To cancel sends when stop is 
>>> pressed
>>>       break
>>> end switch
>>> end playBackJammerStream
>>> 
>>> and put this into the Stop button:
>>> 
>>> global gSendJammerID
>>> 
>>> on mouseUp
>>> # Stop recording and cancel the send timer
>>> if the environment is "mobile" then
>>>    mergMicrophoneStopRecording
>>>    cancel gSendJammerID
>>> end if
>>> end mouseUp
>>> 
>>> Best,
>>> 
>>> Steve
>>> 
>>>> On Apr 26, 2014, at 7:29 PM, Nakia Brewer <nakia.bre...@westrac.com.au> 
>>>> wrote:
>>>> 
>>>> Ah righto, that might explain why I cant get it to work.
>>>> 
>>>> I am pretty sure the file is being written real time from mergMicrophone 
>>>> as I can play the file using the other methods and it plays up to its 
>>>> current location when I called the play command (I am calling the play 
>>>> whilst I am still recording)..
>>>> 
>>>> It seems like LiveCode only evaluates the file on the initial play command 
>>>> and doesn't re evaluate the file whilst it playing hence only playing up 
>>>> to the duration that existed on the initial play command call...
>>>> 
>>>> As I am only playing audio do I need to even have a UI for the player? I 
>>>> have tried setting the visible of the player to false but still nothing 
>>>> played.
>>>> 
>>>> Thanks for taking a look at it, I appreciate it!
>>> 
>>> 
>>> 
>>> _______________________________________________
>>> use-livecode mailing list
>>> use-livecode@lists.runrev.com
>>> Please visit this url to subscribe, unsubscribe and manage your 
>>> subscription preferences:
>>> http://lists.runrev.com/mailman/listinfo/use-livecode
>> 
>> COPYRIGHT / DISCLAIMER: This message and/or including attached files may 
>> contain confidential proprietary or privileged information. If you are not 
>> the intended recipient, you are strictly prohibited from using, reproducing, 
>> disclosing or distributing the information contained in this email without 
>> authorisation from WesTrac. If you have received this message in error 
>> please contact WesTrac on +61 8 9377 9444. We do not accept liability in 
>> connection with computer virus, data corruption, delay, interruption, 
>> unauthorised access or unauthorised amendment. We reserve the right to 
>> monitor all e-mail communications.
>> 
>> 
>> 
>> _______________________________________________
>> use-livecode mailing list
>> use-livecode@lists.runrev.com
>> Please visit this url to subscribe, unsubscribe and manage your subscription 
>> preferences:
>> http://lists.runrev.com/mailman/listinfo/use-livecode
>> 
>> 
>> COPYRIGHT / DISCLAIMER: This message and/or including attached files may 
>> contain confidential proprietary or privileged information. If you are not 
>> the intended recipient, you are strictly prohibited from using, reproducing, 
>> disclosing or distributing the information contained in this email without 
>> authorisation from WesTrac. If you have received this message in error 
>> please contact WesTrac on +61 8 9377 9444. We do not accept liability in 
>> connection with computer virus, data corruption, delay, interruption, 
>> unauthorised access or unauthorised amendment. We reserve the right to 
>> monitor all e-mail communications.
>> 
>> 
>> 
>> _______________________________________________
>> use-livecode mailing list
>> use-livecode@lists.runrev.com
>> Please visit this url to subscribe, unsubscribe and manage your subscription 
>> preferences:
>> http://lists.runrev.com/mailman/listinfo/use-livecode
>> 
>> 
>> COPYRIGHT / DISCLAIMER: This message and/or including attached files may 
>> contain confidential proprietary or privileged information. If you are not 
>> the intended recipient, you are strictly prohibited from using, reproducing, 
>> disclosing or distributing the information contained in this email without 
>> authorisation from WesTrac. If you have received this message in error 
>> please contact WesTrac on +61 8 9377 9444. We do not accept liability in 
>> connection with computer virus, data corruption, delay, interruption, 
>> unauthorised access or unauthorised amendment. We reserve the right to 
>> monitor all e-mail communications.
>> 
>> 
>> 
>> _______________________________________________
>> use-livecode mailing list
>> use-livecode@lists.runrev.com
>> Please visit this url to subscribe, unsubscribe and manage your subscription 
>> preferences:
>> http://lists.runrev.com/mailman/listinfo/use-livecode
> 
> 
> 
> _______________________________________________
> use-livecode mailing list
> use-livecode@lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription 
> preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
> 

COPYRIGHT / DISCLAIMER: This message and/or including attached files may 
contain confidential proprietary or privileged information. If you are not the 
intended recipient, you are strictly prohibited from using, reproducing, 
disclosing or distributing the information contained in this email without 
authorisation from WesTrac. If you have received this message in error please 
contact WesTrac on +61 8 9377 9444. We do not accept liability in connection 
with computer virus, data corruption, delay, interruption, unauthorised access 
or unauthorised amendment. We reserve the right to monitor all e-mail 
communications.



_______________________________________________
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode

Reply via email to