Skip to content

Commit f1a11d1

Browse files
author
Will Tatam
committed
left and right need to be 7bit, adjust other patterns to use MSGEQ7_OUT_MAX to match active resolution
1 parent bc72866 commit f1a11d1

File tree

3 files changed

+27
-23
lines changed

3 files changed

+27
-23
lines changed

Deevstock/DSGrid/FunkyClouds.ino

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -99,15 +99,8 @@ extern const TProgmemPalette16 myRedWhiteBluePalette_p PROGMEM;
9999
-------------------------------------------------------------------
100100
*/
101101

102-
// storage of the 7 10Bit (0-1023) audio band values
103-
int left[7];
104-
int right[7];
105-
106102
void ReadAudio() {
107-
for(byte band = 0; band < 7; band++) {
108-
left[band] = MSGEQ7get(band, 0);
109-
left[band] = MSGEQ7get(band, 1);
110-
}
103+
// handled in controlLoop
111104
}
112105

113106
/*

Deevstock/DSGrid/Table.ino

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ void EQ() {
4141
// display values of left channel on DMD
4242
for ( band = 0; band < 7; band++ )
4343
{
44-
int count = map(mapNoise(MSGEQ7get(band)), 0, 255, 0, HEIGHT);
44+
int count = map(mapNoise(MSGEQ7get(band)), 0, MSGEQ7_OUT_MAX, 0, HEIGHT);
4545
//int count = map(band, 0, 6, 1, HEIGHT);
4646
for (int b = 0; b < barWidth; b++) {
4747
xpos = blockWidth - (barWidth * band) - b;
@@ -67,7 +67,7 @@ void EQ() {
6767
// display values of left channel on DMD
6868
for ( band = 0; band < 7; band++ )
6969
{
70-
int count = map(mapNoise(MSGEQ7get(band)), 0, 255, 0, HEIGHT);
70+
int count = map(mapNoise(MSGEQ7get(band)), 0, MSGEQ7_OUT_MAX, 0, HEIGHT);
7171
//int count = map(band, 0, 6, 1, HEIGHT);
7272

7373
for (int b = 0; b < barWidth; b++) {
@@ -116,19 +116,19 @@ void VU() {
116116

117117
// Led strip output
118118
if (newReading) {
119-
//fill_solid(leds, kMatrixWidth, CRGB::Black);
120-
121-
int displayPeakL = map(MSGEQ7get(MSGEQ7_LOW, 0), 0, 255, 0, round(HEIGHT / 2));
122-
int displayPeakR = map(MSGEQ7get(MSGEQ7_LOW, 1), 0, 255, 0, round(HEIGHT / 2));
119+
Serial.printf("max = %u, value=%u\n", MSGEQ7_OUT_MAX, MSGEQ7get(MSGEQ7_MID, 0));
120+
int displayPeakL = map(MSGEQ7get(MSGEQ7_MID, 0), 0, MSGEQ7_OUT_MAX, 0, round(HEIGHT / 2));
121+
int displayPeakR = map(MSGEQ7get(MSGEQ7_LOW, 1), 0, MSGEQ7_OUT_MAX, 0, round(HEIGHT / 2));
123122
Serial.print("Display peak: ");
124123
Serial.println(displayPeakL);
125124

126125
moveUp();
127126
int offset = round(HEIGHT / 2);
128127

129-
for (int i = 1; i <= HEIGHT; i++){
130-
drawPixel(0, i, CRGB::Black);
131-
}
128+
// reset first row to black
129+
for (int i = 0; i <= WIDTH; i++) {
130+
drawPixel(i, 0, CRGB::Black);
131+
}
132132

133133
for (int i = 0; i < HEIGHT; i++) {
134134
drawPixel(offset, i, CRGB::Blue);
@@ -211,7 +211,7 @@ void FunkyPlank() {
211211
for ( band = 0; band < 7; band++ )
212212
{
213213
int hue = MSGEQ7get(band, 0);
214-
int v = map(MSGEQ7get(band, 0), 0, 255, 10, 255);
214+
int v = map(MSGEQ7get(band, 0), 0, MSGEQ7_OUT_MAX, 10, 255);
215215
for (int b = 0; b < barWidth; b++) {
216216
int xpos = blockWidth - (barWidth * band) - b;
217217
drawPixel(xpos, 0, CHSV(hue, 255, v));
@@ -223,7 +223,7 @@ void FunkyPlank() {
223223
for ( band = 0; band < 7; band++ )
224224
{
225225
int hue = MSGEQ7get(band, 1);
226-
int v = map(MSGEQ7get(band, 1), 0, 255, 10, 255);
226+
int v = map(MSGEQ7get(band, 1), 0, MSGEQ7_OUT_MAX, 10, 255);
227227
for (int b = 0; b < barWidth; b++) {
228228
int xpos = blockWidth + 1 + (barWidth * band) + b;
229229
drawPixel(xpos, 0, CHSV(hue, 255, v));
@@ -262,7 +262,7 @@ void DJLight() {
262262
// leds[mid].fadeToBlackBy(bands[3] / 12);
263263

264264
leds[mid] = CRGB(bands[5]/2, bands[2]/2, bands[0]/2);
265-
leds[mid].fadeToBlackBy((map(bands[1], 0, 255, 255, 10)));
265+
leds[mid].fadeToBlackBy((map(bands[1], 0, MSGEQ7_OUT_MAX, 255, 10)));
266266

267267
//move to the left
268268
for (int i = NUM_LEDS - 1; i > mid; i--) {

Deevstock/DSGrid/control_tdmx.h

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
#pragma message Teensy 3.2 + MSGEQ7
22
#include <TeensyDmx.h>
3+
//#define MSGEQ7_10BIT
34
// MSGEQ7
45
#include "MSGEQ7.h"
56

@@ -40,14 +41,19 @@ boolean MSGEQ7read() {
4041
}
4142

4243
int MSGEQ7get(int band) {
43-
return MSGEQ7.get(band);
44+
return mapNoise(MSGEQ7.get(band));
4445
}
4546

4647
int MSGEQ7get(int band, int channel) {
47-
return MSGEQ7.get(band, channel);
48+
return mapNoise(MSGEQ7.get(band, channel));
4849
}
4950

5051
int led = 0;
52+
53+
// storage of the 7 10Bit (0-1023) audio band values
54+
int left[7];
55+
int right[7];
56+
5157
void controlLoop() {
5258
int gPatternCount = 32; // FIXME
5359
Dmx.loop();
@@ -67,5 +73,10 @@ void controlLoop() {
6773
FADE = getValue(4, 0, 255); // fade = 4
6874

6975
}
70-
76+
if(MSGEQ7read()) {
77+
for (int b = 0; b < 7; b++) {
78+
left[b] = map(MSGEQ7.get(b, 0), 0, MSGEQ7_OUT_MAX, 0, 1023);
79+
right[b] = map(MSGEQ7.get(b, 1), 0, MSGEQ7_OUT_MAX, 0, 1023);
80+
}
81+
}
7182
}

0 commit comments

Comments
 (0)