propeller color organ?
techstudent
Posts: 21
Hello, I am just a hobbyist wondering how difficult it would be on the Propeller to have one pin be the input from a mic or sound source, and from that divide it up into frequency ranges to blink 8 LEDs depending on frequency. I guess I am just looking for brainstorming/general block diagram for both circuit and programming of how to go about something like this. If there has already been similar discussions or objects written for this sort of thing let me know..
thanks
thanks
Comments
Actually I think the possibility is real good.
There is a spectrum analysis object floating about (I think Beau S.) did it.
If you can analyse a wave form you should be able to output the specific peaks.
I don't think it would be easy, but it is possible. The ease would depend on how much you understand the propeller and it's programming.
James L
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
James L
Partner/Designer
Lil Brother SMT Assembly Services
Are you addicted to technology or Micro-controllers..... then checkout the forums at Savage Circuits. Learn to build your own Gizmos!
Thanks
Almost certainly possible but will take a fair bit of work.
1.Continuously sample in a circular buffer about 40 milliseconds around. (A string that overwrites itself when full.)
2.Using another cog, occasionally multiply by a sinewave representing a center frequency, while adding the products all together, and storing the sum in a variable for that frequency. You may divide by half the number of samples, or whatever produces the most useful range. You may instead use the operator that gives the number of the highest bit, to get a dB-like log2 scale.
a 40 ms buffer holds one full "25 Hz" sine cycle.
a 40 ms buffer holds 10 "400 Hz" cycles.
half the sampling rate, whatever it is, represents the highest frequency detectable. (perhaps 100 4000hz cycles at 8Ksps)
based on this you might figure out other frequencies you want.
3.At any time and often, use the frequency volumes calculated in step 2 to control the brightness of
colored lamps in the color organ.
Use the absolute value of volumes also, because there will be "meaningless negative" volumes.
Notes: works better with sine and cosine waves (quadrature) but doesn't matter with only one if the program works fast;
the lack of quadrature may appear like flicker when there is an obvious continuous tone.
It also works with square waves and triangle waves.
...Short rest... (or stop reading now; it is hard to explain)
The frequency bin for a single frequency is the sum of multiplying that frequency wave by the sound samples,
usually but not necessarily involving both sine and cosine. A sine wave can not detect the cosine wave of its
frequency because it is out of phase, and so when it is there, the lights may flicker if it is often missed while
out of phase. A Fourier analysis uses two bins for each frequency. A Hartley combines them by adding the
sines and cosines together.
The mind perceives frequency in chunks of about 40 milliseconds. There are two mutually exclusive Realities:
Only volume (wind waves) and time, or Only frequency that rings for ever and ever (like a sound rainbow).
One reality is what an oscilloscope shows, or the grooves of vinyl music under a microscope.
The other reality says that if several people sat at an organ with a million keys, and held down the right
tones for four minutes, the tones would mix together like a pure musical hologram and you would hear
a song, even though in reality none of the notes are ever stopped during the performance. ... An FFT with
4 million audible tones would show which ones are significantly loud enough to make the music for the
whole 4 minutes. (Here I arbitrarily invented a metric unit called "1 Song" as 4 minutes of Time.)
Because a moment of musical sensation is about 40 milliseconds, that is why we should use that much
sampled time to visualize the frequency, otherwise, all the lights would flash to the loudness, or go on
and off too slowly, even possibly taking 4 minutes to go on and off. There may be people with faster or
slower hearing, who cannot hear sound as musical sensation at all.
FFT..Fast Fourier Transform, I always thought of it as an equalizer function, for both the levers and the
spectrum analyzer display. Also, it can be used for vocoding, by analyzing the spectrum of both an
instrument (piano, guitar,organ) and multiplying the spectrums together, and doing a backwards FFT
to get the music-voice (or Kraftwerk style robot voice). FFT does some binary power of frequencies
all at the same time, usually in non-musical order, whole number fractions of the total number of samples.
There are a lot of numbers to keep track of though, and its hard to program and even hard to use if
its already programmed. I think it is the most amazing part of DSP (digital signal processing).
The technique I described of multiplying 40 ms of sinewave frequency with 40 ms of samples and then
adding them all together is doing for detecting one frequency what the FFT does for many frequencies
all at the same time. It is called Convolution, and maybe a special case of Correlation, and I think of
it as the "simple FT" or the "Slow FT".
Color organs are simpler as analog devices. It may be possible to rewire an old equalizer so that
each level control outputs separately to a transistor and a large LED christmas bulb (safer than
the large christmas light bulbs). Each eq level is connected to a frequency band pass filter and its
own volume control. Also, the LM567 tone decoder chip does almost the same math in analog that I describe above.
But op amp bandpass filters in chips with 4 op amps like LM324 can also do it with the right resistors
and capacitors for the bandpass filter frequencies.
The color organs I've seen and preferred make 4-pointed stars, using a rare pattern of fluorescent
lamp diffuser plastic. More common diffusers make circular rings instead. One way to shop for a
nice diffuser pattern if you are making the Color Organ that (1970s classic) way is to try all the
diffusers in the hardware store with an LED light behind them, to see what shape it will make.
If you do make a propeller color organ, you can make the colors and shapes on an old TV using
the Propeller TV and GRAPHICS drivers ("objects"). Easy to start by removing unuseful code
from a program that already uses them for something else, which already sets all the parameters
and is then ready to make colored shapes on the screen.
If anyone makes an easy FFT then it can be used to make up musical graphics like some MP3 players do.
One last thing is VERY important. You either need a good (demoboard) mic configuration or an analog to digital
converter that is good for music, for the Propeller to be able to hear and sample the music and use it to
control the light show.
thanks,
techstudent