carp_audio_package 0.9.3

Flutter Android iOS

CARP Audio Sampling Package. Samples audio recording and noise.

CARP Audio Sampling Package #

pub package github stars MIT License

This library contains a sampling package for audio to work with the carp_mobile_sensing package. This packages supports sampling of the following Measure types:

  • audio
  • noise

See the wiki for further documentation, particularly on available measure types and sampling schemas.

For Flutter plugins for other CARP products, see CARP Mobile Sensing in Flutter.

If you're interested in writing you own sampling packages for CARP, see the description on how to extend CARP on the wiki.

Installing #

To use this package, add the following to you pubspc.yaml file. Note that this package only works together with carp_mobile_sensing.

dependencies:
  flutter:
    sdk: flutter
  carp_mobile_sensing: ^0.9.0
  carp_audio_package: ^0.9.0
  ...

Android Integration #

Add the following to your app's manifest.xml file located in android/app/src/main:

 <uses-permission android:name="android.permission.RECORD_AUDIO"/>

NOTE: Version 0.5.0 is migrated to AndroidX. This shouldn't result in any functional changes, but it requires any Android apps using this plugin to also migrate if they're using the original support library. See Flutter AndroidX compatibility

iOS Integration #

Add this permission in the Info.plist file located in ios/Runner:

<key>NSMicrophoneUsageDescription</key>
<string>Uses the microphone to record ambient noise in the phone's environment.</string>
<key>UIBackgroundModes</key>
  <array>
  <string>audio</string>
  <string>external-accessory</string>
  <string>fetch</string>
</array>

Using it #

To use this package, import it into your app together with the carp_mobile_sensing package:

import 'package:carp_mobile_sensing/carp_mobile_sensing.dart';
import 'package:carp_audio_package/context.dart';

Before creating a study and running it, register this package in the SamplingPackageRegistry.

  SamplingPackageRegistry().register(AudioSamplingPackage());

NOTE: The audio and noise probe / measure cannot run at the same time, since they both make exclusive use of the microphone.