Skip to content

Commit

Permalink
prepate for Tunajs goodness
Browse files Browse the repository at this point in the history
note: I should get rid of bower and set up proper module bundling engine
  • Loading branch information
fuczak committed Dec 1, 2015
1 parent 2157f6c commit 439b6f1
Show file tree
Hide file tree
Showing 7 changed files with 44 additions and 7 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@
/.tmp
/.sass-cache
/bower_components
/app/scripts/libs
4 changes: 4 additions & 0 deletions app/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -79,11 +79,15 @@ <h2 class="logo"><span class="glyphicon glyphicon-scale"></span> RumcaJS <span c
<!-- endbuild -->

<!-- build:js({.tmp,app}) scripts/scripts.js -->
<script src="scripts/libs/tuna.js"></script>
<script src="scripts/app.js"></script>
<script src="scripts/ctx.js"></script>
<script src="scripts/tuna.js"></script>
<script src="scripts/gui.js"></script>
<script src="scripts/keyboard.js"></script>
<script src="scripts/dsp.js"></script>
<script src="scripts/voice.js"></script>
<script src="scripts/effects/delay.js"></script>
<!-- endbuild -->
</body>
</html>
7 changes: 7 additions & 0 deletions app/scripts/ctx.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
'use strict';

angular.module('rumca-js')
.factory('Ctx', function ($window) {
var AudioContext = $window.AudioContext || $window.webkitAudioContext;
return new AudioContext();
});
14 changes: 8 additions & 6 deletions app/scripts/dsp.js
Original file line number Diff line number Diff line change
@@ -1,20 +1,22 @@
'use strict';

angular.module('rumca-js')
.factory('DSP', function ($window, Voice) {

var AudioContext = $window.AudioContext || $window.webkitAudioContext;
var ctx = new AudioContext();
.factory('DSP', function ($window, Voice, Ctx, Tuna, Delay) {

var ctx = Ctx;
var voices = [];
var master = ctx.createGain();
var distortion = ctx.createWaveShaper();
var voiceChain = ctx.createGain();
var delay = Delay;
delay.delayTime = 100;

//Master Effect Chain
//Master volume
// var master = ctx.createGain();
master.connect(ctx.destination);
master.gain.value = 0.05;
master.connect(delay);
delay.connect(ctx.destination);
master.gain.value = 0.15;

//Distortion
//var distortion = ctx.createWaveShaper();
Expand Down
13 changes: 13 additions & 0 deletions app/scripts/effects/delay.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
'use strict';

angular.module('rumca-js')
.factory('Delay', function (Tuna) {
return new Tuna.Delay({
feedback: 0.45, //0 to 1+
delayTime: 800, //how many milliseconds should the wet signal be delayed?
wetLevel: 0.8, //0 to 1+
dryLevel: 1, //0 to 1+
cutoff: 22050, //cutoff frequency of the built in lowpass-filter. 20 to 22050
bypass: 0
});
});
7 changes: 7 additions & 0 deletions app/scripts/tuna.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
'use strict';

angular.module('rumca-js')
.factory('Tuna', function($window, Ctx) {
var Tuna = $window.Tuna;
return new Tuna(Ctx);
});
5 changes: 4 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,5 +36,8 @@
},
"scripts": {
"test": "grunt test"
},
"dependencies": {
"tunajs": "^0.4.2"
}
}
}

0 comments on commit 439b6f1

Please sign in to comment.