zya / beet.js

Polyrhythmic Sequencer library for Web Audio API.
http://zya.github.io/beet.js
MIT License
114 stars 17 forks source link

How can I update the tempo in real-time? #6

Closed smoooty closed 7 years ago

smoooty commented 7 years ago

The description for the multiple layer example says that the tempo can be updated in real time. How would I do this?

zya commented 7 years ago

@spenceropope you should be able to just set the tempo on each layer. or you can change the tempo of each instance of beet.

var beet = new Beet({
    context: context,
    tempo: 120
});

var layer = beet.layer(pattern, cb);
beet.add(layer);
beet.start();

// now you can change the tempo of all layers like this
beet.tempo = 150;

// or you can change the tempo of each layer independently like this
layer.tempo = 145;
smoooty commented 7 years ago

Ok, thank you!