Clone wiki

mergMicrophone / Home

mergMicrophone

mergMicrophone is a basic wrapper around the iOS AVAudioRecorder class, enabling audio recording to be performed in iOS applications. It is a modified version of rremicrophone which is provided as part of the LiveCode SDK. The rremicrophone license requires modified source versions to be distributed without the rre handler prefix or com_runrev class prefix. The changes ar licensed under the extremely permissive Boost Software License http://www.boost.org/LICENSE_1_0.txt

mergMicrophone requires a minimum deployment target of iOS 4.1 + and one of the following iOS SDKs installed on your development machine: 5.0, 5.1, 6.0.

Installation

To install this external open the Standalone Settings for your app and go to the Copy Files pane. For LiveCode 5.5.2+ choose the mergMicrophone.lcext from the distribution archive. For earlier versions of LiveCode select the appropriate folder inside the Pre-LiveCode-5.5.2 folder for the version of the iOS SDK you have installed. Xcode 4.2 = iOS 5.0, Xcode 4.3-4 = iOS 5.1. Xcode 4.5 is not supported by versions of LiveCode prior to 5.5.3. Any feature marked with a minimum iOS version must be comipled against that SDK or higher even if the app is run on a higher version of iOS. If there is a resources folder then these files and folders must be selected individually so that they end up at the root of the app directory. Any files or folders inside the demo folder are required for the demo to run correctly.

Documentation

function mergMicrophoneIsAvailable

This handler returns true if there is a microphone available to use.

Returns boolean

command mergMicrophoneSetNumberOfChannels channelCount

Set the number of channels to record (either mono - 1 channel, or stereo - 2 channels). Setting the number of channels only has effect the next time recording is started.

Parameters:

channelCount - Mono Stereo - This enum is used by 'SetAudioQuality' - it maps to AVAudioQuality internally. function mergMicrophoneGetNumberOfChannels

Get the number of channels to record (either mono - 1 channel, or stereo - 2 channels).

Returns number-of-channels-enum

command mergMicrophoneSetSampleRate sampleRate

Set the sample rate measure in hertz (number of samples to take per second - 44100 is CD quality). Setting the sample rate only has effect the next time recording is started.

Parameters:

sampleRate - function mergMicrophoneGetSampleRate

Get the sample rate measure in hertz (number of samples to take per second - 44100 is CD quality).

Returns real

command mergMicrophoneSetAudioFormat formatName

Set the audio format to output. Setting the audio format only has effect the next time recording is started.

Parameters:

formatName - Linear PCM Apple Lossless MP4-AAC MP3 iLBC function mergMicrophoneGetAudioFormat

Get the audio format to output.

Returns audio-format-enum

command mergMicrophoneSetTargetBitRate bitRate

Set the target bit rate to use formats that have such a notion specified in combined (all changes) bits per second. Setting the target bit rate only has effect the next time recording is started.

Parameters:

bitRate - function mergMicrophoneGetTargetBitRate

Get the target bit rate to use formats that have such a notion specified in combined (all changes) bits per second.

Returns integer

command mergMicrophoneSetAudioQuality audioQuality

Set the audio quality level to use when encoding. Setting the audio quality only has effect the next time recording is started.

Parameters:

audioQuality - Min Low Medium High Max - This enum is used by 'SetAudioFormat' function mergMicrophoneGetAudioQuality

Get the audio quality level to use when encoding.

Returns audio-quality-enum

command mergMicrophoneStartRecording filename

This handler starts recording audio using any previously configured settings to the given output file. If audio recording has already been started, then 'already recording' is returned in the result. If recording could not be started, then 'recording failed' is returned in the result. If recording is successfully started, the result is empty.

Sets the result to recording-status-enum

command mergMicrophoneStopRecording

This handler stop any cumergnt recording operation. If audio recording is not cumergntly in progress, then 'not recording' is returned in the result. If finishing record failed, then 'recording failed' is returned in the result. If recording successfully finished, the result is empty.

Sets the result to recording-status-enum

function mergMicrophoneIsRecording

This handler returns true if recording is cumergntly in progress and false if it is not.

Returns boolean

function mergMicrophoneAveragePower [pChannel]

Return the average power reading in decibels.

Parameters:

pChannel - (optional with 0 default) The channel who's power you need to return. In most cases the default channel of 0 will be what you want (iPhones only record in mono unless they have a mic accessory. Returns The average power reading in decibels. Usually between -160 (min) and 0 (max) but may be positive in some circumstances.

function mergMicrophonePeakPower [pChannel]

Return the peak power reading in decibels.

Parameters:

pChannel - (optional with 0 default) The channel who's power you need to return. In most cases the default channel of 0 will be what you want (iPhones only record in mono unless they have a mic accessory. Returns The peak power reading in decibels. Usually between -160 (min) and 0 (max) but may be positive in some circumstances.

Updated