Giter Club home page Giter Club logo

Comments (9)

ReMiXs avatar ReMiXs commented on July 27, 2024

I need help too. I have this same problem

from systematic-leds.

ReMiXs avatar ReMiXs commented on July 27, 2024

@RichusX Im solved it! Find microphone.py and change method def get_audio_devices() to
(im bolded important fragment)

def get_audio_devices():
#print( "get audio" )
global p
numdevices = p.get_device_count()
#for each audio device, determine if is an input or an output and add it to the appropriate list and dictionary
audio_options = 'Default'

for i in range (p.get_device_count()):
device_info = p.get_device_info_by_index(i)

if device_info.get('maxInputChannels')>0:
name = device_info.get('name')
audio_options += ',' + name
#print ( audio_options )
return audio_options

from systematic-leds.

ReMiXs avatar ReMiXs commented on July 27, 2024

I have next problem. Im solved it. Just use all my code from microphone.py

`import time
import numpy as np
import pyaudio
import lib.config as config
from lib.config import log

ext_gui = None
stream = None
p = pyaudio.PyAudio()

def get_audio_devices():
#print( "get audio" )
global p
numdevices = p.get_device_count()
#for each audio device, determine if is an input or an output and add it to the appropriate list and dictionary
audio_options = 'Default'

for i in range (p.get_device_count()):
device_info = p.get_device_info_by_index(i)
if device_info.get('maxInputChannels')>0:
name = device_info.get('name')
audio_options += ',' + name
#print ( audio_options )
return audio_options

def microphone_register_gui( gui ):
global ext_gui
ext_gui = gui

def reset_microphone_device():
global stream
if stream is not None:
stream.stop_stream()
stream.close()
stream = None

def start_stream(callback):
global stream, p, ext_gui

id = -1

while id == -1:
try:
id=p.get_default_input_device_info()['index']
except IOError:
log('Cannot find microphone.')
time.sleep( 5 )

frames_per_buffer = int(config.settings["configuration"]["MIC_RATE"] / config.settings["configuration"]["FPS"])

overflows = 0
prev_ovf_time = time.time()
prev_time = time.time()
adjustment_factor = 0.0
while True:
try:
if stream is None:
numdevices = p.get_device_count()
#for each audio device, determine if is an input or an output and add it to the appropriate list and dictionary
for i in range (p.get_device_count()):
device_info = p.get_device_info_by_index(i)
if device_info.get('maxInputChannels')>0:
log( "Audio Device Found : " + device_info.get('name'), 4 )
if device_info.get('name')==config.settings["configuration"]["MIC_NAME"]:
id=i
log( "Found Requested Microphone : " + device_info.get('name'), 3 )

    stream = p.open(format=pyaudio.paInt16,
            channels=1,
            rate=config.settings["configuration"]["MIC_RATE"],
            input=True,
            input_device_index = id,
            frames_per_buffer=frames_per_buffer)
            
  time2 = time.time()
  if config.uses_audio :
    y = np.fromstring(stream.read(frames_per_buffer), dtype=np.int16)
    y = y.astype(np.float32)
    prev_time = time.time()
  else:
    y = 0
    desired_sleep = 1.0/config.settings["configuration"]["FPS"]
    last_loop = time.time() - prev_time
    if abs(last_loop - desired_sleep) > 0.0005: 
      if last_loop > desired_sleep:
        adjustment_factor -= 0.0005
      else:
        adjustment_factor += 0.0005
    sleep_time = desired_sleep + adjustment_factor
    prev_time = time.time()
    time.sleep( max( 0, sleep_time ) )
  callback(y)
  
  
except IOError:
  overflows += 1
  if time.time() > prev_ovf_time + 1:
    prev_ovf_time = time.time()
    if config.settings["configuration"]["USE_GUI"]:
      ext_gui.label_error.setText('Audio buffer has overflowed {} times'.format(overflows))
    else:
      log('Audio buffer has overflowed {} times'.format(overflows))

stream.stop_stream()
stream.close()
p.terminate()
`

from systematic-leds.

theritvars avatar theritvars commented on July 27, 2024

@ReMiXs that's great! I'll give it a go.

from systematic-leds.

ReMiXs avatar ReMiXs commented on July 27, 2024

@RichusX nice :)

from systematic-leds.

Murattemel avatar Murattemel commented on July 27, 2024

@RichusX Im solved it! Find microphone.py and change method def get_audio_devices() to
(im bolded important fragment)

def get_audio_devices():
#print( "get audio" )
global p
numdevices = p.get_device_count()
#for each audio device, determine if is an input or an output and add it to the appropriate list and dictionary
audio_options = 'Default'

for i in range (p.get_device_count()): device_info = p.get_device_info_by_index(i)
if device_info.get('maxInputChannels')>0:
name = device_info.get('name')
audio_options += ',' + name
#print ( audio_options )
return audio_options

where did you find "microphone.py" ? there is no such a thing into "Systematic-LEDs" file.

from systematic-leds.

Murattemel avatar Murattemel commented on July 27, 2024

Could you please share if you get it somewhere else ?

from systematic-leds.

TheBroTMv2 avatar TheBroTMv2 commented on July 27, 2024

i got first that error when i was using anaconda with python 2.7 please double check if that is the case then i tried python 3.6 and voila no problems

from systematic-leds.

plabonhasan avatar plabonhasan commented on July 27, 2024

problem

(RGB) C:\systematic\python>python main.py

No user colours found No user gradients found

dear i am not professional, how can i easy way to solved it

from systematic-leds.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.