Based on code from this very nice project: https://www.instructables.com/id/Music-Reactive-Desk-Lamp/