Hi,

The example voice recorded causes a segfault on my system here.
Attached is the source.

Appreciate help with this one :)

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, name ):
  f= open( name, 'wb' )
  # Minimum set of parameters we need to create Encoder

  cparams= { 'id': acodec.getCodecID( 'mp3' ),
             'bitrate': 192,
             'sample_rate': 44100,
             'channels': 2 } 
  ac= acodec.Encoder( cparams )
  snd= sound.Input( 44100, 2, 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 )!= 3:
    print 'Usage: voice_recorder <seconds> <file_name>'
  else:
    voiceRecorder( int( sys.argv[ 1 ] ), sys.argv[ 2 ]  )
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

Reply via email to