Change volume of wav music?

Non-platform specific questions.

Change volume of wav music?

Postby HitoV » Tue Sep 20, 2011 11:13 pm

Hello there! I was wondering if there is anyway you can change the volume of a .wav file played via playmusic2. I have found that using smaller wave files gives me about a 20% fps increase but unfortunately doing so has created the above problem. I have events where the music volume needs to be ducked and since switching to the wav file it has ignored them. I ran some test and verified that it was the wav file. The ogg file works fine.

musicvol has no effect on the wav and neither does the setVolume(music, .1); method. I know its targeting the right file because stopSound(music) works. Are there any other options I have to try to make this work?
HitoV
 
Posts: 48
Joined: Sat Aug 27, 2011 8:22 am
Score: 3 Give a positive score

Re: Change volume of wav music?

Postby skydereign » Wed Sep 21, 2011 1:05 am

Well, PlaySound2 has a volume setting. So can't you just decrease that?
User avatar
skydereign
 
Posts: 3510
Joined: Mon Jul 28, 2008 8:29 am
Score: 589 Give a positive score

Re: Change volume of wav music?

Postby HitoV » Wed Sep 21, 2011 3:12 am

Yep, that works so far so good. Have to rewrite some code though to really test it in the proper context, I'll report back after then! Thanks man!
HitoV
 
Posts: 48
Joined: Sat Aug 27, 2011 8:22 am
Score: 3 Give a positive score

Re: Change volume of wav music?

Postby HitoV » Wed Sep 21, 2011 3:56 am

It works but it does cause many problems. Is there no other way to change music volume without restarting the song?
HitoV
 
Posts: 48
Joined: Sat Aug 27, 2011 8:22 am
Score: 3 Give a positive score

Re: Change volume of wav music?

Postby skydereign » Wed Sep 21, 2011 5:15 am

musicvol usually works to change the volume, and so does setVolume. I'll test it out to see if I can get the same results. But can you upload the .wav you are using?
User avatar
skydereign
 
Posts: 3510
Joined: Mon Jul 28, 2008 8:29 am
Score: 589 Give a positive score

Re: Change volume of wav music?

Postby HitoV » Wed Sep 21, 2011 6:33 am

That would be great! I spent about half an hour trying to make it work but it just breaks too many things so I decided to revert back.

Here is the wav file Im using, its 22khz stereo...

Tried the java upload but it doesn't really say anything so if that doesn't work use this link.
http://issacv.fuzavue.com/seqtest.wav
HitoV
 
Posts: 48
Joined: Sat Aug 27, 2011 8:22 am
Score: 3 Give a positive score

Re: Change volume of wav music?

Postby sonicfire » Wed Sep 21, 2011 8:11 am

EDIT: if the ogg file works fine, why dont you just convert the "problematic" wav file to ogg as well?
sonicfire
 
Posts: 425
Joined: Wed Nov 01, 2006 9:34 pm
Location: berlin germany
Score: 16 Give a positive score

Re: Change volume of wav music?

Postby sonicfire » Wed Sep 21, 2011 8:35 am

I just tried volume changing with your WAV file and it works without problems :?

Have a look here:
http://www.speedyshare.com/files/30410346/musicDuck.rar

Click the Pacman to toggle music ducking
sonicfire
 
Posts: 425
Joined: Wed Nov 01, 2006 9:34 pm
Location: berlin germany
Score: 16 Give a positive score

Re: Change volume of wav music?

Postby HitoV » Wed Sep 21, 2011 11:39 am

Hi Sonicfire! I just tried your code and it does work!!! Thanks, I will try and figure out why mine didn't tomorrow. Appreciate the help big time!

I'd much rather use the wav over the ogg because decoding the ogg eats up quite a bit of the iPhones cpu. And for my particular game its the difference between a choppy 25 fps and a smooth 30.
HitoV
 
Posts: 48
Joined: Sat Aug 27, 2011 8:22 am
Score: 3 Give a positive score

Re: Change volume of wav music?

Postby HitoV » Wed Sep 21, 2011 12:07 pm

Gah! Beat my brains out for a while, I imported it verbatim and it did not work, after some tinkering I just about gave up... but then I found the problem! Apparently it only works if the sound is in 44khz. My project is set at 22khz since I found 44khz a little unstable (as far as playing larger music wavs.) I'll try again tomorrow in 44khz to see if maybe it was some random crash before or not. Thanks again man! Its good progress at least!
HitoV
 
Posts: 48
Joined: Sat Aug 27, 2011 8:22 am
Score: 3 Give a positive score


Return to General

Who is online

Users browsing this forum: No registered users and 1 guest