• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

Changing the pitch of a sound

Status
Not open for further replies.
Level 8
Joined
Aug 21, 2009
Messages
408
ey guys.. Im making a racing map, and i want to change the pitch of the sound to the speed of the vehicle. NOTE: In my game i use mana as a speedometer and i move the unit 1/10th of the mana they have.. So if you have 500 mana they instantly move 50. All the movement systems work fine and laggless, but when i try to change the pitch This doesn't work:
-Change pitch of *sound* to (percentage mana of "vehicle")
That didn't work so i tried this:
-Change pitch of *sound* to (mana of "vehicle" / 800)
I divided by 800 because it has 800 mana, meaning 800 / 800 is 1... so the pitch should be 1.00 right???
 
Level 8
Joined
Jun 26, 2010
Messages
530
Carefull here. There's mana and max mana. Idk, you are changing the pitch after or before the sound is played? Try the inverse.
 
Level 8
Joined
Aug 21, 2009
Messages
408
I tried different ways to get the pitch to work: You need to remember pitch is based like [1.0 is the normal pitch], therefore i need to divide the amount of mana by 700 --- (they have 800 mana, and i divide by seven hundred so it can give me above 1.0)
  • Time - Every 0.50 seconds of game time
  • Sound - Play SteamTankMovement50 <gen>
  • Set engine[1] = (Last played sound)
  • Set sound[1] = ((Mana of Siege Engine 0000 <gen>) / 700.00)
  • Sound - Set pitch of engine[1] to sound[1]
Note: The variable 'Engine' is the SteamTankMovement sound
The variable 'Sound' is a real value

Also This didn't work:
  • Sound - Play SteamTankMovement50 <gen>
  • Set engine[1] = (Last played sound)
  • Sound - Set pitch of engine[1] to ((Mana of Siege Engine 0000 <gen>) / 700.00)
Nor did this work:
  • Sound - Play SteamTankMovement50 <gen>
  • Set engine[1] = (Last played sound)
  • Sound - Set pitch of engine[1] to (Percentage mana of Siege Engine 0000 <gen>)
 
Level 8
Joined
Aug 21, 2009
Messages
408
Did you tried changing the pitch before playing the sound?:bored:

Nope... The sound didn't play at all... Heres the script i used:
  • Time - Every 0.50 seconds of game time
  • For each (Integer A) from 1 to player_Number, do (Actions)
    • Loop - Actions
      • Sound - Stop sound[(Integer A)] After fading
      • Sound - Set pitch of sound[(Integer A)] to ((Percentage mana of race_car[(Integer A)]) / 800.00)
      • Sound - Play SteamTankMovement <gen> at 100.00% volume, located at (Position of race_car[(Integer A)]) with Z offset 0.00
      • Set sound[(Integer A)] = (Last played sound)
If theres a mistake with the Integer A stuff, let me know...
Note: The very first command: (For each [integer A] from 1 to Player Number) - Player_Number is the number of players in the game.. I use this Player_Number multiple times in the game so it is not at fault.


EDIT: This is the system im using right now, All the sounds that i play have different pitch and volume, steamTankMovement01 being the lowest volume/pitch and 08 being the highest: (all the sounds loop)

  • Time - Every 0.80 seconds of game time
  • For each (Integer A) from 1 to player_Number, do (Actions)
    • Loop - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Mana of race_car[(Integer A)]) Less than or equal to 100.00
        • Then - Actions
          • Sound - Stop sound[(Integer A)] After fading
          • Sound - Play SteamTankMovement01 <gen> at 100.00% volume, located at (Position of race_car[(Integer A)]) with Z offset 0.00
          • Set sound[(Integer A)] = (Last played sound)
        • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Mana of race_car[(Integer A)]) Less than or equal to 200.00
              • (Mana of race_car[(Integer A)]) Greater than or equal to 101.00
            • Then - Actions
              • Sound - Stop sound[(Integer A)] After fading
              • Sound - Play SteamTankMovement02 <gen> at 100.00% volume, located at (Position of race_car[(Integer A)]) with Z offset 0.00
              • Set sound[(Integer A)] = (Last played sound)
            • Else - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Mana of race_car[(Integer A)]) Less than or equal to 300.00
                  • (Mana of race_car[(Integer A)]) Greater than or equal to 201.00
                • Then - Actions
                  • Sound - Stop sound[(Integer A)] After fading
                  • Sound - Play SteamTankMovement03 <gen> at 100.00% volume, located at (Position of race_car[(Integer A)]) with Z offset 0.00
                  • Set sound[(Integer A)] = (Last played sound)
                • Else - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • (Mana of race_car[(Integer A)]) Less than or equal to 400.00
                      • (Mana of race_car[(Integer A)]) Greater than or equal to 301.00
                    • Then - Actions
                      • Sound - Stop sound[(Integer A)] After fading
                      • Sound - Play SteamTankMovement04 <gen> at 100.00% volume, located at (Position of race_car[(Integer A)]) with Z offset 0.00
                      • Set sound[(Integer A)] = (Last played sound)
                    • Else - Actions
                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                        • If - Conditions
                          • (Mana of race_car[(Integer A)]) Less than or equal to 500.00
                          • (Mana of race_car[(Integer A)]) Greater than or equal to 401.00
                        • Then - Actions
                          • Sound - Stop sound[(Integer A)] After fading
                          • Sound - Play SteamTankMovement05 <gen> at 100.00% volume, located at (Position of race_car[(Integer A)]) with Z offset 0.00
                          • Set sound[(Integer A)] = (Last played sound)
                        • Else - Actions
                          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                            • If - Conditions
                              • (Mana of race_car[(Integer A)]) Less than or equal to 600.00
                              • (Mana of race_car[(Integer A)]) Greater than or equal to 501.00
                            • Then - Actions
                              • Sound - Stop sound[(Integer A)] After fading
                              • Sound - Play SteamTankMovement06 <gen> at 100.00% volume, located at (Position of race_car[(Integer A)]) with Z offset 0.00
                              • Set sound[(Integer A)] = (Last played sound)
                            • Else - Actions
                              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                • If - Conditions
                                  • (Mana of race_car[(Integer A)]) Less than or equal to 700.00
                                  • (Mana of race_car[(Integer A)]) Greater than or equal to 601.00
                                • Then - Actions
                                  • Sound - Stop sound[(Integer A)] After fading
                                  • Sound - Play SteamTankMovement07 <gen> at 100.00% volume, located at (Position of race_car[(Integer A)]) with Z offset 0.00
                                  • Set sound[(Integer A)] = (Last played sound)
                                • Else - Actions
                                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                    • If - Conditions
                                      • (Mana of race_car[(Integer A)]) Greater than or equal to 701.00
                                    • Then - Actions
                                      • Sound - Stop sound[(Integer A)] After fading
                                      • Sound - Play SteamTankMovement08 <gen> at 100.00% volume, located at (Position of race_car[(Integer A)]) with Z offset 0.00
                                      • Set sound[(Integer A)] = (Last played sound)
                                    • Else - Actions
 
Last edited:
Level 8
Joined
Jun 26, 2010
Messages
530
Why are you using set variable in the end? Shouldn't it be in the beggining where you set it to a sound variable? (the ones you "use as sound" in the sound editor). Also, i would separate those if-then-else.

EDIT: All right, i did some testing. Looks like anytime i set the pitch to a real (i used 1, 1.10, 1.20, 1.30 and so on) the sound just stoped playing. But, when i used integers it just worked. Also, it didn't sounded much good ;x hahaha
 
Last edited:
Level 8
Joined
Aug 21, 2009
Messages
408
Why are you using set variable in the end? Shouldn't it be in the beggining where you set it to a sound variable? (the ones you "use as sound" in the sound editor). Also, i would separate those if-then-else.

EDIT: All right, i did some testing. Looks like anytime i set the pitch to a real (i used 1, 1.10, 1.20, 1.30 and so on) the sound just stoped playing. But, when i used integers it just worked. Also, it didn't sounded much good ;x hahaha

Hmmm alright, thanks il probably just fix the long trigger above and use that. Thanks anyways
 
Level 8
Joined
Jun 26, 2010
Messages
530
The Blizzard racing map "Azeroth Grandprix" uses a system just like this to increase the pitch of the engines when moving faster. Perhaps you could salvage out the relevant parts from there?

I tought you already did it, i mean, who doesn't know Azeroth Grandprix? ;o
About the engine not sounding too good maybe instead of using pitchs you can edit the sounds with a good software (there are good free ones out there) and import them.
 
Level 8
Joined
Aug 21, 2009
Messages
408
I tought you already did it, i mean, who doesn't know Azeroth Grandprix? ;o
About the engine not sounding too good maybe instead of using pitchs you can edit the sounds with a good software (there are good free ones out there) and import them.

Another good idea, since azeroth whatever it its uses jass for the sound.. Hmm too bad, il see what programs are out there to change sounds and stuff. Thanks guys +Rep..

EDIT: Already game you rep, cant do it again :S
 
Status
Not open for further replies.
Top