Idea:
<___base_url___>/gallery/image/2962-003-basic-idea-sound-2-light/?do=embed
it is inpired by the work of Andreas Körber and his “WortKraftSchwingung”
Input: Midi notes
Output1: DMX R-G-B values
Destination1: RGBW-LED-PAR.
Output2: LFO Audio Output 4 Bodyshacker
a standart audio setup with a Midi-Sound-Synthesizer which is tuned to a specific frequency, a=430-445hz
this tuning has to be set in the Converter-Software, because the converter gets only notes not frequencys…
Hardware:
<___base_url___>/gallery/image/2959-001-setup1-rgbw-dmx-core32/?do=embed
switched to STM32F4
<___base_url___>/gallery/image/2964-005-changing-core/?do=embed
Stairville LEDPAR36 - RGBW-LED-PAR
Converting Idea:
is to octave the sound frequency as long we see it… since all octaves are sounding great…and some greater…the visible frequency then maybe also…and anyway - its a cool effect on stage.
so what has to be calculated?
we have hearable-sound-frequency in Herz [hz]
we want to calculate the Visible color frequency in NanoMeter [nm]
for example:
1. a note produce a sound of 100hz:
float midi[127] = {}; //represent Midinote 0-127 - and its value is a Frequency in [hz]
u32 actualnote = 69; // where 69 is A3 named A (which is tuned with "tuning" Variable above)
s32 notecount = 0; // only a counter variable to calculate the note frequencys.
float tuning = 431; //represent the tuning of "Kammerton A3"
for (notecount = 0; notecount < 127; ++notecount) //calculte all 127 notes and frequencys
{midi[notecount] = tuning * pow(2, (float)(notecount - 69)/12);}
midi[actualnote] ///(=outputs the Frequency in [hz] for the actual played note
2. calculate the visible octave of 100hz
& divide lightspeed by that frequency
(hz*42th octave) / 10^12 =THz >>>> (100hz*2^42)/10^12 = 439.804THz
lightspeed/THz=nm >>>> 299792,458/439.804 = 681.640nm
float nm;
long thz;
thz = ( (midi[actualnote] * pow(2, 42) ) / 1000000000000);
nm = 299792.458 / (float)thz;
is the result not in the visible Spectrum > not between 790 and 390nm? whats then? :::
i figured out that D2-D3 is the visible octave (midi nr 42 - 54)
@431hz A3 tuning:
F2=753nm, F3=376nm
is it under 42?
+12 notes until it is above or equal F2, how many octaves?>how many change the whithe LED-Level…
is it above 53?
-12 notes until it is under or equal F3, how many octaves?>how many change the whithe LED-Level…:::
//transpose the note to the visible Octave (NoteNr41-53) and save the octave Nr for further LED-White Parameters.
octaveCOUNT = 4; //4 is the visible octave
visiblenote = midinote;
if (midinote < 42) {visiblenote = midinote + 12; --octaveCOUNT; // below visible octave?
if (visiblenote < 42) {visiblenote = visiblenote + 12; --octaveCOUNT;
if (visiblenote < 42) {visiblenote = visiblenote + 12; --octaveCOUNT;
if (visiblenote < 42) {visiblenote = visiblenote + 12; --octaveCOUNT; }}}}
if (midinote > 54) {visiblenote = midinote - 12; ++octaveCOUNT; //above visible octave
if (visiblenote > 54) {visiblenote = visiblenote - 12; ++octaveCOUNT;
if (visiblenote > 54) {visiblenote = visiblenote - 12; ++octaveCOUNT;
if (visiblenote > 54) {visiblenote = visiblenote - 12; ++octaveCOUNT;
if (visiblenote > 54) {visiblenote = visiblenote - 12; ++octaveCOUNT;
if (visiblenote > 54) {visiblenote = visiblenote - 12; ++octaveCOUNT;}}}}}}
3. RGBW Calculation
no matter which we use i have to offset the code with the real world the “RGB-LED-Spot”
we cant speak of a exact octaved visible Light colour… but maybe we fade in a range ±hz
so your mind find the correct colour itself…like a detuned unisono synth—there are frequencys sometimes that sounds great…
the other thing is: Frequencys below 400 are UV… a UV-LED-DMX light would do the job… maybe i get me one once the dam DMX-Code thing is done.
//MIX WHITE Light to the RGB, by using the Octaves, you may turn of that feature if you dont want.
if (octaveCOUNT == 0) {RGBWnm[3] = 0;}
else if (octaveCOUNT == 1) {RGBWnm[3] = 28;}
else if (octaveCOUNT == 2) {RGBWnm[3] = 57;}
else if (octaveCOUNT == 3) {RGBWnm[3] = 85;}
else if (octaveCOUNT == 4) {RGBWnm[3] = 110;}
else if (octaveCOUNT == 5) {RGBWnm[3] = 138;}
else if (octaveCOUNT == 6) {RGBWnm[3] = 166;}
else if (octaveCOUNT == 7) {RGBWnm[3] = 194;}
else if (octaveCOUNT == 8) {RGBWnm[3] = 222;}
else if (octaveCOUNT >= 9) {RGBWnm[3] = 255;}
//WHITE OFFSET:
RGBWdmx[3] = RGBWnm[3] -(RGBWenc[3]) ;
//convert [nm] 2 [RGB] --- the GAMMA is not calculatet so - the colors @ end of spectrum are static...but they
//have to fade out....
if (nm < 380) {RGBWnm[0] = 0; //if it is no visible spectrum
RGBWnm[1] = 0;
RGBWnm[2] = 12;} //a UV-Source has alternativly to be activated
if (nm > 780) {RGBWnm[0] = 12; //a IR source has alternativly to be activated
RGBWnm[1] = 0;
RGBWnm[2] = 0;}
else if (nm >= 380 && nm < 440) {RGBWnm[0] = ((-(nm - 440.) / (440. - 380.))*255);
RGBWnm[1] = 0;
RGBWnm[2] = 255;}
else if (nm >= 440 && nm < 490) {RGBWnm[0] = 0;
RGBWnm[1] = (( (nm - 440.) / (490. - 440.))*255);
RGBWnm[2] = 255;}
else if (nm >= 490 && nm < 510) {RGBWnm[0] = 0;
RGBWnm[1] = 255;
RGBWnm[2] = ((-(nm - 510.) / (510. - 490.))*255); }
else if (nm >= 510 && nm < 580) {RGBWnm[0] = (( (nm - 510.) / (580. - 510.))*255);
RGBWnm[1] = 255;
RGBWnm[2] = 0;}
else if (nm >= 580 && nm < 645) {RGBWnm[0] = 255;
RGBWnm[1] = ((-(nm - 645.) / (645. - 580.))*255);
RGBWnm[2] = 0;}
else if (nm >= 645 && nm < 780) {RGBWnm[0] = 255;
RGBWnm[1] = 0;
RGBWnm[2] = 0;}
}
}
4. Sending DMX Values
when we have the RGB-Values we send it via DMX to a RGB-LED, by adapting this code:
http://svnmios.midibox.org/listing.php?repname=svn.mios32&path=%2Ftrunk%2Fapps%2Fexamples%2Fdmx%2F
& studying this code:
http://svnmios.midibox.org/filedetails.php?repname=svn.mios32&path=%2Ftrunk%2Fmodules%2Fdmx%2Fdmx.c
void APP_Background(void){
//DMX:
// endless loop
while(1) { for (count=0;count<4;count++)
{ if (RGBWdmx[count]!=RGBWenc[count]) //if something has changed - send the value via DMX!
{ RGBWdmx[count]=RGBWenc[count];
DMX_SetChannel(count,(u8)RGBWdmx[count]);}
}
}
}
that was not the complicated thing… the complicatect comes now!