Re: [Sndobj-devel] Recording Sound w/ pysndobj
Status: Abandoned
Brought to you by:
veplaini
From: Daniel S. <das...@gm...> - 2010-06-09 18:22:30
|
Hi, I actually have some sample code that deals with portions of what you talked about. === Buffer audio === This is a bit dated but it was part of a project where I was streaming audio between two pc's (and video). This doesn't actually use SndBuffer as I really wasn't aware of it at the time i wrote this (some time ago) and theres some inconsistency of implementation as a numpy extension for sndobj was committed part way through writing this code, and well its made my life alot easier. You can look here, and at other sources if u like http://github.com/dasacc22/videotalk/blob/master/sound.py === plot spectrum === I have another project called vizi and one thing it does is visualize the audio from each sndobj. The project itself started as opengl, migrated partially to PyQT, and now I'm investigating various alternatives still. Cant seem to make up my mind. Nevertheless, you can see some examples of all those bits in vizi, and specifically u can see this for how I do the visuals (refer to SoundObject.draw_waveform in the following link) http://github.com/dasacc22/vizi/blob/master/src/orb2.py its specific to my project so i do some normalizing to the visuals to fit in the constraint of the project. But overall, popping the sound out into a numpy array makes things pretty easy. The rest u were saying is mostly gui specific in how u choose to implement it On Wed, Jun 9, 2010 at 1:05 PM, Nikolas Francis <cor...@gm...>wrote: > Hello, > > I'm a two week old newbie to OOP and python, but I have lots of Matlab > experience from my research. I found psysndobj a few days ago, and it > looks promising for my current foray into python audio. My long-term > goals using pysndobj are: > > (1) buffer audio streaming in from a microphone > (2) plot the spectrum of the audio stored in the buffer > (3) give the user an option to select a band of frequencies from the > display, in order to band-pass filter subsequent audio buffers around > the chosen frequency-band > (3) update the buffer and spectrum display every second or so > > I gather that pysndobj can do the recording, buffering and filtering, > and I was thinking of pyQT for the GUI. I'm currently far, FAR away > from those goals. Currently, I only understand how to monitor my mic: > > ###Start Code > > import sndobj > import time > > #Create input and output objects > input = sndobj.SndRTIO(1, sndobj.SND_INPUT) > output = sndobj.SndRTIO(1, sndobj.SND_OUTPUT) > > #Setup input object > mic = sndobj.SndIn(input) > > #Set output > output.SetOutput(1, mic) > > #threading > thread = sndobj.SndThread() > thread.AddObj(input, sndobj.SNDIO_IN) > thread.AddObj(output, sndobj.SNDIO_OUT) > thread.AddObj(mic) > > #start processing > thread.ProcOn() > time.sleep(30) > thread.ProcOff() > > ###End Code > > Does anyone have any **simple** examples of how to use SndBuffer in > pysndobj? Comments/other recommendations on using pyQT for displaying > and interacting with the spectrum? I realize that this is a high-level > inqury, but I'm floundering a bit with coding, since its a bit > difficult to find relevant examples online, which is how I learned a > lot in Matlab (by editing other people's code to my purpose). > > Thanks! > > > -- > Nik > > > ------------------------------------------------------------------------------ > ThinkGeek and WIRED's GeekDad team up for the Ultimate > GeekDad Father's Day Giveaway. ONE MASSIVE PRIZE to the > lucky parental unit. See the prize list and enter to win: > http://p.sf.net/sfu/thinkgeek-promo > _______________________________________________ > Sndobj-devel mailing list > Snd...@li... > https://lists.sourceforge.net/lists/listinfo/sndobj-devel > |