Ejemplo n.º 1
0
	def tick(self):
		toReturn = VolumePattern.tick(self)
		if(self.avalibleSamples!=0):
			self.pastData.popleft()
			self.pastData.append(util.soundToColor(self.lastVolume))
			self.avalibleSamples=0
		
		for r in range(23, 0, -1):
			color=self.pastData.popleft()
			self.draw.ellipse((16-r, 16-r, 16+r, 16+r), fill=color)
			self.pastData.append(color)
		
		return toReturn
Ejemplo n.º 2
0
	def tick(self):
		toReturn = VolumePattern.tick(self)

		self.prevColor=util.soundToColor(self.lastVolume)
		self.avalibleSamples=0
		
		self.pastData.popleft()
		self.pastData.append(self.prevColor)
		
		for r in range(0, 1024, 1):
			color=self.pastData.popleft()
			self.draw.point((31-(r%32) , 31-(r//32)), fill=color)
			self.pastData.append(color)
		
		return toReturn
Ejemplo n.º 3
0
data_in.setperiodsize(256)

while True:
	# Read data from device
	l,data = data_in.read()
	try:
		if l:
			# catch frame error
			try:
				max_vol=audioop.max(data,2)#2 Bytes filter below 5000
				#max_vol=audioop.max(data,4)#4bytes, filter below 400000000
				#scaled_vol = max_vol//4680
				#print(max_vol)
				pastData.popleft()
				pastData.append(util.soundToColor(max_vol))
				for r in range(23, 0, -1):
					color=pastData.popleft()
					draw.ellipse((16-r, 16-r, 16+r, 16+r), fill=color)
					pastData.append(color)
					
				matrix.SetImage(image.im.id, 0, 0)
				time.sleep(0.025)



			except audioop.error, e:
				if e.message !="not a whole number of frames":
					raise e
	except KeyboardInterrupt:
		matrix.Clear()