Using processing sound library - audio

I would like to use processing sound library:
import processing.sound.*;
But I have the following error:
No library found for processing.sound
Libraries must be installed in a folder named 'libraries' inside the 'sketchbook' folder.
How can I install the sound library? I tried to add it via Sketch > Import library... but I can't find it.
I'm using Processing 2.2.1 on MacOS 10.9.5
Any idea?

This library is available for Processing 3.0+.
To install it, type exactly processing.sound in library installer. Then you'll find it.

I suggest you use minim, which is a very popular sound library for processing.
You can find and use the libary here: http://code.compartmental.net/tools/minim/
If you are using Processing you should already have Minim.
Go to Sketch -> Import Library -> minim
If you still don't find it, Try Go to Sketch -> Import Library -> Add Library -> Minim
You can import the library like this:
import ddf.minim.*;

Related

PyQt5 - Load JPEG-compressed image to QImage

I have an application that displays images, using QtGui.QImage. To save space, I changed the GeoTiff compression from LZW to JPEG, but now I get the following error:
foo: JPEG compression support is not configured.
foo: Sorry, requested compression method is not configured.
I have not found anything how I can configure PyQt to understand that type of compression. Do I need a specific build or can I set it somewhere?
Using Python 3.10 with PyQt5.15
Thanks to the comment of #musicamante, the issue could be solved simply by using:
from PIL.ImageQt import ImageQt
my_q_image = ImageQt(image_path)
Then, my_q_image acts exactly like a QImage.
Important reminder though, which I found while investigating this: PyQt5 support from PIL ends in July 2023!

Import Numpy library in flutter using starflut

I want to run a python script in my flutter app. Thanks to starflut package which helped to do this. Now I want to run a python script that uses NumPy and OpenCV libraries. I want to import these libraries into my python script. I researched a lot about how can I achieve this I couldn't find a way. So I'm posting here so that whoever got the solution for this problem can suggest to me how to do this.

pytest cannot find module on import but code runs just fine

The goal is to use the pytest unit test framework for a Python3 project that uses Cython. This is not a plug-and-play thing, because pytest by default is not able to import the Cython modules. Namely, I get the following error when importing from a Cython .pyx module, in my case named 'calculateScore':
package/mainmodule.py:5: in <module>
from calculateScore import some_functions
E ImportError: No module named 'calculateScore'
This problem occurs both when using the pytest-runner as well as the pytest-cython approach. Strangely enough, the code runs just fine as a python application when you're not trying to test it using pytest.
Changing the import style to import calculateScore or import package.calculateScore does not help.
I have no idea why this is happening, but for me the easiest solution was to use the pytest-cython approach and change one or multiple things listed below in the package's setup.py file:
when defining your Extension for the ext_modules to include the Cython .pyx files, do not use distutils.extension.Extension but rather use setuptools.Extension
The reason why I manually create an Extension instead of using the Cython.Build.cythonize function, is not important here. But please note that for the pytest-runner approach:
do not use the cythonize function, but create the Extension manually
After writing this post I cannot even seem to reproduce the problem using pytest-cython anymore, which suggests that maybe something else is the cause of the problem. An additional thing you could try is to make sure that:
when manually creating an Extension for your .pyx module, make sure the name of the Extension is identical to the name of the module (so name it 'calculateScore' and not for instance 'package.calculateScore').
delete the compiled .so file corresponding to your .pyx file and then re-run.

Importing AndEnginePhysicsBox2DExtension-GLES2 in Android Studio 1.5

I'm trying to make flappy bird equivalent app using AndEngine. I'm having trouble importing AndEnginePhysicsBox2DExtension-GLES2 module in Android Studio 1.5
So far, I have imported AndEngine-GLES2 as module by
Project Structures -> green + sign on left top -> import Eclipse ADP -> selecting path
to AndEngine-GLES2 source.
For some reason when I try this for AndEnginePhysicsBox2DExtension-GLES2, it doesn't recognize it as module therefore I can't import it. I'm not using JAR FYI.
step 4 in here doesn't help as I can't import AndEnginePhysicsBox2DExtension-GLES2, at all.
You have to remove "-GLES2" from folders names.
Other solution could be: File -> New -> Import project -> Select AndEnginePhysicsBox2DExtension and save the project.
Then import the module from project structure...
For both libraries do the following:Go to project strukture -> modules-> button + import module from existing sources.
Then click on your module, switch to dependencies bookmark and add Andengine and physics extenstion imported modules.
Then click on Andengine project and add dependency to Physics extension module.

how to use PyQt5 QtMultimedia

Some people seems to be able to use QtMultimedia with PyQt5.
according to old stackoverflow posts, it was not included with PyQt5 so
what's the way to get it together?
I'm using linux (ubuntu 14.04) and PyQt5 is already installed.
No, QtMultimedia is very much alive and well in PyQt5. Please see the Qt Documentation.
from PyQt5.QtMultimedia import {See Partial List Below}
Partial List of QtMultimedia Imports
QAudioEncoderSettings
QCamera
QCameraImageCapture
QImageEncoderSettings
QMediaMetaData
QMediaRecorder
QMultimedia
QVideoEncoderSettings
In Fact, if you look at the examples directory in the PyQt5 source, you will find a couple of examples including a video player, web camera application, music player etc. #baoboa, who isn't Phil Thompson from Riverbank Computing has added the source to Github which you can find here: https://github.com/baoboa/pyqt5/tree/master/examples/multimediawidgets

Resources