Re: [pygame] Recording sound
On Wed, Oct 29, 2008 at 1:42 PM, Luke Paireepinart <[EMAIL PROTECTED]> wrote: > Cool, Nathan. I was thinking about writing a singing game - well > maybe not a game so much as a tool. Are ya'll familiar with Canta (http://www.canta-game.org/) It's pretty neat, and written in python. It might be worth seeing what they've done and how they did it. -- brad [bradmontgomery.net]
Re: [pygame] Recording sound
On Wed, Oct 29, 2008 at 11:42 AM, Luke Paireepinart <[EMAIL PROTECTED]> wrote: > Cool, Nathan. I was thinking about writing a singing game - well > maybe not a game so much as a tool. It plays scales and gives you > your statistical accuracy as far as hitting the correct note (just > based on pitch - also would do intervals etc.) Ah, then you want my SoundAnalyse module. It is C code with a python wrapper for realtime pitch and volume detection. http://code.google.com/p/pygalaxy/wiki/SoundAnalyse I separated it out from SWMixer just because compiling C code as part of the install is harder than installing a pure python package. > I was thinking about also adding support for music... To play notes from python, I use FluidSynth. It uses SF2 soundfont files, then you send it NOTEON events and such to play music. I have a preliminary binding for it, pyFluidSynth. http://code.google.com/p/pygalaxy/wiki/pyFluidSynth > Is your API stable at this point? All the packages and APIs should be relatively stable, but they have not been tested on all architectures by lots of people. Bug reports are encouraged. -- Nathan Whitehead
Re: [pygame] Recording sound
Cool, Nathan. I was thinking about writing a singing game - well maybe not a game so much as a tool. It plays scales and gives you your statistical accuracy as far as hitting the correct note (just based on pitch - also would do intervals etc.) I was thinking about also adding support for music so you could practice hitting notes for a specific song - maybe encoded as a MIDI track so you could just load up a midi file and choose a specific track to be the vocal line and the rest will just play as a midi file for accompaniment. That's all extra, though. The scales stuff is the most important. I have been trying to decide if processing the wav to get frequency information in Python would be fast enough or not -- I'll probably try it first and see. Do you have any opinions on the relative speed of this? Would I have to leverage numeric or some fft library in order to get realtime performance? Because at that point I may just write it in C and make a socket-based reporting system that lets you query current pitch, and just request that information from Python. That also has the benefit that you could set the processing C code affinity to a different processor core from your Python frontend. Is your API stable at this point? On Wed, Oct 29, 2008 at 12:52 PM, Nathan Whitehead <[EMAIL PROTECTED]> wrote: > On Wed, Oct 29, 2008 at 10:13 AM, Knapp <[EMAIL PROTECTED]> wrote: >> Does anyone know a good way to record sound with python or pygame in >> Linux? Something that could work with the mic like skype does? > > You can use SWMixer, my little sound library for Python based on > pyAudio. It can do recording and playback simultaneously if your > soundcard supports it (but it is relatively untested). I'm using it > for a singing game. The download has a little example that does > recording and then playback of the sound recorded, while playing a > sound in the background. > http://code.google.com/p/pygalaxy/wiki/SWMixer > -- > Nathan Whitehead >
Re: [pygame] Recording sound
On Wed, Oct 29, 2008 at 10:13 AM, Knapp <[EMAIL PROTECTED]> wrote: > Does anyone know a good way to record sound with python or pygame in > Linux? Something that could work with the mic like skype does? You can use SWMixer, my little sound library for Python based on pyAudio. It can do recording and playback simultaneously if your soundcard supports it (but it is relatively untested). I'm using it for a singing game. The download has a little example that does recording and then playback of the sound recorded, while playing a sound in the background. http://code.google.com/p/pygalaxy/wiki/SWMixer -- Nathan Whitehead
Re: [pygame] Recording sound
or python bindings for gstreamer (no link, too lazy) -M Brad Montgomery wrote: Just another though, you might be OK just using the python interface to ALSA http://pypi.python.org/pypi/pyalsaaudio/0.3 On Wed, Oct 29, 2008 at 12:44 PM, Luke Paireepinart <[EMAIL PROTECTED]> wrote: pymedia may work. You can probably use system calls, or read directly from /dev/audio0 or something like that. Just look for a generic "recorder" script for Linux (in C or something) and you can likely use significant parts of it. On Wed, Oct 29, 2008 at 12:13 PM, Knapp <[EMAIL PROTECTED]> wrote: Does anyone know a good way to record sound with python or pygame in Linux? Something that could work with the mic like skype does? -- Douglas E Knapp http://sf-journey-creations.wikispot.org/Front_Page
Re: [pygame] Recording sound
Just another though, you might be OK just using the python interface to ALSA http://pypi.python.org/pypi/pyalsaaudio/0.3 On Wed, Oct 29, 2008 at 12:44 PM, Luke Paireepinart <[EMAIL PROTECTED]> wrote: > pymedia may work. You can probably use system calls, or read directly > from /dev/audio0 or something like that. Just look for a generic > "recorder" script for Linux (in C or something) and you can likely use > significant parts of it. > > On Wed, Oct 29, 2008 at 12:13 PM, Knapp <[EMAIL PROTECTED]> wrote: >> Does anyone know a good way to record sound with python or pygame in >> Linux? Something that could work with the mic like skype does? >> >> -- >> Douglas E Knapp >> >> http://sf-journey-creations.wikispot.org/Front_Page >> > -- brad [bradmontgomery.net] ust another tough, You may also
Re: [pygame] Recording sound
pymedia may work. You can probably use system calls, or read directly from /dev/audio0 or something like that. Just look for a generic "recorder" script for Linux (in C or something) and you can likely use significant parts of it. On Wed, Oct 29, 2008 at 12:13 PM, Knapp <[EMAIL PROTECTED]> wrote: > Does anyone know a good way to record sound with python or pygame in > Linux? Something that could work with the mic like skype does? > > -- > Douglas E Knapp > > http://sf-journey-creations.wikispot.org/Front_Page >
Re: [pygame] Recording sound
I've used pymedia (pymedia.org) in the past, but it's community is all but dead, so there's not much help if things don't work correctly. I've heard good things about PyAudio (http://people.csail.mit.edu/hubert/pyaudio/), but I haven't had a chance to use it myself. On Wed, Oct 29, 2008 at 12:13 PM, Knapp <[EMAIL PROTECTED]> wrote: > Does anyone know a good way to record sound with python or pygame in > Linux? Something that could work with the mic like skype does? > > -- > Douglas E Knapp > > http://sf-journey-creations.wikispot.org/Front_Page > -- brad [bradmontgomery.net]
[pygame] Recording sound
Does anyone know a good way to record sound with python or pygame in Linux? Something that could work with the mic like skype does? -- Douglas E Knapp http://sf-journey-creations.wikispot.org/Front_Page
Re: [pygame] pixel-perfect physics?
Once the PyGame physics module supports other shapes and collision callbacks it would be easy to first do the regular AABB test and then do a mask collision test. As for the physics, I'm not sure the GSOC project will ever include support for adding custom contact points, etc, but it seems like a collision joint on the colliding pixels would be in order. However, all this would be akward and quite cpu expensive since in modern games, both in graphics and physics, shapes are in and pixels are out. /Peter On 2008-10-26 (Sun) 10:04, Nirav Patel wrote: > Certainly not an easy problem, especially if the shapes are convex. A > sort of hackish way to do this in PyBox2D, if the shapes aren't > already known polygons, is to use Mask.outline() to get some points on > the outline of your object and create a Box2D Poly out of a bunch of > thin connected rects shaped like your object. This is a really bad > description, but check out this thread: > http://www.box2d.org/forum/viewtopic.php?f=8&t=563 . > > Elements, a wrapper for PyBox2D, has functions similar to this written > that you may also want to look at. Take a look at complexPoly and > concavePoly in > http://dev.laptop.org/git?p=activities/physics;a=blob;f=elements/add_objects.py;h=3842b750a8dfe46d9400bab1c6ff5d6206dc718f;hb=HEAD > > This still isn't pixel perfect, but accurate physics and pixel perfect > collision do not go together. > > Nirav > > On Fri, Oct 24, 2008 at 4:50 PM, Michael George <[EMAIL PROTECTED]> wrote: > > Has anyone had experience using pixel-perfect collision detection with a 2d > > physics engine? I've looked into pymunk, but that seems to have baked-in > > collision detection so I don't see how to do it. ODE has rudimentary python > > bindings and has separate collision detection, but it's intended for 3d and > > the 2d support hasn't been added to the python port yet. There's the GSOC > > pygame physics project, but I don't see docs for that and can't tell if it > > would be suitable. > > > > Also, as far as doing the collision detection, AFAICT there isn't a way to > > rotate a mask, or to do collision detection on rotated objects. Are there > > plans for something like this, or am I stuck with using an image, rotating > > it with the transform package and then using Mask.from_surface? > > > > Thanks. > > > > --Mike > > >