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

Switching Project based on Audio volume #149

Open
CodingTwist opened this issue Mar 22, 2020 · 1 comment
Open

Switching Project based on Audio volume #149

CodingTwist opened this issue Mar 22, 2020 · 1 comment

Comments

@CodingTwist
Copy link

Hello, big fan of the project. I am using my lights as a main light (work mode) and a "party mode" light. I have software (voice-meter) on my PC to allow audio to be sent to the PI, I need the PI to detect what mode I'm in (e.g. If playing sound run a smooth rainbow, else run party light config)

Any part of the program I can edit to add this feature or does it already exist?

I have edited the original scott lawson program to allow this so will just be as simple as adding this quick function I put together (I don't mind using the inbuilt editor but was struggling to recreate the effect) , but I prefer the UI and look of this bit of software so opted to use this.

def wheel(pos):
	"""Generate rainbow colors across 0-255 positions."""
	if pos < 85:
		r = pos * 3
		g = 255 - pos * 3
		b = 0 
		return (r,g,b)
	elif pos < 170:
		pos -= 85
		r = 255 - pos * 3
		g = 0
		b = pos * 3
		return (r,g,b)
	else:
		pos -= 170
		r = 0 
		g = pos * 3
		b = 255 - pos * 3
		return (r,g,b)

def visualize_uniformCycle(y):
	"""Effect that uniformly cycles across the colour spectrum"""
	global p_full
	global count
	# Request color based on position 
	r,g,b = wheel(int(count * 256 / config.N_PIXELS) & 255)
	# Scrolling effect window
	p_full[:, 1:] = p_full[:, :-1]
	p_full[0, 0] = r
	p_full[1, 0] = g
	p_full[2, 0] = b
	# Update the LED strip
	count += 1
	if count > config.N_PIXELS:
		count = 0
	return (p_full)
@ChasonDeshotel
Copy link
Contributor

That's a great idea. For DJing/music listening having the program go chill during the break then ramp up at the drop... manholdup

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

2 participants