carp_audio_package 0.40.0 copy "carp_audio_package: ^0.40.0" to clipboard
carp_audio_package: ^0.40.0 copied to clipboard

PlatformAndroidiOS
outdated

CARP Media Sampling Package. Samples audio, video, image, and noise.

example/lib/example.dart

import 'package:carp_core/carp_core.dart';
import 'package:carp_mobile_sensing/carp_mobile_sensing.dart';
import 'package:carp_audio_package/media.dart';

/// This is a very simple example of how this sampling package is used with
/// CARP Mobile Sensing (CAMS).
/// NOTE, however, that the code below will not run.
/// See the documentation on how to use CAMS: https://github.com/cph-cachet/carp.sensing-flutter/wiki
void main() async {
  // register this sampling package before using its measures
  SamplingPackageRegistry().register(MediaSamplingPackage());

  // Create a study protocol
  StudyProtocol protocol = StudyProtocol(
    ownerId: 'owner@dtu.dk',
    name: 'Audio Sensing Example',
  );

  // define which devices are used for data collection
  // in this case, its only this smartphone
  Smartphone phone = Smartphone();
  protocol.addMasterDevice(phone);

  // Add an automatic task that immediately starts collecting audio and noise.
  protocol.addTriggeredTask(
      ImmediateTrigger(),
      BackgroundTask()
        ..addMeasures(
          [
            Measure(type: MediaSamplingPackage.AUDIO),
            Measure(type: MediaSamplingPackage.NOISE),
          ],
        ),
      phone);
}
1
likes
140
points
428
downloads

Publisher

verified publishercachet.dk

Weekly Downloads

CARP Media Sampling Package. Samples audio, video, image, and noise.

Repository (GitHub)

Documentation

API reference

License

MIT (license)

Dependencies

carp_core, carp_mobile_sensing, carp_serializable, flutter, flutter_sound, json_annotation, noise_meter, permission_handler, stats

More

Packages that depend on carp_audio_package