How do I add background music?

  • I really need background music, sound effects too!

  • Armouredank

    Insert New Object > "Media" Audio

    In your project folder on the right > Musicfolder or Soundsfolder you can import Sounds

  • I already imported sounds. But its not playing.

  • I already imported sounds. But its not playing.

    Event sheet.. on start layout > play : your song name

  • I really need background music, sound effects too!

    By the way, this may be early but put your music in the sound folder as well.

    Intel XDK has a trouble of detecting anything in the music folder so all sounds in the music folder will not be played on a real device when you export the game.

  • after you have inserted Audio Plugin

    then

    on start of the layout >>>

    sub event

    if "BG_Music" is not playing > play "BG Music"

    Note:

    1) is not playing can be done by inverting the condition >> is playing

    2) purpose for doing in sub event is, if we do only >> on start of the layout >> play "BG Music" >> This will play your music every restart of other layout and your "BG music" will play more than 1 time , depend on how many time you restart layout

  • after you have inserted Audio Plugin

    then

    >>>>>>>>>>>

    on start of the layout >>>

    sub event

    if "BG_Music" is not playing > play "BG Music"

    >>>>>>>>>>>

    Note: is not playing can be done by inverting the condition >> is playing

    This is neat, I always used "on start of layout -> Play X" but it didnt always work, thanks

  • Inverting? how does that work?

  • Wait a second. Is it because my sounds are mp3s?

  • It works fine for me

    on start of the layout when "BG Music" is not playing than action will be fired and "BG Music" will play

    after that on every start of the layout when "BG Music" is already playing than their is not action to be fired

    So "BG Music" will play continuously

    If you do not invert it every restart it wil play "BG Music" and "BG Music" will be playing twice, thrice at a single time

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Wait a second. Is it because my sounds are mp3s?

    DO NOT USE MP3s IN YOUR PROJECT

    Why ?

    read this blog Why you shouldn't use MP3 in your HTML5 games

  • Armouredank: Yes, it is likely not working because your sounds are MP3.

    As you can see in the manual article about the audio object, sound format is supposed to be ogg and m4a.

    Depending on your OS the conversion can be automatic, but MP3 is such a legal mess (read 1, 2, read about the HTML5 audio formats : 1, 2) that it was not recommended by Scirra.

    Moreover, prefer importing music into the "Music" folder, not the "Sound" folder unless you know what you are doing (which, no offence, doesn't look like the case at the moment). Again, please refer to the manual (this article in this case).

    Inverting is done by right-clicking a condition and selecting "Invert" in the appearing contextual menu.

  • can you send a pic of your code?

  • can you send a pic of your code?

    Image

  • How to add instrumental (back music):

    1- Go in the Event sheet

    2- Click "Add event"

    3- Click "System"

    4- Under "Start & end" choose "On start of layout"

    5- Click "Audio"

    6- In the Add Action box that appears, under General click "Play"

    7- In the "Parameters for Audio: Play" box that appears, choose the file in the Audio file drop-down menu.

    8- in the "Loop" drop-down menu choose "Looping"

    9- Click the "Done" button.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)