You Are Here:

Community: Developer Discussion Boards

#1 Old audio.Sound.open not work - 2007-02-15, 17:58

Join Date: Nov 2006
Posts: 31
zy82518
Offline
Registered User
my code as following:
import audio
form audio import *

#msg.mid exists
file = "c:\\msg.mid"
s = Sound.open(file)
s.play()

here is error report:
Error opening file:KErrNotSupported

why??my device is 6600
Reply With Quote

#2 Old Re: audio.Sound.open not work - 2007-02-16, 18:31

Join Date: Nov 2006
Posts: 31
zy82518
Offline
Registered User
can any body tell me whether there is something wrong with my code or not supported on my device?
I desprately need this feature.thanks all.
Reply With Quote

#3 Old Re: audio.Sound.open not work - 2007-02-16, 20:02

Join Date: May 2004
Posts: 524
Location: Tampere, Finland
jethro.fn's Avatar
jethro.fn
Offline
Forum Nokia Champion
Quote:
Originally Posted by zy82518
Code:
import audio
from audio import *

#msg.mid exists
file = "c:\\msg.mid"  
s = Sound.open(file)
s.play()
I don't have my 6600 charged to try, but have you tried loading a WAV-file? Perhaps the Sound module does not support MIDI files.
Reply With Quote

#4 Old Re: audio.Sound.open not work - 2007-02-17, 05:27

Join Date: Nov 2006
Posts: 31
zy82518
Offline
Registered User
hi jethro.fn:
thanks for your reminder,wav-file works well,however,another funny problem
araised,when I use this code directly,it works,but when I put this code in a function,it failed to make a sound
for example:
#this code works well
import audio
from audio import *

#msg.wav exists
file = "c:\\msg.wav"
s = Sound.open(file)
s.play()



######but the code as folllow failed:
HTML Code:
import audio
from audio import *

#msg.wav exists
def sound_play():
    file = "c:\\msg.wav"  
    s = Sound.open(file)
    s.play()

sound_play()
Reply With Quote

#5 Old Re: audio.Sound.open not work - 2007-02-17, 11:02

Join Date: May 2004
Posts: 524
Location: Tampere, Finland
jethro.fn's Avatar
jethro.fn
Offline
Forum Nokia Champion
Quote:
Originally Posted by zy82518
when I use this code directly,it works,but when I put this code in a function,it failed to make a sound
The problem is that Sound object "s" is local to your function and it gets deleted as soon as it gets out of scope when the function ends. s.play() is an asynchronous function, i.e. it starts a sound and returns, without waiting for the sound to end. When "s" is deleted, the sound stops.

You need to wait for the sound to end in sound_play() or make sure "s" is not deleted prematurely, for example:

Code:
import audio
from audio import *

s = None

def sound_play():
    global s
    file = "c:\\msg.wav"
    s = Sound.open(file)
    s.play()

sound_play()
In the code above, "s" is a global variable and only gets out of scope when the program ends.
Reply With Quote

#6 Old Re: audio.Sound.open not work - 2007-02-17, 12:35

Join Date: Nov 2006
Posts: 31
zy82518
Offline
Registered User
buddy ,thanks for your kindness
it works now.
Reply With Quote

#7 Old Re: audio.Sound.open not work - 2007-07-22, 22:37

Join Date: Apr 2004
Posts: 107
Send a message via ICQ to carknue
carknue
Offline
Regular Contributor
I've got a question concerning the set_volume command,

This code works fine:
Code:
def sound_play():
		global s
		s.set_volume(SetupForm.getVolume())
		s.play()
but how can I change the volume of the audio.say command?

Code:
audio.set_volume(5)
audio.say(unicode(cid))
fails.
Reply With Quote

#8 Old Re: audio.Sound.open not work - 2007-07-24, 21:56

Join Date: Apr 2004
Posts: 107
Send a message via ICQ to carknue
carknue
Offline
Regular Contributor
And can I control the speed of the reading? And what about volume? And how to put in pauses?

And finally, my programm stops running as long as the duration of the speech output. How can I make I application do not wait untill the speech is finished?
Last edited by carknue : 2007-07-24 at 23:04.
Reply With Quote
Reply « Previous Thread | Next Thread »
Display Modes
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Rate This Thread
Rate This Thread:

Posting Rules

You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump
Similar Threads
Thread Thread Starter Forum Replies Last Post
Compare() works in emulator but doesn't work in phone yencruz General Symbian C++ 2 2004-04-27 11:36
CommConnection does not work with Series 60 SDK, but works in JWT jackiechan2001 Mobile Java Tools & SDKs 1 2004-02-04 10:07
Does SDK v2.0 work on Series60 V6.1? liying Symbian Tools & SDKs 3 2004-02-02 09:57
does irda function work with the emulator ? IGhost General Symbian C++ 0 2002-12-07 18:43
8310 Simulator doesn't work DickJones General Browsing 1 2002-11-11 13:55

Rate This

 
Bookmark this page: DeliciousDiggFacebookGoogleYahooStumbleUponRedditDiigoTechnocratiTwitter  Share this page Share this page Print this Page Print this page Invite a friend Invite a friend
京ICP备05048969号    Email Newsletters Press Terms & Conditions Privacy Policy Sitemap Contact Us © 2009 Nokia