Analyze sound live with aubio? - python

Is there any way for the aubio library to analyze sound live? I can get it to analyze a saved audio file just fine, but it does not seem to want to work with microphone inputs. Documentation for the Python library seems just about non-existent. All I found were these examples, none of which seem to deal with analysis of live input. Has anyone managed to work with live input before, and how is it done?

See https://github.com/aubio/aubio/issues/78 and https://github.com/aubio/aubio/issues/6
Demo here: https://github.com/aubio/aubio/blob/master/python/demos/demo_pyaudio.py
Please open a new issue whenever you have a question, or use https://aubio.org/contact

Related

Is pytesseract safe to use with confidential images?

I am working on a project for my company which tries to read scanned pdfs and classify them depending on their contents.
After doing some research online, the easiest way to solve this seems to be by using a Python Library called pytesseract.
My question is: Is this library safe to use with images containing confidential customer data? Do the images/the extracted text get saved in some server?
I found this link which suggests that it is. But I am lacking understandment of what exactly happens 'behind the scenes' everytime I read an image with the module.
Thanks in advance for any help!

How to read image files from a Camera (Nikon D5600) with Python

Forgive me if I've left anything out or goofed up formatting conventions; this is my first time posting on this sort of forum.
So I've got a Nikon D5600 that I'm using as part of an (extremely basic) image analysis setup. I'd like to be able to use images from it without having to manually transfer the files over each time I run a test, but I've had some trouble getting access to the files.
To be clear, I don't want to capture screenshots of a video; I understand that this is possible, but the resolution is about 1/3 smaller in video, which is a bit of an issue for my application.
So, when I was 6 hours more naive, I plugged in the camera via USB to my (Windows 10) desktop, tried calling the image using the exact (well, I did change the slashes out) file path windows gave me in the properties screen:
img = cv2.imread("This PC/D5600/Removable storage/DCIM/314D5600/CFW_0031.jpg")
That didn't work.
I checked that the command I was using wasn't the issue by copying the picture to another drive:
img = cv2.imread("D:/CFW_0031.jpg")
That worked.
So I think, and think is a bold claim here, that it's something to do with the "This PC" bit of the path. I've read some old (circa 2009) posts about MTP and such things, but I'm honestly not sure if that's even what this camera uses, or how to get started with that if it is in fact the correct protocol.
I've also tried using pygrabber (I believe it's a wrapper of direct show, though my terminology may be wrong) to control the camera via python, but that also didn't work, although I did manage to control my webcam, which was interesting.
Finally, I attempted to set the assign a letter drive to the camera, but found that the camera wasn't in the manager's list of discs. It's entirely possible I just did this method wrong, but I don't quite see how.
Edit regarding comment from Cristoph
-I just need to be able to use the image files in python, probably with opencv. I suppose that counts as reading them?
-I've attached a screenshot of what the "This PC" location looks like in the file explorer. The camera shows up under devices and drives, but doesn't have a drive letter.

Python WAV audio play *Without External Libraries*

I have been having some issues for the past few days to get this to work. All I need is to learn it once to get it later. So what I need is a good example of working source code to play a simple wav file. I do not want to use an external library only to get this to work. I honestly don't see the point in getting a huge library to substitute for one problem :/. So if I can get a (Once again, NON-EXTERNAL) example, that would be great. (I'm using windows, so winsound should work, but I can't get the winsound.PlaySound('Example'.wav, SND_FILENAME) thing to work.) Thanks!

django/python: How to convert pptx/docx formats to PDF using python?

First of all, I agree that this might sound like a question which has already been asked many times in the past. However I couldn't find any answer that was relevant to me in the similar questions so I'll try to be more specific.
I would need to transform PPTX/DOCX files into PDF using Python but I don't have any experience in file format conversion. I have been looking in many places/forums/websites, read a lot of documentation and came across some useful libraries (python-pptx and pyPdf mainly), but I still don't know where to start.
When looking on the Internet, I can see many websites that offer file format conversions as a paying service, even with advanced API's: submit a file via POST and get the transformed PDF file in return. This could work for me, but I am really interested in writing myself the code that does the conversion work from OOXML to PDF.
How would you start doing this? Or is it just impossible on my own?
Thanks for your help!
After some research and with the help of python-pptx's creator, I was able to write to the PowerPoint COM interface using a Virtual Machine.
In case someone reads this thread, this is how I managed to get this done:
- Setup a VM with Microsoft Windows/Office installed on it ;
- Install Python, Django and win32com libraries on the VM.
The files are sent locally from the original Django project to the virtual machine (which are on the same network) through a simple POST request. The file is converted on the VM using win32com.client (which is just a simple call to the win32com.client library) and then sent back as a response to the original Django view, which in turn processes the response.
Note: it took me some time to realize I needed to use the #csrf_exempt decorator for this setup to work.

Python read microphone

I am trying to make python grab data from my microphone, as I want to make a random generator which will use noise from it.
So basically I don't want to record the sounds, but rather read it in as a datafile, but realtime.
I know that Labview can do this, but I dislike that framework and am trying to get better at python.
Any help/tips?
You may be interested by PyAudio. I think you can get some bytes from the stream.
Here is an interesting example
u can refer speech_recognition module or PyAudio module for recording speech.I used PyAudio module with Microsoft cognitive service.It worked fine for me.

Categories