Audio


This is the Cylon Driver for Audio reproduction capabilities.

How To Connect

var Cylon = require('cylon');

Cylon.robot({
  connections: {
    audio: { adaptor: 'audio' }
  },

  devices: {
    audio: { driver: 'audio' }
  },
});

How To Use

var Cylon = require('cylon');

Cylon.robot({
  connections: {
    audio: { adaptor: 'audio' }
  },

  devices: {
    audio: { driver: 'audio' }
  },

  work: function(my) {
    my.audio.on("complete", function(){
      console.log("Done playing this nice sound.");
    });

    // You can pass a string with a full or relative path here,
    my.audio.play('./audio_samples/audio-sample.mp3');
  }
}).start();

Commands

play

Plays a sound

Params

  • filename (String) name of file to play

Returns

  • (undefined)

stop

Stops playing sound

Returns

  • (undefined)

pause

Pause playing sound

Returns

  • (undefined)

resume

Resume playing sound

Returns

  • (undefined)

loop

Loop sound

Params

  • filename (String) name of file to loop

Returns

  • (undefined)

Events

stop

Emitted when the driver detects a stop command


pause

Emitted when the driver detects a pause command


resume

Emitted when the driver detects a resume command


complete

Emitted when the driver finishes playing a file

Compatibility