![]() |
Help! PyQt4: get input level from the N900 Microphone
Hi Folks! :)
In my opinion I have now a great Idea for a application to learn and contribute to the first N900 coding competition. :D Yes, it will be great! But I don't want to share my Idea now... (Apple could steal it before I finished it) :) It's a lot of work to do. So I will begin soon to finish before the deadline. I finished the script and some mockups for the UI, I know how to store in a Database, how to read binary files... I guess I can figure out how to draw images on the screen, store them on mmc1 and to see if the battery is charging. No problems so far for my, only work... except one of the core elements I don't know how to solve... :( Without that the application is useless. So, I hope here is someone who can help me to finish my (top secret) project in PyQt4: I need to read every 100ms the volume peak, the average input level or the maximum input level or something similar from the microphone. I don't want to record the stream or something else... just: noise out there, 20% of 100% maximum peak or 80%? A simple integer value how loud the environment is. :confused: I don't need more. :( Are there someone out there who could show me the way? I looked into the code of Tuner, but its to much for my needs and C++. :( Is portaudio19-dev useful for me? :confused: So please help so that I can start with my project! :) |
Re: Help! PyQt4: get input level from the N900 Microphone
If you are using PR1.2 then the QtMultimedia stuff is what you need.
see the blog http://labs.trolltech.com/blogs/2010...trum-analyser/ |
Re: Help! PyQt4: get input level from the N900 Microphone
Quote:
I don't need it graphically shown... But I hope I can extract somewhere my needed Values... :) Sadly, I can't find QMultimedia at the PyQt4 bindings: Class Reference Can I implement QMultimedia then in a direct way? :confused: |
Re: Help! PyQt4: get input level from the N900 Microphone
Okay, here now the PyQt4 class reference for QtMultimedia
But when I try to read from the defaultInputDevice() I get the error: Code:
ALSA lib pcm.c:2211: (snd_pcm_open_noupdate) Unknown PCM null Code:
from PyQt4 import QtMultimedia What's wrong? Have I to activate the sound devices before? I haven't found anything like this in the class reference nor in your c++ example. :( |
Re: Help! PyQt4: get input level from the N900 Microphone
I have not used it yet, but will do soon. Did you have a look at the multimedia example
http://doc.qt.nokia.com/4.6/examples-multimedia.html And the ref python doc http://www.riverbankcomputing.co.uk/...a.html#details |
Re: Help! PyQt4: get input level from the N900 Microphone
Quote:
http://qt.gitorious.org/qt/qt/trees/...s/spectrum/app But what I saw there was very similar to your example in: http://doc.qt.nokia.com/4.6/multimed...input-cpp.html I tryed to translate it into Python. But I failed in the early begining with the identification of the audio devices: http://doc.qt.nokia.com/4.6/multimed...vices-cpp.html Quote:
Here is the TESTING code I have at the moment: (I know, it's not well done and I need a Timer before stoping the recording. But without the fundamentals and essential defaultInputDevice its useless to polish it) :( Code:
from PyQt4 import QtMultimedia |
Re: Help! PyQt4: get input level from the N900 Microphone
I haven't tried any Qt4.6 development but have managed to get python to monitor mic audio levels using gstreamer tools
pipeline = gst.parse_launch("pulsesrc ! level message=true ! fakesink") bus = pipeline.get_bus() bus.enable_sync_message_emission() bus.add_signal_watch() bus.connect("message::element", on_message) pipeline.set_state(gst.STATE_PLAYING) then create a callback function that acts on the message retuned from the level monitor (you can control the frequency of the level sampling too) |
Re: Help! PyQt4: get input level from the N900 Microphone
Helex, ever figure this one out? i'm struggling on QtMultimedia now :(
|
Re: Help! PyQt4: get input level from the N900 Microphone
Could be related too a QT bug here? - http://bugreports.qt.nokia.com/browse/QTBUG-10729
|
Re: Help! PyQt4: get input level from the N900 Microphone
Ok not sure it is related to this bug - http://bugreports.qt.nokia.com/browse/QTBUG-5723
But i'm still digging aplay -L shows pulseaudio as our only method... But at least that shows something i spose! |
Re: Help! PyQt4: get input level from the N900 Microphone
Quote:
Personally I would prefer QtMultimedia. But without Audio source it's mostly useless. ;) You can't find any Audio source with QtMultimedia, too? Is your code similar to mine or have you done something totally different? I thought it was only me. But if nobody at this forum can get QtMultimedia working... hmm... perhaps let's then creat a report at bugs.maemo.org to get a N900 specific reply. :confused: Edit: Ah, and sorry for the late reply. Yesterday I enyoied the P!nk summer carneval tour! :D |
Re: Help! PyQt4: get input level from the N900 Microphone
From what i can see so far.... Multimedia may not work, and qtmobility may be the way to go... will keep working on it :)
My code has ended up being very similar to yours! - started converting the C++.... It is new and i'll keep firing questions off. (I've also noted the pulse audio bug too) - so somewhere in there i'm looking for a workaround! |
Re: Help! PyQt4: get input level from the N900 Microphone
I had not many time the last days... but today I found the babyphone application. It provides exactly what I need: http://maemo.org/packages/view/babyphone/
I looked into the source. And with my fundamental C++ knowledge I can't find any difference to my PyQt4 code posted several days ago in this thread. Am I correct or miss I some detail? I guess something in PyQt4 is broken... :( |
Re: Help! PyQt4: get input level from the N900 Microphone
Just realised that you may need to have the qt mobility libs installed.
apt-get install libqtm* going to have a look at this today. |
Re: Help! PyQt4: get input level from the N900 Microphone
Quote:
|
Re: Help! PyQt4: get input level from the N900 Microphone
Quote:
|
All times are GMT. The time now is 11:23. |
vBulletin® Version 3.8.8