This discussion is archived
2 Replies Latest reply: Dec 6, 2010 12:38 PM by Darryl Gove RSS

Christmas light show

820822 Newbie
Currently Being Moderated
hey I've been trying to work out this problem for a while now which started last semester I am trying to write a program to that can be fed in music files and then reads the notes/frequencies and then turns on a different colored light for each note. The lights are easy I already programmed that in C and can more or less easily translate it into java but what I can't figure out is the music part. I've looked online and read forums about frequencies and recording sound to files but as far as I can figure none of it really correlates. so if anyone has an algorithm or an equation or something that I can evolve into what I need... it would be very appreciated thank you in advance
  • 1. Re: Christmas light show
    jschellSomeoneStoleMyAlias Expert
    Currently Being Moderated
    There are several parts to your problem: reading a 'music' file, mapping data from that to notes, mapping a 'note' to your light interface.

    The last part is the easiest since you can just make up your own notational system and stream that to your lights.

    However I am guessing that you are also going to want to play the music so you can hear it as the lights change.

    And reading the file and playing the music is a non-trivial undertaking especially since you want to insert yourself into the stream. As such you probably should focus only on that now. Once you have achieved that you should have a better idea of how to map to notes especially if you pay attention to the details of the file formats.
  • 2. Re: Christmas light show
    Darryl Gove Newbie
    Currently Being Moderated
    Hi,

    You need to read the sound data in chunks, then do a fourier transform (FFT) on the data. This converts it from an array of values over time into an array of values over frequency. You can aggregate these to produce a strength per frequency range, and use these to drive the various lights.

    Darryl.

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points