Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ColorChordCalliope #77

Open
pjmole opened this issue Dec 4, 2018 · 10 comments
Open

ColorChordCalliope #77

pjmole opened this issue Dec 4, 2018 · 10 comments

Comments

@pjmole
Copy link

pjmole commented Dec 4, 2018

Greetings Charles
I have wanted to make rows of LEDS lit up by notes to simulate a calliope.
Could not get your latest master code to link but I noticed the experimental branch
and thought I would try to learn some more of git.

"experimental" links and flashes , put the code on 2 of my modules, but they both reboot often.
I have plenty of free time, and would like to help get colorchord reliable again.

So I should explain what I want to accomplish. Probably like @markusb was building I would like to make the leds output one led per note. I am mystified why others have not wanted this.

Example application would be a display like a piano keyboard but with a leds placed underneath each key.
In a calliope example I want to put up 43 or more leds placed into frosted tubes to simulate the pipes.

I am slowly getting to know the colorchord environment better. Tried sending from colorchodrd2 to an esp8266, but am having trouble getting my leds to work again.

I managed to get your latest git code working, If I remain in the DEFAULT mode it does not reboot every 10 seconds. Also noticed you changed to 160MHz so I am wondering if there changes needed to get the leds working.

@cnlohr
Copy link
Owner

cnlohr commented Dec 11, 2018

I'm really sorry, I just read this now.

I just merged experimental into main, and it had a bunch of stuff that really needed to get in there. I haven't tested it very much... But, needed to happen none the less..

You could actually accomplish this fairly easily by reading data out of the fuzzed_bins array, as this has the intensity of all of the notes in the region that colorchord watches. Just as a warning, the first and last octave taper off toward the end.

The big move for Experimental, was to make it so colorchord supports more than 255 LEDs, and can support config values of greater than 255... also, needed to switch to the newer esp82xx.

@pjmole
Copy link
Author

pjmole commented Dec 12, 2018

No Worries.
I noticed the 73 forks of your code and started to test them, at first random selection, and then noticed that @AEFeinstein was working with the code recently and started using it. Got one of my old boards blinking LEDs again, and am now trying to make changes to the UpdateAllSameLEDs().

P.S. Not that keen on more LEDS would rather like to see a rotating mirror and POV.

@cnlohr
Copy link
Owner

cnlohr commented Dec 15, 2018

I actually know @AEFeinstein Should I ask him to remerge?

@pjmole
Copy link
Author

pjmole commented Dec 16, 2018

This is the code I have been trying with great success lately.

When I added ledArray though I had to reduce NUM_LIN_LEDS to 48 in cconfig.h to get avail MEM

With android piano keyboard app you can show DFT matching key by key as they are played!

Still having trouble undestanding color selection code.


void UpdateAllSameLEDs()
{
uint8_t ledArray[NUM_LIN_LEDS] = {
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11,
23, 22, 21, 20, 19, 18, 17, 16, 15, 14, 13, 12,
24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35,
47, 46, 45, 44, 43, 42, 41, 40, 39, 38, 37, 36
};
int i;
uint8_t amp = 0;
uint8_t ledp = 0;

    for( i = 0; i < USE_NUM_LIN_LEDS; i++ )
    {
            ledp = i*2+22;
            amp = (fuzzed_bins[ledp] + fuzzed_bins[ledp+1]) >> 4;
            if( amp > 255 ) amp = 255;
            uint32_t color = ECCtoHEX( (ledp+RootNoteOffset)%NOTERANGE, 255, amp );

            ledp = ledArray[i];
            ledOut[ledp*3+0] = ( color >> 0 ) & 0xff; // R
            ledOut[ledp*3+1] = ( color >> 8 ) & 0xff; // G
            ledOut[ledp*3+2] = ( color >>16 ) & 0xff; // B
    }

}
image

@cnlohr
Copy link
Owner

cnlohr commented Dec 16, 2018

It looks like you're trying to do something like skittlequantity found in DisplayNetwork.c.

I will need more context for your code, as I'm not entirely sure where you are looking... But the (fuzzed_bins[ledp] +... )>>4 averages the two and reduces amplitude by a factor of 8. Then, ECCtoHEX converts the frequency and amplitude to a RGB color.

@pjmole
Copy link
Author

pjmole commented Dec 17, 2018

I understand the structure of the code but always seem to get mostly red/blue outputs and few if any of yellow/green .... oh green is in middle ,tried change to uint16_t for amp and ledp with much improvment

starting to like the display more now, bottom octave mostly blue/purple next octave red and top octaves yellow/green. Now I need to find 48 tubes to cover the leds.

I am not that happy about the ledArray but wanted to see that working. Also to test something
doing the necessary cutting and extending wires to make the octaves stacked.

.... Perry

@AEFeinstein
Copy link

Hello. I was on vacation, hence the delayed reply. I started cleaning and commenting colorchord in order to understand it for a project. In the end, that project was branched from elsewhere, so my changes in the fork are half-baked. I don't remember making any functional changes though, so I can't say why my fork works.

@cnlohr I created a pull request with my changes (#80). It can't be auto-merged, so do with it what you will.

@pjmole
Copy link
Author

pjmole commented Dec 18, 2018

Well I got rid of the the ledArray, so I could add my code as option 2 of gCOLORCHORD_OUTPUT_DRIVER which could be called UpdateAllDifferentLEDs.

void UpdateAllDifferentLEDs()
{
int i;
uint16_t amp = 0;
uint16_t ledp = 0;

    for( i = 0; i < USE_NUM_LIN_LEDS; i++ )
    {
            ledp = i*2+24;
            uint16_t amp = (fuzzed_bins[ledp] + fuzzed_bins[ledp+1]) >> 3;
            if( amp > 255 ) amp = 255;
            uint32_t color = ECCtoHEX( (ledp+RootNoteOffset)%NOTERANGE, 255, amp );

            ledp = i*3;
            ledOut[ledp+0] = ( color >> 0 ) & 0xff; // R
            ledOut[ledp+1] = ( color >> 8 ) & 0xff; // G
            ledOut[ledp+2] = ( color >>16 ) & 0xff; // B
    }

}

Well I made changes to add my code but ended up with `iram1_0_seg' overflowed by 4 bytes, even after doing some code optimizations.

restarted from scratch with new download from @AEFeinstein git and got my changes to link OK.

@cnlohr
Copy link
Owner

cnlohr commented Jan 27, 2019

Excellent. I'm really glad we were able to free up extra space in esp82xx.

@cnlohr
Copy link
Owner

cnlohr commented Jan 27, 2019

I encourage you to publish!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants