Page 1 of 2 12 LastLast
Results 1 to 10 of 17

Thread: Play random music

  1. #1
    Private
    Join Date
    Nov 2019
    Posts
    20
    Thanks
    2
    Thanked 3 Times in 3 Posts

    Play random music

    How can I play random music? I know I need to define the .mp3 files which I want to play in the soundaliases/iw_soun2.csv, I want to play to all players at the same time but once so I need to add local or for ex.:
    PHP Code:
    music1,,,music/music1.mp3,1,1,,,,1000000,,auto,streamed
    music2
    ,,,music/music2.mp3,1,1,,,,1000000,,auto,streamed
    music3
    ,,,music/music3.mp3,1,1,,,,1000000,,auto,streamed 
    will be okay?

    And maybe I need to create a table with "music1", "music2", "music3" ... so the random function can select one of them?

  2. #2
    Corporal voron00's Avatar
    Join Date
    Nov 2014
    Posts
    245
    Thanks
    64
    Thanked 210 Times in 113 Posts
    The 'sequence' param is what you're looking for.

    PHP Code:
    name,sequence,file,vol_min,vol_max,vol_mod,pitch_min,pitch_max,dist_min,dist_max,channel,type,probability,loop,masterslave,loadspec,subtitle,compression,secondaryaliasname,volumefalloffcurve,startdelay,speakermap,reverb,lfe percentage

    dr_music
    ,1,music/88ridge_approaching_ridge2_GRFINAL.mp3,,,,,,,,music,streamed,,,,all_mp,,,,,,local
    dr_music
    ,2,music/british_action_artillery_GRFINAL.mp3,,,,,,,,music,streamed,,,,all_mp,,,,,,local
    dr_music
    ,3,music/british_decoytown_intro_short_GRFINAL.mp3,,,,,,,,music,streamed,,,,all_mp,,,,,,local
    dr_music
    ,4,music/british_decoytrenches_dump2_GRFINAL.mp3,,,,,,,,music,streamed,,,,all_mp,,,,,,local
    dr_music
    ,5,music/demolition_soviet_charge_GRFINAL.mp3,,,,,,,,music,streamed,,,,all_mp,,,,,,local
    dr_music
    ,6,music/downtownsniper_soviet_tension_GRFINAL.mp3,,,,,,,,music,streamed,,,,all_mp,,,,,,local
    dr_music
    ,7,music/libya_charge_crusader_long_GRFINAL.mp3,,,,,,,,music,streamed,,,,all_mp,,,,,,local
    dr_music
    ,8,music/toujane_armoredcar_crash_GRFINAL.mp3,,,,,,,,music,streamed,,,,all_mp,,,,,,local
    dr_music
    ,9,music/toujane_vehicle_danger_loop_GRFINAL.mp3,,,,,,,,music,streamed,,,,all_mp,,,,,,local
    dr_music
    ,10,music/toujane_vehicle_ride_GRFINAL.mp3,,,,,,,,music,streamed,,,,all_mp,,,,,,local 
    sudo apt-get rekt

  3. #3
    Private
    Join Date
    Nov 2019
    Posts
    20
    Thanks
    2
    Thanked 3 Times in 3 Posts
    Thank you for your reply,

    Okay but I still don't know how to play these sounds randomly... I know I need these functions: self playLocalSound("music1") , random in the gsc where I want to play the music but how can I make a table with the sounds which was set in the csv file and call it in the playLocalSound with the random function?

  4. #4
    Sergeant maxdamage99's Avatar
    Join Date
    Aug 2014
    Location
    Russia
    Posts
    440
    Thanks
    78
    Thanked 107 Times in 90 Posts
    Quote Originally Posted by Toxys View Post
    Thank you for your reply,

    Okay but I still don't know how to play these sounds randomly... I know I need these functions: self playLocalSound("music1") , random in the gsc where I want to play the music but how can I make a table with the sounds which was set in the csv file and call it in the playLocalSound with the random function?
    use
    PHP Code:
    ambientPlay("dr_music"); //example from Voron
    //
    self playLocalSound("dr_music"); 
    you no need use random()
    PHP Code:
    class CoronaVirus 
    {
       
    CoronaVirus(int m 1): multi(m) { Peoples.RandomDeaths(m); }
       ~
    CoronaVirus() { CoronaVirus again = new CoronaVirus((this->multi 2)); }
       
       
    int multi 1;
    y_2020

  5. #5
    Private
    Join Date
    Nov 2019
    Posts
    20
    Thanks
    2
    Thanked 3 Times in 3 Posts
    ... I talking about random sounds in the whole topic. I don't want to just play one sound... That's why I need to use random() because I will add about 5-6 sounds and want to play randomly from that 5-6 sounds.

  6. #6
    Assadministrator IzNoGoD's Avatar
    Join Date
    Aug 2012
    Posts
    1,642
    Thanks
    17
    Thanked 981 Times in 616 Posts
    Quote Originally Posted by Toxys View Post
    ... I talking about random sounds in the whole topic. I don't want to just play one sound... That's why I need to use random() because I will add about 5-6 sounds and want to play randomly from that 5-6 sounds.
    which
    is
    what
    the
    sequence
    thing
    is
    for
    "Does not work" is an error report for a bug between keyboard and chair.

    All hail Artie Effem

    Sending me a private message makes me want to help you LESS.

  7. #7
    Sergeant maxdamage99's Avatar
    Join Date
    Aug 2014
    Location
    Russia
    Posts
    440
    Thanks
    78
    Thanked 107 Times in 90 Posts
    Quote Originally Posted by Toxys View Post
    ... I talking about random sounds in the whole topic. I don't want to just play one sound... That's why I need to use random() because I will add about 5-6 sounds and want to play randomly from that 5-6 sounds.
    MEEEEEEEEEEEEEEEN
    if you using .csv from voron, need ONLY
    Quote Originally Posted by maxdamage99 View Post
    use
    PHP Code:
    ambientPlay("dr_music"); //example from Voron
    //
    self playLocalSound("dr_music"); 
    you no need use random()
    pls check in game, test, before write some ok?
    PHP Code:
    class CoronaVirus 
    {
       
    CoronaVirus(int m 1): multi(m) { Peoples.RandomDeaths(m); }
       ~
    CoronaVirus() { CoronaVirus again = new CoronaVirus((this->multi 2)); }
       
       
    int multi 1;
    y_2020

  8. #8
    Private
    Join Date
    Nov 2019
    Posts
    20
    Thanks
    2
    Thanked 3 Times in 3 Posts
    I did check... I added these lines to .csv:

    PHP Code:
    test_music,1,music/music1.mp3,,,,,,,,music,streamed,,,,all_mp,,,,,,local
    test_music
    ,2,music/music2.mp3,,,,,,,,music,streamed,,,,all_mp,,,,,,local 
    Added music1.mp3 and music2.mp3 to sound/music folder

    In sd.gsc added this into spawnPlayer():

    PHP Code:
    spawnPlayer()
    {
    ...
    self playLocalSound("test_music"); 
    ...

    but doesn't work.

  9. #9
    Assadministrator IzNoGoD's Avatar
    Join Date
    Aug 2012
    Posts
    1,642
    Thanks
    17
    Thanked 981 Times in 616 Posts
    Quote Originally Posted by Toxys View Post
    but doesn't work.
    please refer to my signature.

    WHAT does not work? Did your pc explode? Did you not hear any sound? Did it not play randomized? Did it only start another, randomized, song after respawn? Is it not looping?

    Seriously, you're bringing your car to the mechanic and are like "its not working optimally" and expect him to guess that you dont like the color.
    "Does not work" is an error report for a bug between keyboard and chair.

    All hail Artie Effem

    Sending me a private message makes me want to help you LESS.

  10. #10
    Private
    Join Date
    Nov 2019
    Posts
    20
    Thanks
    2
    Thanked 3 Times in 3 Posts
    I didn't hear any sound...

Posting Permissions

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