-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
43 lines (38 loc) · 1.93 KB
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
import React from 'react';
import ReactDOM from 'react-dom';
import './index.css';
import App from './App';
import registerServiceWorker from './registerServiceWorker';
import Tone from 'tone';
var synth = new Tone.Synth().toMaster();
var currentTime;
//what works:
// //first set of tones (play until a little after 1m):
// Tone.Transport.scheduleRepeat( function(time){
// console.log("in first set of tones. time argument in callBack is "+time);
// console.log("time argument in barsBeatsSixteenths is"+Tone.Time(time).toBarsBeatsSixteenths());
// synth.triggerAttackRelease('c3','8n');
// },"4n",0.1,"1m");
// //second set of tones that should be played after the first set of tones(after 1m):
// Tone.Transport.scheduleRepeat( function(time){
// console.log("in second set of tones. time argument in callBack is " +time);
// console.log("time argument in barsBeatsSixteenths is"+Tone.Time(time).toBarsBeatsSixteenths());
// synth.triggerAttackRelease('e3','4n');
// },"2n","1m","1m");
//first set of tones (play until a little after 1m):
Tone.Transport.scheduleRepeat( function(time){
console.log("in first set of tones. time argument in callBack is "+time);
console.log("time argument in barsBeatsSixteenths is"+Tone.Time(time).toBarsBeatsSixteenths());
synth.triggerAttackRelease('c3','8n');
currentTime = Tone.Time(Tone.Transport.position);
},"4n",0.1,"1m");
//second set of tones that should be played after the first set of tones(after 1m):
Tone.Transport.scheduleRepeat( function(time){
console.log("in second set of tones. time argument in callBack is " +time);
console.log("time argument in barsBeatsSixteenths is"+Tone.Time(time).toBarsBeatsSixteenths());
synth.triggerAttackRelease('e3','4n');
},"2n",currentTime,"1m");
//start the transport
Tone.Transport.start();
ReactDOM.render(<App />, document.getElementById('root'));
registerServiceWorker();