Re: Using threads for audio computing?

2014-05-12 Thread lgabiot
Le 12/05/14 10:14, lgabiot a écrit : So if I follow you, if the Pyaudio part is "Non-blocking" there would be a way to make it work without the two threads things. I'm back to the Pyaudio doc, and try to get my head around the callback method, which might be the good lead.

Re: Using threads for audio computing?

2014-05-12 Thread lgabiot
Le 12/05/14 08:13, Stefan Behnel a écrit : This sounds like a use case for double buffering. Use two buffers, start filling one. When it's full, switch buffers, start filling the second and process the first. When the second is full, switch again. Note that you have to make sure that the process

Re: Using threads for audio computing?

2014-05-11 Thread lgabiot
Le 12/05/14 07:58, Chris Angelico a écrit : Well, the first thing I'd try is simply asking for more data when you're ready for it - can you get five seconds' of data all at once? Obviously this won't work if your upstream buffers only a small amount, in which case your thread is there to do that

Re: Using threads for audio computing?

2014-05-11 Thread lgabiot
Le 12/05/14 07:41, Chris Angelico a écrit : The GIL is almost completely insignificant here. One of your threads will be blocked practically the whole time (waiting for more samples; collecting them into a numpy array doesn't take long), and the other is, if I understand correctly, spending most

Re: Using threads for audio computing?

2014-05-11 Thread lgabiot
Le 11/05/14 17:40, lgabiot a écrit : I guess if my calculation had to be performed on a small number of samples (i.e. under the value of the Pyaudio buffer size (2048 samples for instance), and that the calculation would last less than the time it takes to get the next 2048 samples from Pyaudio

Re: Using threads for audio computing?

2014-05-11 Thread lgabiot
Le 11/05/14 16:40, Roy Smith a écrit : In article <536f869c$0$2178$426a7...@news.free.fr>, lgabiot wrote: Hello, Le 11/05/14 16:40, Roy Smith a écrit : If you are going to use threads, the architecture you describe seems perfectly reasonable. It's a classic producer-consu

Using threads for audio computing?

2014-05-11 Thread lgabiot
Hello, I'd like to be able to analyze incoming audio from a sound card using Python, and I'm trying to establish a correct architecture for this. Getting the audio is OK (using PyAudio), as well as the calculations needed, so won't be discussing those, but the general idea of being able at (

Re: Can't get sqlite3.Row working: keyword lookup doesn't work

2014-01-26 Thread lgabiot
Le 26/01/14 09:05, Peter Otten a écrit : Please remember to cut and past the traceback next time. What is wrong? My crystal ball says that you have a from __future__ import unicode_literals statement at the beginning of the module. If I'm right try row[b"filename"] Thanks a lot for you

Can't get sqlite3.Row working: keyword lookup doesn't work

2014-01-25 Thread lgabiot
Hello, using Python 2.7.6 I try to access a sqlite database using keyword lookup instead of position (much more easy to maintain code), but it always fail, with the error: Index must be int or string I have created the database, populated it, and here is the code that tries to retrieve the

Re: sqlite3 docbug (was problem with sqlite3)

2014-01-23 Thread lgabiot
Le 23/01/14 10:04, Mark Lawrence a écrit : No, you need to remember how to type xyz into your favourite search engine. For this case xyz would be something like "python single element tuple". No big deal, but I don't think you are correct. Problem was that for me I "knew" (it was erroneous o

Re: Using a static library in a C extension for Python

2014-01-22 Thread lgabiot
Le 23/01/14 03:33, Chris Angelico a écrit : On Thu, Jan 23, 2014 at 10:00 AM, Christian Gollwitzer wrote: There might be another issue with the license of the library. Cairo is both LGPL and MPL. For LGPL, only dynamic linking is without doubt, for MPL it seems to be accepted to link statically

Re: sqlite3 docbug (was problem with sqlite3)

2014-01-22 Thread lgabiot
Thanks to all, that was indeed the tuple issue! the correct code is: >>>cursor = conn.execute("SELECT filename, filepath FROM files WHERE max_level as was pointed out by many. Sorry for missing such a silly point (well, a comma in fact). I'll learn to read more seriously the doc, but I was r

Re: problem with sqlite3: cannot use < in a SQL query with (?)

2014-01-22 Thread lgabiot
I did similar operations on UPDATE instead of SELECT, and it works there. Maybe my mind is fried right now, but I can't figure out the solution... so maybe I should rename my post: cannot use =, < with (?) in SELECT WHERE query ? -- https://mail.python.org/mailman/listinfo/python-list

problem with sqlite3: cannot use < in a SQL query with (?)

2014-01-22 Thread lgabiot
Hello, I'm building an application using a simple sqlite3 database. At some point, I need to select rows (more precisely some fields in rows) that have the following property: their field max_level (an INT), should not exceed a value stored in a variable called threshold, where an int is stored

Re: Using a static library in a C extension for Python

2014-01-22 Thread lgabiot
thanks a lot for your very precise answer! shortly, as I'm running out of time right now: I've got here a lot of informations, so I'll dig in the directions you gave me. It will be a good compiling exercise... (I'm really new at all this). -- https://mail.python.org/mailman/listinfo/python-l

Re: Using a static library in a C extension for Python

2014-01-22 Thread lgabiot
Le 22/01/14 23:09, Gregory Ewing a écrit : We suspect that 8 Dihedral is actually a bot, so you're *probably* wasting your time attempting to engage it in conversation. Thanks, so that will be my first real experience of the Turing test!!! -- https://mail.python.org/mailman/listinfo/py

Re: Using a static library in a C extension for Python

2014-01-22 Thread lgabiot
Le 22/01/14 18:31, 8 Dihedral a écrit : Check the C source code generated by Pyrex and check cython for what u want, but I did try that out in any mobile phone or flat panel programming. Thanks a lot for your answer. I didn't use Pyrex or other tool, but wrote myself the C python wrap

Using a static library in a C extension for Python

2014-01-22 Thread lgabiot
Hello, working on OS X 10.8.5 Python 2.7 I've written a simple C extension for Python that uses the cairo graphic library. It works well, and I can call it from Python with no problem. The only drawback is that I need to have the cairo library installed on my system (so it seems my extension