You Are Here:

Community: Developer Discussion Boards

#1 Old How to fade between to sound? - 2008-10-02, 12:23

Join Date: Sep 2008
Posts: 35
McLightning34
Offline
Registered User
hi i'm trying to make an app. like nshaver.
it will fade between two sound by the accelerometer data.
while rotating phone down it will fade another sound and it will play it and then when rotate phone to up it will fade to other sound.
i tried to make it with set_volume() function but it's not worked
there is my code:
Code:
v=0
def read_xyz(x,y,z):
    global v
    if(y <= -10):
        v=v+2
    if(y >= 30):
        v=v-30
    set_volume(v)

axyz.connect(read_xyz)
i tried to control the volume with accelerometer but it's not worked as i said.
if i can control the volume with accelerometer then i can make a fade effect between to sound
please help me

sorry for my english
Reply With Quote

#2 Old Re: How to fade between to sound? - 2008-10-02, 12:44

Join Date: May 2007
Posts: 2,738
Location: 21.46 N 72.11 E
croozeus's Avatar
croozeus
Offline
Forum Nokia Champion
Quote:
Originally Posted by McLightning34 View Post
set_volume(v)
You need to apply that to an object.

Suppose,
Code:
s=audio.Sound.open("C:\\s.mp3")
s.set_volume(v)
Hope that helps

Best Regards,
Croozeus
Reply With Quote

#3 Old Re: How to fade between to sound? - 2008-10-02, 13:16

Join Date: Sep 2008
Posts: 35
McLightning34
Offline
Registered User
thanks for the helping about set_volume function it's working now
but i wanna ask something more about python syntax it's not enough significant to write a new topic.
is there anything in python programming like "wait(1)" to add into the loopings.i was using acknex (3dgamestudio) game engine to make 3d games.and there was something to make timing in while function it was like this:
Code:
while(1)
{
.........
wait(1);
}
wait(time) function was setting the how much waits to run next function.
but there is nothing something like wait() in python.isn't making apps. slow?

sorry for my english
Reply With Quote

#4 Old Re: How to fade between to sound? - 2008-10-02, 13:24

Join Date: Feb 2008
Posts: 2,542
Location: Bhavnagar, Gujarat, India
Send a message via Yahoo to gaba88 Send a message via Skype™ to gaba88
gaba88's Avatar
gaba88
Offline
Forum Nokia Champion
hi
i am not sure but i think this article on timers will help you a bit.

EDIT: Have a look at the e32 module there are functions like ao_sleep which can help you more.

Enjoy Pythoning
Gaba88


Gargi Das- http://gargidas.blogsot.com

Forum Nokia Python Wiki


Learn Python at http://mobapps.org/PyS60
Reply With Quote

#5 Old Thumbs up Re: How to fade between to sound? - 2008-10-02, 13:25

Join Date: May 2007
Posts: 2,738
Location: 21.46 N 72.11 E
croozeus's Avatar
croozeus
Offline
Forum Nokia Champion
Quote:
Originally Posted by McLightning34 View Post
wait(time) function was setting the how much waits to run next function.
but there is nothing something like wait() in python.isn't making apps. slow?
There is a wait statement.

Code:
import e32
while True:
    e32.ao_sleep(5)
    print "Hello"
The above code in loop waits for 5 seconds before printing.

Hope that helps,

Best Regards,
Croozeus
Reply With Quote

#6 Old Thumbs up Re: How to fade between to sound? - 2008-10-02, 13:29

Join Date: Sep 2008
Posts: 35
McLightning34
Offline
Registered User
Quote:
Originally Posted by croozeus View Post
There is a wait statement.

Code:
import e32
while True:
    e32.ao_sleep(5)
    print "Hello"
The above code in loop waits for 5 seconds before printing.

Hope that helps,

Best Regards,
Croozeus
thank u very much

Quote:
Originally Posted by gaba88 View Post
hi
i am not sure but i think this article on timers will help you a bit.

EDIT: Have a look at the e32 module there are functions like ao_sleep which can help you more.

Enjoy Pythoning
Gaba88
thank u very much too
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
Problem with Sound class getState() creepymo Mobile Java Media (Graphics & Sounds) 1 2005-06-20 19:43
MIDI Sound problem (J2ME / Series 60) JPapke Mobile Java Media (Graphics & Sounds) 2 2004-10-29 09:17
Sound in Midp 2.0 stalls astraton2001 Mobile Java Media (Graphics & Sounds) 4 2004-03-25 07:58
sound bug (possibly) on 6610 alex_crowther Mobile Java Media (Graphics & Sounds) 2 2004-02-05 12:44
Nokia Smart Expert - solve this sound problem tsoh_tan Mobile Java Media (Graphics & Sounds) 0 2003-10-30 05:36

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