mirror of
https://github.com/Tonejs/Tone.js
synced 2025-01-15 13:23:58 +00:00
adding stepSequencer example (cleanup)
This commit is contained in:
parent
d6bfa2cd1b
commit
55f35daee6
1 changed files with 4 additions and 4 deletions
|
@ -8,7 +8,7 @@
|
||||||
|
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<div>Checkbox Step Sequencer. 1 bar loop. Each box is a 16th note.</div>
|
<div>One Measure Step Sequencer. Each box is a 16th note, so the 5th checkbox = 0:1:0</div>
|
||||||
<br>
|
<br>
|
||||||
<button>start</button>
|
<button>start</button>
|
||||||
<div id="transportTime">0:0:0</div>
|
<div id="transportTime">0:0:0</div>
|
||||||
|
@ -21,7 +21,7 @@
|
||||||
Tone.Transport.loop = true;
|
Tone.Transport.loop = true;
|
||||||
Tone.Transport.setLoopStart("0:0");
|
Tone.Transport.setLoopStart("0:0");
|
||||||
Tone.Transport.setLoopEnd("1:0");
|
Tone.Transport.setLoopEnd("1:0");
|
||||||
Tone.Transport.setBpm(100);
|
Tone.Transport.setBpm(20);
|
||||||
|
|
||||||
var player = new Tone.Player("./audio/505/snare.mp3", function(){
|
var player = new Tone.Player("./audio/505/snare.mp3", function(){
|
||||||
$("#loading").remove();
|
$("#loading").remove();
|
||||||
|
@ -45,7 +45,7 @@
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// Create 16 checkboxes with values 0-15.
|
// Create 16 checkboxes with values 0-16.
|
||||||
for (i = 0; i<16; i++) {
|
for (i = 0; i<16; i++) {
|
||||||
$("#checkboxes").append('<input type="checkbox" timelineEvent="" value="'+i+'" >');
|
$("#checkboxes").append('<input type="checkbox" timelineEvent="" value="'+i+'" >');
|
||||||
}
|
}
|
||||||
|
@ -54,7 +54,7 @@
|
||||||
$('[type="checkbox"]').change(function() {
|
$('[type="checkbox"]').change(function() {
|
||||||
if (this.checked) {
|
if (this.checked) {
|
||||||
|
|
||||||
// Convert this checkbox value into a 16th note in transport time. "5" = "0:1:1".
|
// Convert this checkbox value into a 16th note in transport time.
|
||||||
var tSig = Tone.Transport.getTimeSignature();
|
var tSig = Tone.Transport.getTimeSignature();
|
||||||
var tTime = "0:"+Math.floor(this.value/ tSig)+":"+this.value % tSig;
|
var tTime = "0:"+Math.floor(this.value/ tSig)+":"+this.value % tSig;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue