diff --git a/README.md b/README.md index f60177e..1da2c19 100644 --- a/README.md +++ b/README.md @@ -4,21 +4,16 @@ Music awesomeness for hue lights. # TODO ## FEATURES -- finish beat detection light effects - save beat detection settings per song -- change light colors - app intro with intro.js - music visualizations with three.js +- listen through mic or integrate with spotify/soundcloud/youtube ## BUGS - can't create groups anymore - BUGS BUGS BUGS ## POSSIBLE FEATURES -- clear localstorage - help, contact, about, youtube video ??? - beat settings by interval -- integration with youtube, soundcloud, spotify ??? - auto beat detection mode -- lights on/off switch - diff --git a/app/components/controls/music-control.js b/app/components/controls/music-control.js index c4fac48..309bb2e 100644 --- a/app/components/controls/music-control.js +++ b/app/components/controls/music-control.js @@ -15,16 +15,9 @@ export default Em.Component.extend(musicControlMixin, visualizerMixin, { actions: { slideTogglePlayerBottom: function(){ - var playerBottomDisplayed = this.get('playerBottomDisplayed'); - this.changePlayerControl('playerBottomDisplayed', !playerBottomDisplayed); - - if(!playerBottomDisplayed){ - Em.$('#playerBottom').slideDown(); - } else { - Em.$('#playerBottom').slideUp(); - } + this.changePlayerControl('playerBottomDisplayed', !this.get('playerBottomDisplayed')); }, - saveSongPreference: function() { + saveSongSettings: function() { }, goToSong: function(index){ var dancer = this.get('dancer'), audio = new Audio(); @@ -155,7 +148,9 @@ export default Em.Component.extend(musicControlMixin, visualizerMixin, { transitionTimeChanged: function(value) { this.changePlayerControl('transitionTime', value); }, - playerBottomDisplayedChanged: function(value) {}, + playerBottomDisplayedChanged: function(value) { + this.changePlayerControl('playerBottomDisplayed', value); + }, decayChanged: function(value){ this.changePlayerControl('decay', value, true); }, @@ -174,6 +169,9 @@ export default Em.Component.extend(musicControlMixin, visualizerMixin, { sequentialTransitionChanged: function(value){ this.set('sequentialTransition', value); }, + onBeatBriOnlyChanged: function(value){ + this.set('onBeatBriOnly', value); + }, clickSpeaker: function(){ this.simulateKick(1); }, @@ -266,11 +264,18 @@ export default Em.Component.extend(musicControlMixin, visualizerMixin, { simulateKick: function(mag) { var activeLights = this.get('activeLights'), transitionTime = this.get('transitionTime') * 10, - transitionBriOffFactor = 5, + onBeatBriOnly = this.get('onBeatBriOnly'), self = this, - brightnessChange = function (light, brightness) { + color = null, + stimulateLight = function (light, brightness, hue) { + var options = {'bri': brightness, 'transitiontime': transitionTime}; + + if(!Em.isNone(hue)) { + options.hue = hue; + } + Em.$.ajax(self.get('apiURL') + '/lights/' + light + '/state', { - data: JSON.stringify({'bri': brightness, 'transitiontime': transitionTime}), + data: JSON.stringify(options), contentType: 'application/json', type: 'PUT' }); @@ -288,8 +293,12 @@ export default Em.Component.extend(musicControlMixin, visualizerMixin, { light = Math.floor(Math.random() * activeLights.length) + 1; } - brightnessChange(light, 254); - setTimeout(brightnessChange, transitionTime + 50, light, 1); + if(!onBeatBriOnly) { + color = Math.floor(Math.random() * 65535); + } + + stimulateLight(light, 254, color); + setTimeout(stimulateLight, transitionTime + 50, light, 1); this.set('paused', true); @@ -306,6 +315,7 @@ export default Em.Component.extend(musicControlMixin, visualizerMixin, { var beatHistory = self.get('beatHistory'), maxSize = self.get('maxBeatHistorySize'); beatHistory.unshiftObjects('Beat intesity of ' + mag.toFixed(3) + ' at ' + self.get('timeElapsedTxt') + ''); + if(beatHistory.length > maxSize){ beatHistory.popObject(); } @@ -342,7 +352,7 @@ export default Em.Component.extend(musicControlMixin, visualizerMixin, { kick: kick }); - ['volume', 'shuffle', 'repeat', 'volumeMuted', 'threshold', 'decay', 'frequency', 'speakerViewed', 'transitionTime', 'sequentialTransition', 'playerBottomDisplayed'].forEach(function (item) { + ['volume', 'shuffle', 'repeat', 'volumeMuted', 'threshold', 'decay', 'frequency', 'speakerViewed', 'transitionTime', 'sequentialTransition', 'playerBottomDisplayed', 'onBeatBriOnly'].forEach(function (item) { if (localStorage.getItem('huegasm.' + item)) { var itemVal = localStorage.getItem('huegasm.' + item); if (item === 'repeat' || item === 'volume' || item === 'decay' || item === 'threshold' || item === 'transitionTime') { @@ -371,10 +381,6 @@ export default Em.Component.extend(musicControlMixin, visualizerMixin, { event.preventDefault(); }); - if(!this.get('playerBottomDisplayed')){ - Em.$('#playerBottom').hide(); - } - // control the volume by scrolling up/down Em.$('#playerArea').on('mousewheel', function(event) { if(self.get('playQueueNotEmpty')) { diff --git a/app/components/mixins/music-control.js b/app/components/mixins/music-control.js index 6b882d4..c5bf3ed 100644 --- a/app/components/mixins/music-control.js +++ b/app/components/mixins/music-control.js @@ -121,12 +121,21 @@ export default Em.Mixin.create({ sequentialTransition: true, sequentialTransitionLabel: function() { if(this.get('sequentialTransition')){ - return 'Sequential'; + return 'Sequential Transition'; } else { - return 'Random'; + return 'Random Transition'; } }.property('sequentialTransition'), + onBeatBriOnly: true, + onBeatBriOnlyLabel: function() { + if(this.get('onBeatBriOnly')){ + return 'Brightness'; + } else { + return 'Brightness & Color'; + } + }.property('onBeatBriOnly'), + changePlayerControl: function(name, value, isOption){ if(isOption){ var options = {}; @@ -203,9 +212,9 @@ export default Em.Mixin.create({ this.get('beatHistory').clear(); }.observes('speakerViewed'), - onSequentialTransitionChange: function(){ - localStorage.setItem('huegasm.sequentialTransition', this.get('sequentialTransition')); - }.observes('sequentialTransition'), + onOptionChange: function(self, option){ + localStorage.setItem('huegasm.' + option, this.get(option)); + }.observes('sequentialTransition', 'onBeatBriOnly'), onRepeatChange: function () { var tooltipTxt = 'Repeat all', type = 'repeat'; @@ -282,7 +291,7 @@ export default Em.Mixin.create({ }, beatDetectionArrowIcon: function(){ - if(this.get('playerBottomDisplayed')){ + if(!this.get('playerBottomDisplayed')){ return 'arrow-drop-down'; } else { return 'arrow-drop-up'; diff --git a/app/styles/app.scss b/app/styles/app.scss index 8d116c4..6e969e5 100644 --- a/app/styles/app.scss +++ b/app/styles/app.scss @@ -8,6 +8,7 @@ $playerHeight: 400px; $playListBackgroundColor: #1E1E1E; $playerDefaultIconColor: #BBBBBB; $footerHeight: 40px; +$playerBottomBackground: #5D5D5D; // BRIDGE FINDER html { @@ -17,7 +18,7 @@ html { body { font-family: 'Slabo 27px', serif; - margin-bottom: $footerHeight; + margin-bottom: $footerHeight + 20px; position: static; } @@ -398,10 +399,9 @@ md-toolbar { } #slideToggle { - position: absolute; - z-index: 100; - left: 45%; color: white; + background-color: $playerBottomBackground; + padding: 5px; } md-switch.md-default-theme.md-checked .md-bar { @@ -662,18 +662,23 @@ md-switch.md-default-theme.md-checked .md-thumb { margin-bottom: 15px; } -#beatOptionGroup { - .beatOption { - text-align: center; - .optionDescription { - font-size: 13px; - } +#beatOptionButtonGroup { + margin: 20px 0; +} + +.beatOption { + text-align: center; + md-switch { + margin: 0; + } + .optionDescription { + font-size: 13px; } } #playerBottom { color: white; - background-color: #5D5D5D; + background-color: $playerBottomBackground; width: 100%; } @@ -748,10 +753,10 @@ md-switch.md-default-theme.md-checked .md-thumb { #beatHistory { color: black; - height: 250px; + height: 300px; background-color: white; border-radius: 10px; - width: 80%; + width: 90%; margin: 20px auto; overflow: auto; padding: 10px; diff --git a/app/templates/components/controls/music-control.hbs b/app/templates/components/controls/music-control.hbs index bba5a42..ca18ac4 100644 --- a/app/templates/components/controls/music-control.hbs +++ b/app/templates/components/controls/music-control.hbs @@ -1,21 +1,26 @@
-
+
-
-
- {{range-slider start=seekPosition min=0 max=100 id="seekSlider" slide="seekChanged"}} +
+
+ {{range-slider start=seekPosition min=0 max=100 id="seekSlider" slide="seekChanged"}} - {{#if playQueueMultiple}} - {{paper-icon icon="skip-previous" class="playerControllIcon"}}{{/if}}{{paper-icon icon=playingIcon class="playerControllIcon"}}{{paper-icon icon=playingIcon class="playerControllIcon"}}{{#if playQueueMultiple}}{{paper-icon icon="skip-next" action="" class="playerControllIcon"}}{{paper-icon icon="skip-next" action="" class="playerControllIcon"}}{{/if}}{{paper-icon icon=volumeClass class="playerControllIcon volumeButton"}}{{paper-icon icon=volumeClass class="playerControllIcon volumeButton"}}{{range-slider start=volume min=0 max=100 slide="volumeChanged" id="volumeBar"}} -
{{timeElapsedTxt}} / {{timeTotalTxt}}
+
{{timeElapsedTxt}} / {{timeTotalTxt}}
{{paper-icon icon="fullscreen" class="playerControllIcon"}} -
+
-
- +
+ -
+
{{paper-icon icon="shuffle" class=shuffleClass}} @@ -40,88 +45,103 @@ {{paper-icon icon="add" class="playerControllIcon" }} -
- -
- {{#if (or playQueueEmpty dragging)}} -
- {{#if dragging}} - Drag your music files here - {{else}} - Add your music files here - {{/if}} -
- {{paper-icon icon="library-music"}} - {{/if}} - - {{#each playQueue as |item index|}} -
- {{#if item.title}} - {{item.title}} -
{{item.artist}}
- {{else}} - {{item.filename}} - {{/if}} -
{{paper-icon icon="close"}}
- {{/each}} -
-
-
- -
- {{paper-icon icon=beatDetectionArrowIcon}} Beat Detection Settings {{paper-icon icon=beatDetectionArrowIcon}} -
- -
-
- - -
- Light Selection {{#paper-switch checked=sequentialTransition}} {{sequentialTransitionLabel}} {{/paper-switch}}
-
-
-
{{threshold}}
- {{range-slider start=threshold orientation="vertical" step=beatOptions.threshold.step range=beatOptions.threshold.range slide="thresholdChanged" pips=beatOptions.threshold.pips}} - Max. Intensity -
+
+ {{#if (or playQueueEmpty dragging)}} +
+ {{#if dragging}} + Drag your music files here + {{else}} + Add your music files here + {{/if}} +
+ {{paper-icon icon="library-music"}} + {{/if}} -
-
{{decay}} sec
- {{range-slider start=decay orientation="vertical" step=beatOptions.decay.step range=beatOptions.decay.range slide="decayChanged" pips=beatOptions.decay.pips}} - Decay Rate -
+ {{#each playQueue as |item index|}} +
+ {{#if item.title}} + {{item.title}} +
{{item.artist}}
+ {{else}} + {{item.filename}} + {{/if}} +
{{paper-icon icon="close"}}
+
+ {{/each}} +
+
+
-
-
[{{#each frequency as |item index|}}{{item}}{{#unless index}} ,{{/unless}}{{/each}}]
- {{range-slider start=frequency orientation="vertical" step=beatOptions.frequency.step range=beatOptions.frequency.range connect=true slide="frequencyChanged" pips=beatOptions.frequency.pips}} - Frequency Range -
+
+
+ {{paper-icon icon=beatDetectionArrowIcon}} Beat Detection Settings {{paper-icon icon=beatDetectionArrowIcon}} +
+
-
-
{{transitionTime}} sec
+{{#if playerBottomDisplayed}} +
+
+ + +
+
+
{{threshold}}
+ {{range-slider start=threshold orientation="vertical" step=beatOptions.threshold.step range=beatOptions.threshold.range slide="thresholdChanged" pips=beatOptions.threshold.pips}} + Max. Intensity +
+ +
+
{{decay}}
+ {{range-slider start=decay orientation="vertical" step=beatOptions.decay.step range=beatOptions.decay.range slide="decayChanged" pips=beatOptions.decay.pips}} + Decay Rate +
+ +
+
[{{#each frequency as |item index|}}{{item}}{{#unless index}} ,{{/unless}}{{/each}} + ] +
+ {{range-slider start=frequency orientation="vertical" step=beatOptions.frequency.step range=beatOptions.frequency.range connect=true slide="frequencyChanged" pips=beatOptions.frequency.pips}} + Frequency Range +
+ +
+
{{transitionTime}} sec
{{range-slider start=transitionTime orientation="vertical" step=beatOptions.transitionTime.step range=beatOptions.transitionTime.range slide="transitionTimeChanged" pips=beatOptions.transitionTime.pips}} - Transition Time + Transition Time +
+
+ +
+
+ {{#paper-switch checked=sequentialTransition disabled=trial}}{{sequentialTransitionLabel}}{{/paper-switch}} +
+
+ {{#paper-switch checked=onBeatBriOnly disabled=trial}} {{onBeatBriOnlyLabel}}{{/paper-switch}} +
-
{{#paper-button raised=true warn=true action="defaultControls"}}Default{{/paper-button}} - {{#paper-button raised=true action="saveSongPreference"}}Save Song Preference{{/paper-button}} + {{#paper-button raised=true action="saveSongSettings"}}Save Song Settings{{/paper-button}}
{{#if speakerViewed}}
- -
- -
+ + +
+ +
{{else}} -
+
{{#each beatHistory as |item|}}

{{{item}}}

{{/each}} @@ -130,4 +150,5 @@ {{#paper-switch checked=speakerViewed}} {{speakerLabel}} {{/paper-switch}}
-
\ No newline at end of file +
+{{/if}} \ No newline at end of file diff --git a/app/templates/components/huegasm-footer.hbs b/app/templates/components/huegasm-footer.hbs index c9a97f9..d19f512 100644 --- a/app/templates/components/huegasm-footer.hbs +++ b/app/templates/components/huegasm-footer.hbs @@ -1 +1 @@ -

Made with ¯\_(ツ)_/¯ by egorphilippov.me © 2015 Huegasm

\ No newline at end of file +

Made by egorphilippov.me © 2015 Huegasm

\ No newline at end of file