News for hackers. Stuff that matters.
Re:Show HN: Make your web page dance with Rythm.js by gorg75 on Thursday September 07, 2017 @02:51AM (#15189631)
First I thought the script just made things bounce at intervals, but then I noticed the different boxes for base, mid and high range sounds actually follow the changes in the music. How do they do this? - I guess I should read the source code :)
Re:Show HN: Make your web page dance with Rythm.js by mhasbini on Thursday September 07, 2017 @03:27AM (#15189754)
It uses AnalyserNode[0] to get frequency data and moves the elements based on the frequency ratio[1][2].

[0] https://developer.mozilla.org/en-US/docs/Web/API/AnalyserNod...

[1] https://github.com/Okazari/Rythm.js/blob/4693385a2d854f0c5f1...

[2] https://github.com/Okazari/Rythm.js/blob/c054c475e6e758878db...

-- edit: formatting

Re:Show HN: Make your web page dance with Rythm.js by Okazari on Thursday September 07, 2017 @03:44AM (#15189823)
The other answer show exactly the good code lines.

To describe it fast : I keep an history of frequency (size customable) and compare the subscribed frequency range to its relative history max / min value. I get a percentage out of it that i give to the dance function associated to this specific class.