From 9268fd38832535860fa8855c93373233639358fc Mon Sep 17 00:00:00 2001 From: Shri Ganeshram Date: Tue, 31 May 2016 21:59:21 -0700 Subject: [PATCH 1/4] added ability to play ACRN in only left and right channels --- index.html | 4 +++- js/ACRN.js | 15 +++++++++------ 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/index.html b/index.html index 9b9e386..3bae6b9 100644 --- a/index.html +++ b/index.html @@ -107,7 +107,9 @@
- + + +

diff --git a/js/ACRN.js b/js/ACRN.js index 459093f..d8d7966 100644 --- a/js/ACRN.js +++ b/js/ACRN.js @@ -286,11 +286,12 @@ function highlightCurrentFreq() { $("#" + ACRN_FREQ_PREFIX + currentPlayingFreqIndex).addClass("acrnFreqPlaying"); } -function playACRN() { - if (currentState === states.PLAY_TONE) { +function playACRN(pan) { + if (currentState === states.PLAY_TONE || currentState == states.PLAY_ACRN) { stop(); } + if (currentState !== states.PLAY_ACRN) { generateACRNFrequencies(); // start timer @@ -301,9 +302,11 @@ function playACRN() { // High synth - scheduled as a mono synth (i.e. one instance keeps // running and the gate and frequency are switched) this.synth = new TriggerSynth(audiolet, this.currentFreq); + this.pan = new Pan(audiolet, pan); // Connect it to the output so we can hear it - this.synth.connect(audiolet.output); + this.synth.connect(this.pan); + this.pan.connect(audiolet.output); // first set the gate on the ADSR envelope to 1, then alternate to 0 // trigger release @@ -362,9 +365,9 @@ function generateACRNFrequencies() { freqChoices = [Math.floor(currentFreq * 0.773 - 44.5), Math.floor(currentFreq * 0.903 - 21.5), Math.floor(currentFreq * 1.09 + 52), Math.floor(currentFreq * 1.395 + 26.5)]; for (var i = 0; i < numFreqs; i++) { - freqVolumes[i] = defaultFreqVolume; - if (localStorage.getItem(ACRN_FREQ_PREFIX + "vol" + i)) // load in saved volume for frequency-slot, if one exists - freqVolumes[i] = localStorage.getItem(ACRN_FREQ_PREFIX + "vol" + i); + freqVolumes[i] = defaultFreqVolume; + if (localStorage.getItem(ACRN_FREQ_PREFIX + "vol" + i)) // load in saved volume for frequency-slot, if one exists + freqVolumes[i] = localStorage.getItem(ACRN_FREQ_PREFIX + "vol" + i); } if (Modernizr.localstorage) { for (var i = 0; i < numFreqs; i++) { From 9d60151b3b9524f8f3b5cd2159fb1e436d1216d4 Mon Sep 17 00:00:00 2001 From: Shri Ganeshram Date: Tue, 31 May 2016 22:50:07 -0700 Subject: [PATCH 2/4] fix problematic audio signals adding due to incorrect stop function --- js/ACRN.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/js/ACRN.js b/js/ACRN.js index d8d7966..22c8e0e 100644 --- a/js/ACRN.js +++ b/js/ACRN.js @@ -416,7 +416,8 @@ function stop() { audiolet.scheduler.stop(); } // Connect it to the output so we can hear it - this.synth.disconnect(audiolet.output); + this.synth.disconnect(this.pan); + this.pan.disconnect(audiolet.output); currentState = states.STOP; timer.Timer.pause(); } From 104a59bf73339e9ffeeba4e0422bd355d8d05132 Mon Sep 17 00:00:00 2001 From: Shri Ganeshram Date: Tue, 7 Jun 2016 23:48:31 -0700 Subject: [PATCH 3/4] fixed stopping of single frequency --- js/ACRN.js | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/js/ACRN.js b/js/ACRN.js index 22c8e0e..ea7b232 100644 --- a/js/ACRN.js +++ b/js/ACRN.js @@ -416,8 +416,13 @@ function stop() { audiolet.scheduler.stop(); } // Connect it to the output so we can hear it - this.synth.disconnect(this.pan); - this.pan.disconnect(audiolet.output); + if(currentState === states.PLAY_TONE) { + this.synth.disconnect(audiolet.output); + } else { + this.synth.disconnect(this.pan); + this.pan.disconnect(audiolet.output); + } + currentState = states.STOP; timer.Timer.pause(); } From dda70548b31f6264ed7671d569aac76b08d5bc6f Mon Sep 17 00:00:00 2001 From: Peter Andrews Date: Thu, 31 Aug 2017 18:41:37 -0400 Subject: [PATCH 4/4] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 1c0b62a..377142e 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ ACRN = Acoustic Coordinated Reset Neuromodulation ==== This is an implementation of the Acoustic Coordinated Reset Neuromodulation tinnitus treatment protocol in javascript. -I'm currently hosting it on my [website](http://www.generalfuzz.net/acrn/). +You can try it out [here](https://petervermont.github.io/acrn/). Feel free to fix any bugs you find or add features.