-
Binaural Beats
+ Binaural Beats {{ started ? 'started' : 'stopped' }}
+
+
@@ -19,12 +30,24 @@ export default {
name: 'Main',
data () {
return {
+ started: false,
merge: null,
leftEar: null,
rightEar: null,
waveform: 'sine',
- left: 440,
- right: 430
+ preset: null,
+ presets: {
+ alpha: {
+ waveform: 'sine',
+ right: 150,
+ left: 155
+ },
+ beta: {
+ waveform: 'sine',
+ right: 130,
+ left: 139
+ }
+ }
}
},
created () {
@@ -38,22 +61,26 @@ export default {
this.leftEar.frequency.value = 440
this.rightEar.frequency.value = 430
},
- updateWaveform: function () {
- this.leftEar.type = this.waveform
- this.rightEar.type = this.waveform
- },
start: function () {
this.leftEar.start()
this.rightEar.start()
+ this.started = true
},
stop: function () {
this.leftEar.stop()
this.rightEar.stop()
+ this.started = false
}
},
watch: {
waveform: function () {
- this.updateWaveform()
+ this.leftEar.type = this.waveform
+ this.rightEar.type = this.waveform
+ },
+ preset: function () {
+ this.waveform = this.presets[this.preset].waveform
+ this.leftEar.frequency.value = this.presets[this.preset].left
+ this.rightEar.frequency.value = this.presets[this.preset].right
}
}
}
@@ -61,4 +88,10 @@ export default {