Start PyS60 Tutorials PyS60 Talks Applications Buzz Us Blog

 

Notification, Menus and Forms. Canvas, Content Handler and Queries. Set application title, tabs and set application body. Application screen size and Application Orientation. Text to speech, Playing and Recording sounds and setting volume. Taking a Photo, Recording Video and Using Viewfinder. Accessing Contacts and Adding - Deleting Contact entries. Using the e32 Module. Drawing, Opening and Editing an Image. Checking the Inbox, Reading SMS, Deleting SMS and Waiting for a SMS. Setting Logs, Retrieving Last missed calls, Retrieving Last SMS. Sending SMS, MMS, Email. Battery and Signal, Free Ram and Free Space, IMEI and firmware, phones, display, etc. Making a call, Hanging up calls, Waiting for a call. Displaying Text and showing an Image on a Window. Avoiding Python to be terminated by Red Key and Hiding the shell. Global Notifications and Queries.

 

 

      ADVERTISEMENT

 

 

 

 

Text to speech:

 

#Copyright (c) 2008 Pankaj Nathani

#Using text-to-speech

 

#You can use the text-to-speech engine of the phone to make is read text aloud

 

import audio

 

audio.say("This is an example")

 

 

Playing sound:

 

#Copyright (c) 2008 Pankaj Nathani

#Playing a sound

 

import audio, appuifw

 

 

#Define the function for stopping the playback

def stop():

    global s

    s.stop()

    s.close()

    appuifw.app.exit_key_handler=stop

 

#Open the sound file

s=audio.Sound.open("C:\\music.mp3")

 

#Play it

s.play()

#This plays the file once; to play it indefinitely use s.play(KMdaRepeatForever)

 

 

Recording sound:

 

#Copyright (c) 2008 Pankaj Nathani

#Recording sound

import audio, appuifw


def stop():
    global s
    s.stop()
    s.close()
    appuifw.app.exit_key_handler=stop

#Open a new file for recording
s=audio.Sound.open("C:\\recorded.amr")

#Start recording
s.record()

 

 

Setting volume:

 

#Copyright (c) 2008 Pankaj Nathani

#Setting the volume and position and getting duration


import audio, appuifw


def stop():
    global s
    s.stop()
    s.close()

s=audio.Sound.open("C:\\s.mp3")
#Show the current volume and the maximum volume
appuifw.note(u"Current volume %d" % s.current_volume())
appuifw.note(u"Max volume %d" % s.max_volume())
#Ask the user for new volume
v=appuifw.query(u"New volume", "number")
s.set_volume(v)

appuifw.note(u"The duration of this song is %d seconds" % int(s.duration()/1000000))

s.set_position(3) #3 seconds

appuifw.note(u"%d seconds have been played" % int(s.current_position())) #In this case 3.4 seconds

 

 
 

       Copyright © Croozeus.com All rights reserved.                                                                                                                        Webdesign: Jackson Productions