Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<a href="https://www.tindie.com/stores/zodiacdesigns/?ref=offsite_badges&utm_source=sellers_ZodiacDesigns&utm_medium=badges&utm_campaign=badge_large"><img src="https://d2ss6ovg47m0r5.cloudfront.net/badges/tindie-larges.png" alt="I sell on Tindie" width="200" height="104"></a>
<a href="https://www.zodiaccurios.com.au/shop/p/spectrogram-mini">

# Spectrogram

Expand Down
177 changes: 120 additions & 57 deletions hardware/pcb/fp-info-cache
Original file line number Diff line number Diff line change
@@ -1,4 +1,109 @@
24201505183505038
24217630694417123
Adafruit MAX31856
1X09_ROUND_70


0
9
9
Adafruit MAX31856
0805-NO


0
2
2
Adafruit MAX31856
0805_10MGAP


0
2
2
Adafruit MAX31856
ADAFRUIT_3.5MM


0
0
0
Adafruit MAX31856
ADAFRUIT_TEXT_20MM


0
0
0
Adafruit MAX31856
FIDUCIAL_1MM


0
1
1
Adafruit MAX31856
MAX31856


0
13
10
Adafruit MAX31856
MOUNTINGHOLE_2.5_PLATED


0
1
1
Adafruit MAX31856
PCBFEAT-REV-040
Revision Level Field - 40 mil{return}{return}Set version with global board attribute '>REV'

0
0
0
Adafruit MAX31856
SOD-323
SOD323 (2.5x1.2mm)

0
2
2
Adafruit MAX31856
SOT23-5
Small Outline Transistor - 5 Pin

0
5
5
Adafruit MAX31856
SYMBOL_MINUS
ICON{return}{return}Minus Symbol

0
0
0
Adafruit MAX31856
SYMBOL_PLUS
ICON{return}{return}Plus Sign Symbol

0
0
0
Adafruit MAX31856
TERMBLOCK_1X2-3.5MM


0
2
2
Adafruit MAX31856
TSSOP14
Thin Shrink Small Outline Plastic 14

0
14
14
Audio_Module
Reverb_BTDR-1H
Digital Reverberation Unit, http://www.belton.co.kr/inc/downfile.php?seq=17&file=pdf (footprint from http://www.uk-electronic.de/PDF/BTDR-1.pdf)
Expand Down Expand Up @@ -56783,6 +56888,13 @@ One digit LED 7 segment SA39-11 SC39-11 SA39-12 SC39-12
0
10
10
Fans
EE40100S2-1000U-999


0
0
0
Ferrite_THT
LairdTech_28C0236-0JW-10
Ferrite, vertical, LairdTech 28C0236-0JW-10, https://assets.lairdtech.com/home/brandworld/files/28C0236-0JW-10.pdf, JW Miller core https://www.bourns.com/products/magnetic-products/j.w.-miller-through-hole-ferrite-beads-emi-filters
Expand Down Expand Up @@ -89879,6 +89991,13 @@ rotary encoder illuminated switch vertical
0
9
8
SC1176 RPi zero 2 w
MODULE_SC1176


0
40
40
Sensor
ASAIR_AM2302_P2.54mm_Lead2.75mm_TabDown
Temperature and humidity module, http://akizukidenshi.com/download/ds/aosong/AM2302.pdf
Expand Down Expand Up @@ -97964,59 +98083,3 @@ Varistor VF
0
2
2
Waveshare_ESP32_S3_mini
Cap touch sensor


0
1
1
Waveshare_ESP32_S3_mini
INMP441


0
6
6
Waveshare_ESP32_S3_mini
LED strip ghost


0
3
3
Waveshare_ESP32_S3_mini
Maker's mark


0
0
0
Waveshare_ESP32_S3_mini
WS-ESP32-S3-Mini


0
18
18
Waveshare_ESP32_S3_mini
eye


0
0
0
Waveshare_ESP32_S3_mini
jumper


0
2
2
Waveshare_ESP32_S3_mini
jumper pad


0
1
1
1 change: 0 additions & 1 deletion hardware/pcb/~Spectrogram flex pcb.kicad_sch.lck

This file was deleted.

53 changes: 53 additions & 0 deletions software/micropython/colour_lut_builder.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
#This was the Claude sonnet 4.5 builder for the LUT
def create_color_lut():
lut = []
for i in range(256):
if i <= 170:
progress = i / 170.0
r = int(255 * progress)
g = 0
b = int(255 * (1 - progress))
else:
progress = (i - 171) / 84.0
r = 255
g = int(255 * progress)
b = 0
lut.append((r, g, b))
return lut

#this is astrolabe's generalised LUT builder
#color_list must be same length as colour_stop_positions. positions must be ascending order. range top must be = top position
def generalised_color_lut(color_list, color_stop_positions, range_top_value, step_size):
lut = []
color_pairs = []
stop_pairs = []

for i in range(len(color_list)-1):
color_pairs.append([color_list[i],color_list[i+1]])
stop_pairs.append([color_stop_positions[i],color_stop_positions[i+1]])
# print("colour_pairs",color_pairs)
# print("stop_pairs",stop_pairs)

start_val=0
for index, pair in enumerate(color_pairs):
# progress=#0-1 value
# print(index, pair)
for i in range(start_val,range_top_value,step_size): #I have constructed this to work with 255 color values. For LUTS that step at 1 unit oer step, it looks algood.
#for LUTS that step at greater steps, more thought is required when calling them: e.g., calling with step_size=256/4 will not perfectly map from start to end (the last colour step will be missing) Therefor, call with correspondingly coarser steps. (n-1)
if i<=stop_pairs[index][1]:
progress= (i-stop_pairs[index][0])/(stop_pairs[index][1]-stop_pairs[index][0]) #progress is a 0-1 parameterized value within each stop range
# print(progress)
#base value + delta (can be +ve or -ve) * progress fraction of delta's application across range
r=int(pair[0][0]+((pair[1][0]-pair[0][0])*progress))
g=int(pair[0][1]+((pair[1][1]-pair[0][1])*progress))
b=int(pair[0][2]+((pair[1][2]-pair[0][2])*progress))
# print(r,g,b)
lut.append((r, g, b))
else:
# print('next colour transition/stop range')
start_val=i
break #break out so the start_val isn't continuously updated as the loops runs out normally

# print(lut)

return lut
125 changes: 125 additions & 0 deletions software/micropython/config.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,125 @@
TEST='test'

FLIP_DISPLAY=True #NOT IMPLIMENTED, LOL #True: high freqencies on left, low on the right - False: vice versa

#presets:
size='s' #(s,m,l,c) #small 7px, medium 12px, large 18/24px, c=custom, go wild
color_blind=False #True/False

if size=='s':
NUM_LEDS = 7
#'Resolution'=notes_per_LED: [1,2,3,4,6,12]
BOOT_RESOLUTION_INDEX=5

BOOT_BRIGHTNESS_INDEX=2
BRIGHTNESS_OPTIONS=[2,6,16,32,64,128,255] #this is semi-independent of the menu width, to make it line up, have the same number of entries as the menu size. If you go outside the menu size, the top brightness pixel isn't displayed.
#two hours of manual fitting by eye and this was the screamingly obvious final outcome: for 7 pixels=[4,8,16,32,64,128,255] I modified the low blues to get that "blue LED not on anymore" vibe
#[2,7,28,64,113,177,255] for 7 pixels, calculated as a square relationship increase in brightness (doesn't look good though lol)


if size=='m':
#goal: make this arbitrarily small/long & accurately reflected in setting. No funny +1 business.
NUM_LEDS = 12 #50 #actually needs to be number of leds+1# ugly work around for array out of bound error caused by ring buffer in mic.py(??)
#'Resolution'=notes_per_LED: [1,2,3,4,6,12]
BOOT_RESOLUTION_INDEX=4
BOOT_BRIGHTNESS_INDEX=4
BRIGHTNESS_OPTIONS=[1,2,3,4,5,9,16,27,48,83,146,255]
#for 12 pixels, i guessed/input:[2,3,4,5,7,10,20,35,50,90,160,255]. The above is a modified fitted curve: 1.75^index, normalized to 255




#configure touch thresholds:
UNPRESSED_CAPACITIVE_READING=80000
PRESSED_CAPACITIVE_READING=90000
#print out the touch levels and compare to the below thresholds.
PRINT_TOUCH_READING=False

#these are the hues the maker selected for the 12 notes of an octave, you can change them :)
import colour_lut_builder as clb
if color_blind==True:
#viridis for replacing intensity for color blind folks:
INTENSITY_COLOR_LUT=clb.generalised_color_lut([(0,0,0),(0,0,255),(0,255,0),(255,255,0)],[0,63,191,255],256,1)
#plasma note scheme
SYN_NOTE_HUES=clb.generalised_color_lut([(0,0,255),(255,0,0),(255,255,0),(255,255,255)],[0,63,211,255],256,22)

#Bunch of tests: you can go crazy trying to pick colours, particularly when you can't 'see' them.
#scheme build call for plasma synesthesia
#plasma0: missing the white top end, which will allow better determination
#clb.generalised_color_lut([(0,0,255),(255,0,0),(255,255,0)],[0,170,255],256,20)
#plasma1: missing the white top end, which will allow better determination. White further fits in with the perceptual brightness angle of these colour schemes
#clb.generalised_color_lut([(0,0,255),(255,0,0),(255,255,0),(255,255,255)],[0,63,191,255],256,20)
#plasma2: yellows not distinct: moving stops. Yellow ususally a small end band
#clb.generalised_color_lut([(0,0,255),(255,0,0),(255,255,0),(255,255,255)],[0,63,211,255],256,22)
#plasma3 adding green denuemont to white, to move closer to blue/a cyclical clour scheme
#clb.generalised_color_lut([(0,0,255),(255,0,0),(255,255,0),(255,255,255),(0,255,0)],[0,60,120,180,255],256,22)
#plasma4 still messing
#clb.generalised_color_lut([(0,0,255),(255,0,0),(255,255,0),(255,255,255),(0,255,0),(0,255,255)],[0,60,120,150,200,255],256,22)
#plasma5: just adding sharps manually. 256/7=36.57
#clb.generalised_color_lut([(0,0,255),(255,0,0),(255,255,0),(255,255,255)],[0,63,211,255],256,36)
#which yeilds: [(0, 0, 255), (145, 0, 109), (255, 15, 0), (255, 77, 0), (255, 139, 0), (255, 201, 0), (255, 255, 28), (255, 255, 237)]

else:
#plama scheme
INTENSITY_COLOR_LUT=clb.generalised_color_lut([(0,0,255),(255,0,0),(255,255,0)],[0,170,255],256,1)
#rainbow note scheme - manually selected
SYN_NOTE_HUES=[(255,0,0),(255,30,30),(255,60,0),(255,255,0),(255,255,30),(0,255,0),(80,220,10),(0,155,255),(0,0,255),(50,0,255),(255,0,255),(255,255,255)]

DEV_STATUS_LED_PIN=21

#pipedream
HALVED_MIRRORED_SPECTRUM=False
MIRROR_START_INDEX=NUM_LEDS/2

#Colour selections:


#this can be used to change the direction of the waterfall. Depends on one's prefered viewing angle Normally pin0=6,pin1=8,pin2=7
LEDS_PIN0 = 6
LEDS_PIN1 = 8
LEDS_PIN2 = 7

ID = 0 #I2S identity
#mic pins
SD = 11
SCK = 10
WS = 9

#Boot visualisation settings/options:

#integer multiples of 10: logic/resolution is set in menu.py
BOOT_MAX_DB=-40
BOOT_MIN_DB=-80


#menu display stuff
MENU_LED_OFFSET=0 #useful for (e.g.) 18 or 24 wide menus that only want 12 pixel wide displays
MENU_SIZE=NUM_LEDS-MENU_LED_OFFSET-1 #or face crash #counting from zero... LEDS are indexed from 0... #ideally should be tied to LEDS-1
MENU_SCALE=1 #not used?? useful for crunching down the menu's size (1 pixel=?, 6pixels=0.5, 12pixels=1



DB_RANGE=120
DB_STEP_SIZE=5#[10db, 5db, 1db]
from math import ceil
DB_SETTINGS_PER_BIN=s if (s := ceil((DB_RANGE/DB_STEP_SIZE)/NUM_LEDS)) <= NUM_LEDS else None #walrus operator, lol
DB_COARSE_STEP_SIZE=DB_STEP_SIZE*DB_SETTINGS_PER_BIN

DB_ACTIVE_BRIGHTNESS_BUMP=100 #indicate active status with brightness, not colour

print("DB_SETTINGS_PER_BIN",DB_SETTINGS_PER_BIN)
#helpful if the stepsize is a muliple of the settings_per_bin. Or just use //
if DB_SETTINGS_PER_BIN>1:
if color_blind==True:
DB_INDICATOR_COLORS=clb.generalised_color_lut([(255,255,000),(000,255,000),],[0,255],256,256//(DB_SETTINGS_PER_BIN-1)) #-1 is for coarser steps to get full range mapped #shades of yellow/green
else:
DB_INDICATOR_COLORS=clb.generalised_color_lut([(255,255,000),(000,255,000),],[0,255],256,256//(DB_SETTINGS_PER_BIN-1)) #-1 is for coarser steps to get full range mapped #shades of yellow/green
print(DB_INDICATOR_COLORS)
else:
if color_blind==True:
DB_INDICATOR_COLORS=[(255,000,000)] #active=red - stands out from blue.
pass
else:
DB_INDICATOR_COLORS=[(000,255,000)] #active=green


Loading