add troubadour-play-two.js example
This commit is contained in:
parent
a1fbe95440
commit
7b90bcc09f
32
examples/troubadour-play-two.js
Normal file
32
examples/troubadour-play-two.js
Normal file
|
@ -0,0 +1,32 @@
|
||||||
|
const Troubadour = require('troubadour');
|
||||||
|
const troubadourLoop1 = new Troubadour('mplayer'); //or pass in sox for example
|
||||||
|
const troubadourLoop2 = new Troubadour('mplayer'); //or pass in sox for example
|
||||||
|
|
||||||
|
function loop1(file){
|
||||||
|
troubadourLoop1.on('start', () => {
|
||||||
|
// Do something here when the audio starts playing
|
||||||
|
});
|
||||||
|
|
||||||
|
troubadourLoop1.on('end', () => {
|
||||||
|
// Do something here when the audio finishes playing
|
||||||
|
troubadourLoop1.play(file);
|
||||||
|
});
|
||||||
|
|
||||||
|
troubadourLoop1.play(file);
|
||||||
|
}
|
||||||
|
|
||||||
|
function loop2(file){
|
||||||
|
troubadourLoop2.on('start', () => {
|
||||||
|
// Do something here when the audio starts playing
|
||||||
|
});
|
||||||
|
|
||||||
|
troubadourLoop2.on('end', () => {
|
||||||
|
// Do something here when the audio finishes playing
|
||||||
|
troubadourLoop2.play(file);
|
||||||
|
});
|
||||||
|
|
||||||
|
troubadourLoop2.play(file);
|
||||||
|
}
|
||||||
|
|
||||||
|
loop1('../assets/snd/chew.mp3');
|
||||||
|
loop2('../assets/snd/small-33.mp3');
|
Loading…
Reference in New Issue
Block a user