Welcome, Guest
Username: Password: Remember me

TOPIC: Audio: Spectrum Meter (32x8 Resolution)

Audio: Spectrum Meter (32x8 Resolution) 3 months 1 week ago #1874

  • Ray
  • Ray's Avatar
  • NOW ONLINE
  • Moderator
  • Posts: 685
  • Thank you received: 146
  • Karma: 40
This code was originally developed by openmusiclabs.com . All credit to them.
You can find more info about it in the original websites:
wiki.openmusiclabs.com/wiki/FHTExample

The code reads the A0 analog value and represents it over the four 8x8LED matrices.
  • The first upper row represents the first part of the spectrum and the two lower LEDs represent the end of the spectrum
  • You can change the brightness in the line
    lc.setIntensity(i, 12); // 15 = brightest

This is the complete code:

File Attachment:

File Name: Spectrum_Meter_32x8.zip
File Size: 588 KB


The key part of the code is here:
		    // First matrix		
        lc.setColumn(0, 7, bitswap(bar((fht_log_out[0] ) * 1)));
        lc.setColumn(0, 6, bitswap(bar((fht_log_out[1] ) * 1)));
        lc.setColumn(0, 5, bitswap(bar((fht_log_out[2]) * 1)));  
        lc.setColumn(0, 4, bitswap(bar(av(fht_log_out, 4, 5) * 1)));
        lc.setColumn(0, 3, bitswap(bar(av(fht_log_out, 6, 7) * 1)));
        lc.setColumn(0, 2, bitswap(bar(av(fht_log_out, 8, 9) * 1)));
        lc.setColumn(0, 1, bitswap(bar(av(fht_log_out, 10, 11) * 1)));
        lc.setColumn(0, 0, bitswap(bar(av(fht_log_out, 12, 13) * 1)));      
        // Second matrix
        lc.setColumn(1, 7,bitswap(bar(av(fht_log_out, 14, 16) * 2)));
        lc.setColumn(1, 6,bitswap(bar(av(fht_log_out, 17, 19) * 2)));
        lc.setColumn(1, 5,bitswap(bar(av(fht_log_out, 20, 22) * 2)));
        lc.setColumn(1, 4,bitswap(bar(av(fht_log_out, 23, 25) * 2)));
        lc.setColumn(1, 3,bitswap(bar(av(fht_log_out, 26, 28) * 2.1)));
        lc.setColumn(1, 2,bitswap(bar(av(fht_log_out, 29, 30) * 2.1)));
        lc.setColumn(1, 1,bitswap(bar(av(fht_log_out, 31, 32) * 2.1)));
        lc.setColumn(1, 0,bitswap(bar(av(fht_log_out, 33, 39) * 2.1)));
        // Third matrix
        lc.setColumn(2, 7,bitswap(bar(av(fht_log_out, 40, 44) * 2.2)));
        lc.setColumn(2, 6,bitswap(bar(av(fht_log_out, 45, 49) * 2.2)));
        lc.setColumn(2, 5,bitswap(bar(av(fht_log_out, 50, 54) * 2.2)));
        lc.setColumn(2, 4,bitswap(bar(av(fht_log_out, 55, 59) * 2.2)));
        lc.setColumn(2, 3,bitswap(bar(av(fht_log_out, 60, 64) * 2.4)));
        lc.setColumn(2, 2,bitswap(bar(av(fht_log_out, 65, 69) * 2.4)));
        lc.setColumn(2, 1,bitswap(bar(av(fht_log_out, 70, 74) * 2.4)));
        lc.setColumn(2, 0,bitswap(bar(av(fht_log_out, 75, 79) * 2.4)));
        // Fourth matrix
        lc.setColumn(3, 7,bitswap(bar(av(fht_log_out, 80, 86) * 2.6)));
        lc.setColumn(3, 6,bitswap(bar(av(fht_log_out, 87, 93) * 2.6)));
        lc.setColumn(3, 5,bitswap(bar(av(fht_log_out, 94, 100) * 2.6)));
        lc.setColumn(3, 4,bitswap(bar(av(fht_log_out, 101, 107) * 2.7)));
        lc.setColumn(3, 3,bitswap(bar(av(fht_log_out, 108, 114) * 2.7)));
        lc.setColumn(3, 2,bitswap(bar(av(fht_log_out, 115, 119) * 2.8)));
        lc.setColumn(3, 1,bitswap(bar(av(fht_log_out, 120, 123) * 2.8)));
        lc.setColumn(3, 0,bitswap(bar(av(fht_log_out, 124, 127) * 3)));  

You can change the boundaries of every column giving more weight to the treble or bass.

This is the code:

File Attachment:

File Name: Spectrum_Meter_32x8.zip
File Size: 588 KB



This second code gives more emphasis to the treble:

File Attachment:

File Name: Spectrum_Meter_32x8_better_bass.zip
File Size: 594 KB



spectrum32x8.jpg
Last Edit: 3 months 6 days ago by Ray.
The administrator has disabled public write access.
Time to create page: 0.250 seconds
Powered by Kunena Forum
Joomla SEF URLs by Artio