carp_audio_package 0.6.2+1

  • Readme
  • Changelog
  • Installing
  • 63

CARP Audio Sampling Package #

pub package

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.5.0
  carp_audio_package: ^0.5.0
  ...

Android Integration #

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

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="<your_package_name>"
    xmlns:tools="http://schemas.android.com/tools">

   ...
   
   <!-- The following permissions are used for CARP Mobile Sensing -->
   <uses-permission android:name="android.permission.RECORD_AUDIO"/>
   <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
   <uses-permission android:name="android.permission.PACKAGE_USAGE_STATS" tools:ignore="ProtectedPermissions"/>

</manifest>

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.

0.6.2 #

  • NoiseDatum now w. doubles.

0.6.1 #

  • allignment with carp_mobile_sensing v. 0.6.1.
  • improvement to the audio probe based

0.6.0 #

  • update to carp_mobile_sensing version 0.6.0
  • fixed noise probe.
  • note that the noise and audio probe (still) can't run at the same time.

0.5.0 BREAKING #

  • Breaking change. This version has been migrated from the deprecated Android Support Library to AndroidX. This should not result in any functional changes, but it requires any Android app using this plugin to also migrate if they're using the original support library.
  • Use carp_mobile_sensing version 0.5.0
  • See Flutter AndroidX compatibility

0.3.5 #

  • upgrade to json_serializable v.2
  • fixed bug in audio recording probe (issue #23)

0.3.4 #

  • update to carp_mobile_sensing version 0.3.10

0.3.3 #

  • solved issue #21.

0.3.2 #

  • Update to carp_mobile_sensing v. 0.3.7
  • Using the data types in the package (audio, noise)
  • Update of readme file.

0.3.1 #

  • Documentation

0.3.0 #

  • Initial release compatible with carp_mobile_sensing version 0.3.*

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:


dependencies:
  carp_audio_package: ^0.6.2+1

2. Install it

You can install packages from the command line:

with Flutter:


$ flutter pub get

Alternatively, your editor might support flutter pub get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:


import 'package:carp_audio_package/audio.dart';
import 'package:carp_audio_package/audio.g.dart';
import 'package:carp_audio_package/audio_datum.dart';
import 'package:carp_audio_package/audio_measures.dart';
import 'package:carp_audio_package/audio_package.dart';
import 'package:carp_audio_package/audio_probe.dart';
import 'package:carp_audio_package/noise_probe.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
29
Health:
Code health derived from static analysis. [more]
100
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
90
Overall:
Weighted score of the above. [more]
63
Learn more about scoring.

We analyzed this package on Dec 10, 2019, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.6.1
  • pana: 0.12.21
  • Flutter: 1.9.1+hotfix.6

Health suggestions

Format lib/audio_datum.dart.

Run flutter format to format lib/audio_datum.dart.

Format lib/audio_measures.dart.

Run flutter format to format lib/audio_measures.dart.

Format lib/audio_package.dart.

Run flutter format to format lib/audio_package.dart.

Format lib/audio_probe.dart.

Run flutter format to format lib/audio_probe.dart.

Format lib/noise_probe.dart.

Run flutter format to format lib/noise_probe.dart.

Maintenance suggestions

Maintain an example. (-10 points)

Create a short demo in the example/ directory to show how to use this package.

Common filename patterns include main.dart, example.dart, and carp_audio_package.dart. Packages with multiple examples should provide example/README.md.

For more information see the pub package layout conventions.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.3.0 <3.0.0
carp_mobile_sensing ^0.6.1 0.6.2
flutter 0.0.0
flutter_sound ^1.4.2 1.6.0
json_annotation ^3.0.0 3.0.0
noise_meter ^1.0.1 1.0.1
path_provider ^1.2.0 1.5.0 1.5.1
Transitive dependencies
app_usage 0.1.0
archive 2.0.11
args 1.5.2
async 2.4.0
battery 0.3.1+5 0.3.1+6
charcode 1.1.2
collection 1.14.11 1.14.12
connectivity 0.4.6 0.4.6+1
convert 2.1.1
crypto 2.1.4
device_apps 1.0.8
device_info 0.4.1+3 0.4.1+4
file_utils 0.1.3
fixnum 0.10.11
flutter_blue 0.6.2 0.6.3+1
globbing 0.3.0
light 0.1.1
meta 1.1.7 1.1.8
path 1.6.4
pedometer 1.0.0
permission_handler 4.0.0
platform 2.2.1
protobuf 0.14.4 1.0.1
rxdart 0.22.6 0.23.0-dev.3
screen_state 0.1.1
sensors 0.4.1+3 0.4.1+4
sky_engine 0.0.99
stats 0.2.0+3
system_info 0.1.1
typed_data 1.1.6
uuid 2.0.4
vector_math 2.0.8
Dev dependencies
build_runner any
flutter_test
json_serializable ^3.0.0
test any