Record and Play sound at same time IOS

Stephen MacLean smaclean at madmansoft.com
Sat Apr 26 19:08:44 EDT 2014


Hi Nakia,

You need to create your own UI for the AVPlayer. 

I would also check to see if the file being recorded is being written and growing in realtime on the phone. 

I'll take a closer look into later tonight. 

Best,
Steve

> On Apr 26, 2014, at 6:13 PM, Nakia Brewer <Nakia.Brewer at westrac.com.au> wrote:
> 
> Thanks Steve,
> 
> After I wrote this email I did try to create the mergAV Player to play the file but had no luck (however iPhonePlayOnChannel and the player that iPhoneCreatePlayer create would play it but the original issue still occurs).
> 
> When I try the mergAV Player they player doesn't seem to appear, no sound plays etc but I get no errors returned?
> 
> I have pasted my card scripts below.
> 
> on openCard
>   ## Setup the mergMicrophone External
>   if the environment = "mobile" then
>      mergMicrophoneSetNumberOfChannels "stereo"
>      mergMicrophoneSetSampleRate "44100"
>      mergMicrophoneSetAudioQuality "High"
>   end if
> end openCard
> 
> 
> on startRecording
>   mergMicrophoneStartRecording specialFolderPath("cache") & slash & "Smurf1.caf"
>   send playBackJammerStream to this card in 500 milliseconds
> end startRecording
> 
> on playBackJammerStream
>   try
>      mergAVAudioSessionSetCategory "play and record",false,false,false,true
>      mergAVAudioSessionSetMode "voice chat"
>      mergAVAudioSessionSetActive true
>      put specialFolderPath("cache") & slash & "Smurf1.caf" into tURL
>      put mergAVPlayerCreateFromURL(tURL) into tPointer
>      mergAVPlayerSet tPointer,"rect", the rect of this stack
>      if the result is not empty then answer the result
>      mergAVPlayerSet tPointer,"rate","1"
>      if the result is not empty then answer the result
>      mergAVPlayerSet tPointer,"visible", false
>      if the result is not empty then answer the result
>      mergAVPlayerDo tPointer,"play"
>      if the result is not empty then answer the result
>   catch e
>      answer e
>   end try
> end playBackJammerStream
> ________________________________________
> From: use-livecode [use-livecode-bounces at lists.runrev.com] on behalf of Stephen MacLean [smaclean at madmansoft.com]
> Sent: Sunday, April 27, 2014 1:37 AM
> To: How to use LiveCode
> Subject: Re: Record and Play sound at same time IOS
> 
> I would not use the iPhonePlayOnChannel for playback if you have mergAV.
> 
> Instead, use mergAVPlayer. You have much more control and the mergAVSessionCategory will effect it.
> 
> I use both in an iOS app and they work great together, although I'm not trying to playback until the recording is finished. It does look like what you want to do is possible via both of these though because both use the AV framework from Apple.
> 
> Best,
> 
> Steve
> 
> 
>> On Apr 26, 2014, at 5:34 AM, Nakia Brewer <Nakia.Brewer at westrac.com.au> wrote:
>> 
>> Okay,
>> Had a small tinker and seems the same issue occurs.
>> 
>> To check my understanding, am i to assume the mergAvSessionCategory effects the iphonePlayOnChannel command ?
>> 
>> I think I may be miss interpreting how to achieve this... I am still using mergMicrophone to record the file and using iphonePlayOnChannel to play the file..
>> 
>> 
>> 
>> Sent from my iPhone
>> 
>>> On 26 Apr 2014, at 6:05 pm, "Nakia Brewer" <Nakia.Brewer at westrac.com.au> wrote:
>>> 
>>> Just had a quick look through the commands for mergAV.
>>> 
>>> Wow, it sure has a lot of functionality..
>>> 
>>> Sent from my iPhone
>>> 
>>>> On 26 Apr 2014, at 5:02 pm, "Nakia Brewer" <Nakia.Brewer at westrac.com.au> wrote:
>>>> 
>>>> Okay will take a look.
>>>> 
>>>> Will this allow me to ditch using the mergMicrophone external then ?
>>>> 
>>>> Sent from my iPhone
>>>> 
>>>>> On 26 Apr 2014, at 12:32 pm, "Stephen MacLean" <smaclean at madmansoft.com> wrote:
>>>>> 
>>>>> Look to another of Monte's externals, mergAV.
>>>>> 
>>>>> Specifically, you can set the AVsession to "play and record", which would allow that. The player you can create is also very powerful.
>>>>> 
>>>>> Take a look at the commands for the external, down near the bottom of the page.
>>>>> 
>>>>> Best,
>>>>> 
>>>>> Steve MacLean
>>>>> 
>>>>>> On Apr 25, 2014, at 8:41 PM, Nakia Brewer <Nakia.Brewer at westrac.com.au> wrote:
>>>>>> 
>>>>>> Hi,
>>>>>> 
>>>>>> As a novelty I am trying to make a livecode IOS Speech Jammer App.
>>>>>> 
>>>>>> For those that aren't aware this basically works by playing back you voice slightly delayed and it messes with your brain and you can't speak.
>>>>>> 
>>>>>> Check this guy out for a laugh.
>>>>>> 
>>>>>> http://youtu.be/oU9EGeMP5n4
>>>>>> 
>>>>>> Anyway,
>>>>>> Using montes mergMicrophone I have been able to get mostly there but have hit a stumble with playing back the file that is being recorded at the same time it's being recorded.
>>>>>> 
>>>>>> I am using iphonePlaySoundOnChannel to play back the file but it looks like it only evaluates the file when it starts cashing it to not continue playing..
>>>>>> 
>>>>>> Anyone got any ideas on how to maybe get around this ?
>>>>>> 
>>>>>> 
>>>>>> 
>>>>>> 
>>>>>> 
>>>>>> 
>>>>>> 
>>>>>> 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 at 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 at 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 at 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 at 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 at 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 at 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 at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode





More information about the use-livecode mailing list