• <GetStart>
  • CSPro User's Guide
    • The CSPro System
    • Data Dictionary Module
    • The CSPro Language
    • Data Entry Module
    • Batch Editing Applications
    • Tabulation Applications
    • Data Sources
    • CSPro Statements and Functions
      • Statement Format Symbols
      • Alphabetical List of Functions and Statements
      • List of Reserved Words
      • Deprecated Features
      • Declaration Statements
      • Symbol Functions
      • Item Functions
      • Array Object
      • Audio Object
        • Audio Statement
        • Audio.load Function
        • Audio.save Function
        • Audio.play Function
        • Audio.recordInteractive Function
        • Audio.record Function
        • Audio.stop Function
        • Audio.concat Function
        • Audio.length Function
        • Audio.clear Function
      • Barcode and QR Codes
      • Case Object
      • Document Object
      • File Object
      • Freq Object
      • Geometry Object
      • HashMap Object
      • Image Object
      • List Object
      • Map Object
      • Path
      • Pff Object
      • SystemApp Object
      • ValueSet Object
      • Program Control Statements
      • Assignment Statements
      • Data Entry Statements and Functions
      • Batch Edit Statements
      • Numeric Functions
      • String Functions
      • Multiple Occurrence Functions
      • General Functions
      • Date and Time Functions
      • External File Functions
      • Synchronization Functions
    • Templated Reporting System
    • HTML and JavaScript Integration
    • Action Invoker
    • Appendix
  • <CSEntry>
  • <CSBatch>
  • <CSTab>
  • <DataViewer>
  • <TextView>
  • <TblView>
  • <CSFreq>
  • <CSDeploy>
  • <CSPack>
  • <CSDiff>
  • <CSConcat>
  • <Excel2CSPro>
  • <CSExport>
  • <CSIndex>
  • <CSReFmt>
  • <CSSort>
  • <ParadataConcat>
  • <ParadataViewer>
  • <CSCode>
  • <CSDocument>
  • <CSView>
  • <CSWeb>

Audio.record Function

Format
b = audio_name.record(ʃsecondsʅ);
Description
The Audio.record function starts recording audio in the background and stores the recorded audio in an Audio object. The call to record begins audio recording and returns immediately. Recording continues until the Audio.stop function is called. If the optional parameter seconds is specified, recording will stop after the specified number of seconds have elapsed—or Audio.stop—is called, whichever action comes first.
While the audio is recording, CSPro continues to run and the user is able to enter responses and move around the questionnaire as usual. This is useful if you wish to record portions of the interview for audit purposes. If instead you wish to record audio synchronously, for example to record the response to a single question, use the Audio.recordInteractive function instead.
The recorded audio is stored in the Audio object and can be played back using Audio.play or saved to a file using Audio.save. If the Audio object already contains an audio recording, the recorded audio will be appended to the existing recording. To replace the existing recording rather than adding to it, call the Audio.clear function before calling Audio.record.
Recorded audio is stored in m4a format (AAC encoded in an MPEG-4 container). Files should be saved with the extension .m4a so that they will be recognized by media players.
Audio recording is only supported on Android. This function will do nothing on Windows.
Return Value
The function returns a logical value of 1 (true) if the recording is started successfully and 0 (false) otherwise.
Example
PROC GLOBAL

Audio recordingQ1;

PROC Q1

preproc
    recordingQ1.
record();

postproc
    recordingQ1.
stop();
   
string audioFilename = maketext("recording%v.m4a", HOUSEHOLD_ID);
    recordingQ1.
save(audioFilename);
See also: Audio Object, Audio.stop Function, Audio.recordInteractive Function, Audio.clear Function