1. Updated Resource Submission Rules: All model & skin resource submissions must now include an in-game screenshot. This is to help speed up the moderation process and to show how the model and/or texture looks like from the in-game camera.
    Dismiss Notice
  2. DID YOU KNOW - That you can unlock new rank icons by posting on the forums or winning contests? Click here to customize your rank or read our User Rank Policy to see a list of ranks that you can unlock. Have you won a contest and still haven't received your rank award? Then please contact the administration.
    Dismiss Notice
  3. Ride into the sunset with the 32nd Modeling Contest.
    Dismiss Notice
  4. This adventure has come to an end. Congratulate our heroes in the 16th Mini Mapping Contest Results.
    Dismiss Notice
  5. From the gates of hell, the 5th Special Effect Contest Results have emerged.
    Dismiss Notice
  6. Race against the odds and Reforge, Don't Refund. The 14th Techtree Contest has begun!
    Dismiss Notice
  7. Check out the Staff job openings thread.
    Dismiss Notice
Dismiss Notice
60,000 passwords have been reset on July 8, 2019. If you cannot login, read this.

Is there a way to play more than 3 same sounds at once?

Discussion in 'World Editor Help Zone' started by Quilnez, Feb 9, 2014.

  1. Quilnez

    Quilnez

    Joined:
    Oct 12, 2011
    Messages:
    3,294
    Resources:
    37
    Icons:
    2
    Tools:
    1
    Maps:
    7
    Spells:
    21
    Tutorials:
    2
    JASS:
    4
    Resources:
    37
    I wonder, is there a way to play a same sound at more than 3 different location and the sound played correctly?

    as example I have a sound variable named S and 10 locations named loc1,...,loc10. I want to play that sound at those locations at the same time, but seems like only one sounds played.. or another case, I played a same sound with 3 seconds duration at one location every 0.05 seconds. The sounds can't be played rapidly. :(

    so the question is, is there a way to solve this?

    answer
    Code (vJASS):
    function PlaySoundAtPoint takes string f, real x, real y returns nothing
        local sound s = CreateSound( f, false, true, true, 10, 10, "" )
        call SetSoundDuration( s, GetSoundFileDuration(f) )
        call SetSoundChannel( s, 0 )
        call SetSoundVolume( s, 127 )
        call SetSoundPitch( s, 1.0 )
        call SetSoundPosition(s, x, y, 0)
        call StartSound(s)
        call KillSoundWhenDone(s)
        set s = null
    endfunction
     
    Last edited: Feb 22, 2014
  2. 759tricker

    759tricker

    Joined:
    Feb 9, 2014
    Messages:
    44
    Resources:
    0
    Resources:
    0
    you want a sound plays when unit enter that location?
    try this..:
    • Location
      • Events
        • Unit - A unit enters Location 1 <gen>
        • Unit - A unit enters Location 2 <gen>
        • Unit - A unit enters Location 3 <gen>
      • Conditions
      • Actions
        • Sound - Play H02DwarfHunter17 <gen>
     
  3. Quilnez

    Quilnez

    Joined:
    Oct 12, 2011
    Messages:
    3,294
    Resources:
    37
    Icons:
    2
    Tools:
    1
    Maps:
    7
    Spells:
    21
    Tutorials:
    2
    JASS:
    4
    Resources:
    37
    hmm.. seems like that's not the solution, it's just another way to test the problem.. :p thnks for trying to help anyway.. :)
     
  4. Daffa

    Daffa

    Joined:
    Jan 30, 2013
    Messages:
    7,941
    Resources:
    29
    Packs:
    1
    Maps:
    8
    Spells:
    18
    Tutorials:
    2
    Resources:
    29
    It's impossible without a little mr hacky game. /Half Sarcasm
    Sounds in Warcraft is restricted to 1 sound at a time, you can play up to 12 different sound for 12 different player (using Local Player), but it's impossible to play more than 1 sound for a player. It's because of WC III machine limits.
     
  5. Quilnez

    Quilnez

    Joined:
    Oct 12, 2011
    Messages:
    3,294
    Resources:
    37
    Icons:
    2
    Tools:
    1
    Maps:
    7
    Spells:
    21
    Tutorials:
    2
    JASS:
    4
    Resources:
    37
    it's not really imposible, but to do that we need to replace one original sound with our imported sound, then we create a no taget spell with that replaced sound on cast.. to increase the volume we can increase the dummy unit fly height, we can play about 4 sounds rapidly using this way.. but what I'm looking for is the way without replacing original sound, which maybe you are right, it's imposible :(
     
  6. Garfield1337

    Garfield1337

    Joined:
    Jul 6, 2009
    Messages:
    1,806
    Resources:
    4
    Maps:
    1
    Spells:
    3
    Resources:
    4
    Just create a sound array and assign it as many sounds as you want (use the same soundfile).
    Have a counter that tracks which sound in the array to play and increase it every time you play a sound. When you reach last sound, reset counter to 0.
    Yeah...no.
     
  7. BPower

    BPower

    Joined:
    Mar 18, 2012
    Messages:
    1,709
    Resources:
    21
    Spells:
    15
    Tutorials:
    1
    JASS:
    5
    Resources:
    21
    You couldn't be more wrong here.

    You need to create as many sounds as you want to play simultaneously.
    If you use a lot of sounds in your map I would recommend to use SoundTools or SoundUtils in order to recycle sounds.
     
  8. Quilnez

    Quilnez

    Joined:
    Oct 12, 2011
    Messages:
    3,294
    Resources:
    37
    Icons:
    2
    Tools:
    1
    Maps:
    7
    Spells:
    21
    Tutorials:
    2
    JASS:
    4
    Resources:
    37
    did you mean import the same song with different name as many as possible? :/
     
  9. DysfunctionaI

    DysfunctionaI

    Joined:
    Mar 6, 2006
    Messages:
    281
    Resources:
    1
    Tutorials:
    1
    Resources:
    1
    No, you just need to create a different instance of the sound for each time you play it. I believe the limit is 4 simultaneous plays per 1 instance of a sound, and you can only play another if 1 instance ends.

    You can use this function to play as many sounds as you want at the same time, because you're creating them on the fly:

    Code (vJASS):
    function PlaySoundAtPoint takes string f, real x, real y returns nothing
        local sound s = CreateSound( f, false, true, true, 10, 10, "" )
        call SetSoundDuration( s, GetSoundFileDuration(f) )
        call SetSoundChannel( s, 0 )
        call SetSoundVolume( s, 127 )
        call SetSoundPitch( s, 1.0 )
        call SetSoundPosition(s, x, y, 0)
        call StartSound(s)
        call KillSoundWhenDone(s)
        set s = null
    endfunction


    Call it with this:

    call PlaySoundAtPoint("Units\\Human\\Peasant\\PeasantReady1.wav", targetx, targety )


    Remember to use double backslashes in the filename.
     
  10. Quilnez

    Quilnez

    Joined:
    Oct 12, 2011
    Messages:
    3,294
    Resources:
    37
    Icons:
    2
    Tools:
    1
    Maps:
    7
    Spells:
    21
    Tutorials:
    2
    JASS:
    4
    Resources:
    37
    are you sure you can play one sound for more than 1 time using that function?
     
  11. DysfunctionaI

    DysfunctionaI

    Joined:
    Mar 6, 2006
    Messages:
    281
    Resources:
    1
    Tutorials:
    1
    Resources:
    1
    Um, I'm almost positive, because that's what I've been told but I've never actually tested it. I'm finding it hard to test, but I swear I'm NOT counting more than 4 simultaneous sounds. I'm playing a long "pissed" wav with a small wait in between each play, so I can hear when each one starts, but it doesn't sound like there's more than 4 at once. Someone else may post on the matter in a bit.

    Also, I'm not sure what SoundTools or SoundUtils does but they're usually suggested for what you're trying to do. I just wanted to show you how it was done, but I may be doing something wrong.
     
  12. BPower

    BPower

    Joined:
    Mar 18, 2012
    Messages:
    1,709
    Resources:
    21
    Spells:
    15
    Tutorials:
    1
    JASS:
    5
    Resources:
    21
    Like for instance TimerUtils for timers or Dummy for dummy units, SoundTools (awesome) and SoundUtils (nearly as awesome) recycle sounds to minimze the need of the CreateSound native.

    Basically the sound is taken from a stack and pushed back into it, once it is finished.
     
  13. Zwiebelchen

    Zwiebelchen

    Joined:
    Sep 17, 2009
    Messages:
    6,826
    Resources:
    12
    Models:
    5
    Maps:
    1
    Spells:
    1
    Tutorials:
    1
    JASS:
    4
    Resources:
    12
    There are certain limitations to sounds in WC3:

    1) You can only play the same sound handle once (I needs to be stopped or finish in order to play it again)
    2) You can only play the same sound file path (when using the same file path with multiple sound handles) once within a certain interval (around 0.1 seconds)
    3) You can play only up to 4 different sound handles with the same sound filepath at the same time - note that 2) still applies so you need to delay them by 0.1 seconds each.
    4) You can only play up to 16 sounds, no matter the handle or filepath in general
     
  14. BPower

    BPower

    Joined:
    Mar 18, 2012
    Messages:
    1,709
    Resources:
    21
    Spells:
    15
    Tutorials:
    1
    JASS:
    5
    Resources:
    21
    Does this also apply for locally played sounds?
    In other words assuming we have two players, can you play 16 or 32 sounds by using GetLocalPlayer?
     
  15. Solu9

    Solu9

    Joined:
    Jan 25, 2011
    Messages:
    2,165
    Resources:
    47
    Models:
    26
    Icons:
    16
    Skins:
    1
    Tools:
    1
    Maps:
    3
    Resources:
    47
    Is it alright if the one sound is played in all regions instead of ten individual sounds?

    If so. Find your sound in the sound editor. Right click it and click "Edit Sound Variable".
    Change the "Max Distance and possibly the "Distance Cutoff" to something huge.
     
  16. Quilnez

    Quilnez

    Joined:
    Oct 12, 2011
    Messages:
    3,294
    Resources:
    37
    Icons:
    2
    Tools:
    1
    Maps:
    7
    Spells:
    21
    Tutorials:
    2
    JASS:
    4
    Resources:
    37
    yeah, it's alright if you, as example, only cast one or more abilities in an exactly same time..
     
  17. Zwiebelchen

    Zwiebelchen

    Joined:
    Sep 17, 2009
    Messages:
    6,826
    Resources:
    12
    Models:
    5
    Maps:
    1
    Spells:
    1
    Tutorials:
    1
    JASS:
    4
    Resources:
    12
    This applies locally. Sounds are not synced anyway.