Raspberry pi portaudio not working with python - python

I recently purchased the I2s microphone from adafruit and wired it to my raspberry Pi 3 Model A+. I want to use the module as the microphone but use the on board audio jack for the speaker. 
Initially this worked with the terminal when recording with arecord and playing with aplay. When trying to use Python PyAudio it gave me many alsa errors and Jack errors such as:
jack server is not running or cannot be started
PyAudio:
import pyaudio
P = PyAudio()
I traced the error to be called in the initialization of PyAudio at the
pa.initialize()
The code did not break but didn't function how I wanted it to. I am hoping to use the speech recognition library but when I run it once again I get all these errors and then it just listens forever. When I used a timeout it would just give an error saying time out.
Would really appreciate any help, I have been stuck on this all week. I've looked across lots of simular issues and have not found a solution.

Related

Access USB device on Mac in python using pyusb an libusb

I would like to read the signal from a USB keyboard that is attached to my MacBook Pro. I am using PyCharm to write my script and I installed pyusb and libusb for the backend. Really, I am at the very beginning so please excuse my little knowledge. The problems I am faced with is that I do [Errno 13] permission error when running the script in PyCharm or when saving it and running it with PyLauncher I get a "No backend available error".
The final aim of this project is to control the vlc-media player using the vlc module based on the input of a usb device.
The current code:
import usb
import libusb_package
backend = libusb_package.get_libusb1_backend()
# find device
keyboard = usb.core.find(idVendor=0x046d, idProduct=0xc318, backend = backend)
if keyboard is None:
raise ValueError('ADU Device not found. Please ensure it is connected.')
sys.exit(1)
usb.util.claim_interface(keyboard, 0)
I would really appreciate any hints or suggestions what packages to use, which tutorials to read for usb devices and python and how to improve in this project.
Thank you very much!
All the best,
ie

ADAFFRUIT_PCA9865 library issue for windows 10

I have a rasparm robot by adeept it has a power electronics unit provided by the company and it is connected to raspberry pi3b+. adeept has online tutorial to run the robots and already written python files which we need to run in raspberry pi in order to make the robot run.
Its running when I am running the python codes in raspberry pi.
But when I am running the same codes in pc via MATLAB its not working. I am calling the python codes provided by adeept from MATLAB and trying to run it, it showing some errors. I have already instled all the libraries which was required to run the code.
I want to use adafruit_pca9865 library and call it with MATLAB and deploy the code to raspberry to make it running.
But when I am calling the python code to run servo from MATLAB i am getting the error shown in screenshot.
when I am trying to run python code directly then also I am getting this error. I have also installed proc and cpuinfo library and added to the folders required.
screenshot of error

Ubuntu Open CV Video Capture

I got a problem with open cv real-time video capturing from camera. I have tried many solutions/suggestions which are available out there but not working for me. Following are the problems:
cap = cv2.VideoCapture(0)
when I tried to get video with this following error comes up:
[ WARN:0] VIDEOIO ERROR: V4L: can't open camera by index 0
Could not open video device
<VideoCapture 0x7fd99e6b5330>
Even though it is reading the video reference.
And from one solution by https://github.com/skvark/opencv-python/issues/124 I tried with
cap = cv2.VideoCapture(-1)
But this does not worked for me as it gives the error:
Video device not found
By trying sudo modprobe bcm2835-v4l2 command I got modprobe: FATAL: Module bcm2835-v4l2 not found in directory /lib/modules/4.15.0-66-generic this error. I'm not finding a way to get out of it.
It is working fine on my MacBook locally but when I tried to deploy on Ubuntu server I'm facing these errors in loop. Can anyone help me on it? Thanks in advance.
Can you open your webcam through other apps?
If not firslty try to reinstall webcam driver.
if you can do it, either some app is using webcam so cv2 can't get access to it or you did not install 3rdparty libraries to work with cameras/videos. You need to install them properly before building OpenCV Python bindings.
( you can find some info there: https://github.com/opencv/opencv/issues/8471 )
Following is the response from hosting server:
"The directory video0 would not exist because our droplets do not have any peripherals attached to them. The function cv2.VideoCapture() attempts to obtain the video capture from a webcam which a droplet would not have.
If you are wanting to stream a remote feed you should be able to do this via RTSP:
https://stackoverflow.com/questions/29099839/opencv-stream-from-a-camera-connected-to-a-remote-machine"
The problem is with droplet which don't have that functionality which we are trying to achieve.
Thanks to all for your love, support and help. Really appreciated. It might help someone else as well.

Raspberrypi reboots when i run my python3 code

While i run the tensorflow object detection python3 code on my raspberrypi 3B then after 1mits the pi reboots without showing any videos.
https://github.com/EdjeElectronics/TensorFlow-Object-Detection-on-the-Raspberry-Pi/blob/master/Object_detection_picamera.py
Alright guys after the help of one of the stackoverflow mate i was able to fix it.
What happened was My power supply only provided 1amp and 5v, but to run my code it required more amps, about 1.8 so when i connect 2amp 5v power supply it worked finally 👍

Running a kinect on Raspberry Pi - Python

I am trying to run Vision Processing python code, through Raspberry Pi with the Microsoft Kinect camera.
I have perfectly working code running on Ubuntu but it fails to perform the same on the RPi.
I think I have all libraries installed on it...
I even tryied the following simple code:
import freenect
ir, data = freenect.sync_get_video(format=freenect.VIDEO_IR_8BIT)
print ir
It doesn't work, it gets stuck.
What could the reason?
Maybe the kinect and the raspberry Pi dont work together?
Note: When I try "freenect-glview" I get: "Number of devices found: 1"
Did you try using OpenNI SDK. I tried and it works with OpenNI Also do you have a powered USB hub as PI can't generate enough energy to power Kinect.
Kinect does not work on RPI due to an usb driver bug :
Linux Driver Issues
Shortly after the Raspberry Pi was released it was confirmed that there were a number of issues with the Linux USB driver for the
SMSC95xx chip.
These included problems with USB 1.x peripherals that use split transactions, a fixed number of channels (causing problems with
Kinect) and the way the ARM processor handles the SMSC95xx interrupts.
[2] [3] A large number of fixes were included in the
2012-08-19-Wheezy-raspbian Linux image.
source http://elinux.org/RPi_VerifiedPeripherals

Categories