Archived:How to record a sound in PySymbian
Aquivado: Este artigo foi arquivado, pois o conteúdo não é mais considerado relevante para se criar soluções comerciais atuais. Se você achar que este artigo ainda é importante, inclua o template {{ForArchiveReview|escreva a sua justificativa}}.
All PySymbian articles have been archived. PySymbian is no longer maintained by Nokia and is not guaranteed to work on more recent Symbian devices. It is not possible to submit apps to Nokia Store.
All PySymbian articles have been archived. PySymbian is no longer maintained by Nokia and is not guaranteed to work on more recent Symbian devices. It is not possible to submit apps to Nokia Store.
Article Metadata
Tested with
Devices(s): Nokia N95, Nokia E90
Compatibility
Platform(s): S60 1st Edition, S60 2nd Edition, S60 3rd Edition
Article
Keywords: audio
Created: cyke64
(15 Mar 2007)
Last edited: hamishwillee
(14 Jun 2013)
Contents |
Overview
This snippet shows how to record audio in Python.
Preconditions
Valid file formats must be used. Their availability may vary from one device generation to another and they tipically include WAV, AMR, MP3, AAC, RA.
Source code
import e32, audio
#Open a sound file at the given path
s = audio.Sound.open(u"C:\\sound.amr")
#Start recording
s.record()
#Instantiate a timer
t = e32.Ao_timer()
#Record for 10 seconds, then stop
t.after(10, lambda:s.stop())
Postconditions
Sound is recorded to an audio file at the specified path.
Known issue
Issue with Nokia 6600: Apparently files recorded in WAV format cannot be played. It seems Nokia 6600 has the problem with uncompressed 16-bit wave but it can play other wave files fine.


25 Sep
2009
27 Sep
2009