On Tue, Jul 04, 2006 at 11:52:26PM -0700, Dmitry Borisov wrote:
> Any specific command line you use ?
No. Just running the example python app. (See attached).
~/files/programming/python/tmp/pymedia-examples
$ python voice_recorder.py 60 2 test.mp3
ALSA lib pcm_hw.c:1355:(_snd_pcm_hw_open) Invalid value for card
Segmentation fault
cheers
James
--
--
-"Problems are Solved by Method"
-
- James Mills <[EMAIL PROTECTED]>
- HomePage: http://shortcircuit.net.au/~prologic/
- Phone: +61732166379
- Mobile: +61404270962
- Skype: therealprologic
- MSN: [EMAIL PROTECTED]
- ICQ: 98888663
- IRC: irc://shortcircuit.net.au#se
Please avoid sending me Word or PowerPoint attachments.
See http://www.gnu.org/philosophy/no-word-attachments.html
import time, sys
import pymedia.audio.sound as sound
import pymedia.audio.acodec as acodec
def voiceRecorder( secs, channels, name ):
f= open( name, 'wb' )
# Minimum set of parameters we need to create Encoder
cparams= { 'id': acodec.getCodecID( 'mp3' ),
'bitrate': 128000,
'sample_rate': 44100,
'channels': channels }
ac= acodec.Encoder( cparams )
snd= sound.Input( 44100, channels, sound.AFMT_S16_LE )
snd.start()
# Loop until recorded position greater than the limit specified
while snd.getPosition()<= secs:
s= snd.getData()
if s and len( s ):
for fr in ac.encode( s ):
# We definitely should use mux first, but for
# simplicity reasons this way it'll work also
f.write( fr )
else:
time.sleep( .003 )
# Stop listening the incoming sound from the microphone or line in
snd.stop()
#
----------------------------------------------------------------------------------
# Record stereo sound from the line in or microphone and save it as mp3 file
# Specify length and output file name
# http://pymedia.org/
if __name__ == "__main__":
if len( sys.argv )!= 4:
print 'Usage: voice_recorder <seconds> <channels> <file_name>'
else:
voiceRecorder( int( sys.argv[ 1 ] ), int( sys.argv[ 2 ] ), sys.argv[ 3 ] )
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Pymedia-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/pymedia-users