How To Play Audio Between Levels | Music Across Level Transitions - Unreal Engine 4 Tutorial

  Рет қаралды 25,725

Matt Aspland

Matt Aspland

Күн бұрын

Пікірлер: 119
@Mikerulez101
@Mikerulez101 Жыл бұрын
For those of you who are reloading the level (upon a death state, for example), all you have to do in order to stop the music playing multiple times is create a Sound Concurrency, set the Max Count to 1, and the Resolution Rule to "Prevent New". Then change the Concurrency Settings on a SPAWN Sound 2D in your MyGameInstance to that Sound Concurrency you created. You can even drag Concurrency Settings to the function to make it a modifiable attribute in your level blueprint. Create & promote a boolean variable called PlayingSound? (default: 0) and set it to 1 at the end of the function. Then create a branch with that variable as the condition and connect the False end to your Spawn Sound 2D.
@BrandenSokolowski
@BrandenSokolowski Жыл бұрын
please help me i tried following what you put but im lost. You are the only comment that talked about this. Are you able to explain in more detail please. Im not sure how to link concurrency and the sound. what sound node do i use. The begin audio thing. Thanks
@RetroidsMusic
@RetroidsMusic Жыл бұрын
THANKYOU
@LpAntorax
@LpAntorax 11 ай бұрын
I think i did it like you wrote, but it doesnnrk unfortunately... :( It Still plays another Song from start.
@HDbacon
@HDbacon 10 ай бұрын
Big thanks bro
@HDbacon
@HDbacon 10 ай бұрын
@@LpAntorax It's a little confusing but basically create a Sound concurrency (call it anything you'll remember it by) double click on it and change the settings and on option 1 change to 1 then on option 3 select prevent new. Hit save (floppy disc icon). Then go over to your blueprint of your game instance that you made and plug in Concurrency settings into the play audio function (where you should have sound, volume, persist if you followed the video the exact way) then save and compile. Now go to the level you have the audio start, and open its Level BP. Now the play audio should have the concurrency settings there, select your Sound concurrency that you made, save and compile and it should work.
@primitivepatterns
@primitivepatterns 3 жыл бұрын
slowly you are helping me make my entire game :)
@MattAspland
@MattAspland 3 жыл бұрын
Happy to help where I can. All the best to you :)
@virusocyrus
@virusocyrus 3 жыл бұрын
Ikr
@LoregamingstudiosOfficial
@LoregamingstudiosOfficial 3 жыл бұрын
Same here
@apolloslickfm
@apolloslickfm 2 жыл бұрын
same here man
@memecat7551
@memecat7551 2 жыл бұрын
same
@quanthis5130
@quanthis5130 2 жыл бұрын
Wow I think the first one tutorial of UE4 that actually shows answer to the question in the title, thanks!
@AnonymusPlayerHD
@AnonymusPlayerHD 3 жыл бұрын
Hey, very good video! I'm running through an issue though. everytime a go back to my MainMenu Level, the music overrides itself and it gets all messy with multiple tracks playing. Ive tried add a DoOnce befor the nod but it was pointless. Can you help with this?
@jaxonbmx2699
@jaxonbmx2699 3 жыл бұрын
same
@MrWoodenSheep
@MrWoodenSheep 2 жыл бұрын
I solved this by putting a branch node within the function, right when it starts. Made a boolean variable called "MusicIsPlaying", and set it by default to off. At the branch, I check if Music is Playing. SInce the game just launched, it is not, so it goes to false, which then goes on to the Create Sound 2D node. At the end of the entire thing, after the final "Play" node, I set the MusicIsPlaying variable to be true, since music is now playing. Hope this helps you, or anyone else in the future!
@monster6236
@monster6236 2 жыл бұрын
@@MrWoodenSheep Legend
@Vector8kGaming
@Vector8kGaming 2 жыл бұрын
I just made a Sound Concurrency, set the 'Max Count' to '1', and set the 'Resolution Rule' to 'Stop Lowest Priority'. Plug that into your Create Sound 2D node under Concurrency Settings. When you go into the main menu from your level, the music on your main menu will take priority and play, thus stopping the audio from your level because it is no longer loaded, and has become low priority. I found this solution a lot easier than messing with the true and false statements.
@skememan
@skememan 2 жыл бұрын
@@Vector8kGaming You hero
@stevenwynn819
@stevenwynn819 3 жыл бұрын
Love the game instance. I've never used it to play music between levels, so thank for teaching me something new. Cheers, Matt!
@MattAspland
@MattAspland 3 жыл бұрын
No problem Steve! Always learning something new everyday! The game instance is a great blueprint to use if you want to keep something persistent across level changes, for example the player health. All the best mate :)
@scottlee38
@scottlee38 3 жыл бұрын
Very nice touch!
@MattAspland
@MattAspland 3 жыл бұрын
Thanks a lot Scott!
@not_vdb0059
@not_vdb0059 3 жыл бұрын
hi can you maybe explain in your next video how you can save graphics settings
@LyoshaLozhkin
@LyoshaLozhkin 3 жыл бұрын
Great lesson! Is there a lesson on how to properly organize music, so that in the menu played one music, when you call the widget, played another music, and when you enter the level, played a third music?
@StevenDiLeo
@StevenDiLeo 2 жыл бұрын
Great stuff, thanks Matt!
@lucycutie0195
@lucycutie0195 3 жыл бұрын
Could you do a tutorial on how to have a smooth transitions between levels/maps? I catn find any good information about it, it would help big time!
@umutcoskun5215
@umutcoskun5215 2 жыл бұрын
Thank you ! Worked like a charm!
@luckyjulian
@luckyjulian 6 ай бұрын
How can I stop the music again? I dont whant it to play in every Level.
@hunterstringer5495
@hunterstringer5495 3 жыл бұрын
Would you be able to do a video on how to make advanced foot/leg placements so there's a more realistic look when the character is on on slopes, stairs or small height changes
@Grand-warden
@Grand-warden 3 жыл бұрын
Wow😱
@branskylar
@branskylar 5 ай бұрын
How would I do this with a Wwsie-UE4 integration?
@visceralerror
@visceralerror 2 жыл бұрын
wow thanks for this video ! 🙌
@masterability1385
@masterability1385 2 жыл бұрын
What if I dont want my music to persist ? Like completeky starting a new music when my level is loaded.
@KensireGames
@KensireGames 5 ай бұрын
How do you stop it
@frustrationendz3890
@frustrationendz3890 3 жыл бұрын
Plz make a tutorial on level unlocking
@サイコ-e3t
@サイコ-e3t 2 жыл бұрын
hi, love the tutorial, but i got problem when i get back to the menu after i finish my game, the sound goes double, can you tell me how to fix it?
@justindavis2711
@justindavis2711 2 жыл бұрын
I followed this tutorial perfectly and it didnt work. Music stops playing the moment the level changes. Maybe my engine is bugged? 4.20
@raktimjs
@raktimjs 3 жыл бұрын
Sir, I'm not able to trim anim montages. What shall I do???
@sagescott4588
@sagescott4588 3 жыл бұрын
How do I make it play persistent with specific maps?! D:
@luchiatton1115
@luchiatton1115 2 жыл бұрын
It doesn't work.. the music doesn't start at all
@ZXQ07
@ZXQ07 3 жыл бұрын
Hi Matt can you make a tutorial for smooth movement (realistic) for third person shooter?
@MattAspland
@MattAspland 3 жыл бұрын
Hey mate, I can look into that for sure. I have videos on directional movement and turn in place, they might also be helpful for you :) Directional Movement: kzbin.info/www/bejne/hYS6iWasesyFmac Turn In Place: kzbin.info/www/bejne/aau5mWRjad-gr5Y
@ZXQ07
@ZXQ07 3 жыл бұрын
@@MattAspland hi i m sorry it’s my fault I didn’t explain right i mean smooth transition between animation
@MattAspland
@MattAspland 3 жыл бұрын
Ah right okay, no worries mate. I can look into that too yeah :) Quick tip in the meantime, if you are using a blendspace, you can increase the "Target Weight Interpolation Speed Per Sec". I find that values between 5 and 10 work best for me.
@ZXQ07
@ZXQ07 3 жыл бұрын
@@MattAspland ok I will look in to that, thanks matt keep it going😘
@toskatoska8232
@toskatoska8232 Жыл бұрын
If someone came up with how to stop this kind of audio please help.
@quinnpriest9587
@quinnpriest9587 3 жыл бұрын
how to you loop the audio for when the track ends
@candymangames5022
@candymangames5022 3 жыл бұрын
If the audio you are using is a WAV then right click and create a cue with it. Open the new cue you made and look for a small tick box that says loop. Tick it. Then in the Blue print for the level where Matt calls on the audio function we made instead of using the wav audio you originally used , use the new cue you made and you should be golden. I just Did this and it works .
@reeanimationgaming1034
@reeanimationgaming1034 3 жыл бұрын
Dude.. What are the odds that I was looking into this yesterday? 😁 this is fantastic. Thank you... Now. I have a shop in the level, where the player can buy items. How do I play a different music when I enter the shop? The shop is in the level, NOT it’s own level.. Basically, how do I chance music in the level while playing? Any ideas?
@itsxfields420x4
@itsxfields420x4 3 жыл бұрын
That's where sound at location would come in handy I believe
@reeanimationgaming1034
@reeanimationgaming1034 3 жыл бұрын
@@itsxfields420x4 I’m talking about changing the music track when entering a specific area in the level
@itsxfields420x4
@itsxfields420x4 3 жыл бұрын
@@reeanimationgaming1034 🤔🤔 I think you could use a box collision in your shop. And when your character begins to overlap it would stop the menu music and switch to your shop music.
@itsxfields420x4
@itsxfields420x4 3 жыл бұрын
@@reeanimationgaming1034 also there is more than likely 10 and 1 different ways to approach what you want to do.
@reeanimationgaming1034
@reeanimationgaming1034 3 жыл бұрын
@@itsxfields420x4 not a bad idea, if there’s something called stop music in unreal..? I will have a look, thanks 👌
@bkm1104
@bkm1104 3 жыл бұрын
Good
@joker-jd3jd
@joker-jd3jd 3 жыл бұрын
Pls android pacaging
@MattAspland
@MattAspland 3 жыл бұрын
I can add it to my list
@joker-jd3jd
@joker-jd3jd 3 жыл бұрын
Thank you
@Dazz-tb6xd
@Dazz-tb6xd 3 жыл бұрын
How would you change the music between level transitions? I thought that's what this tutorial was:(
@sc2sc286
@sc2sc286 Жыл бұрын
c++ void UYourGameInstance::PlayMusic(float MusicVolumeMultiplier ,USoundBase* Sound) { USoundConcurrency* ConcurrencySettings = NewObject(); //Sets up ConcurrencySettings to pass into CreateSound2D MusicComponent = UGameplayStatics::CreateSound2D(GetWorld(), Sound, MusicVolume * MusicVolumeMultiplier, 1, 0, ConcurrencySettings, true, true); //Creates the 2D sound component MusicComponent->Play();//Plays the sound }
@iansmith3301
@iansmith3301 2 жыл бұрын
Quitting back to the main menu makes multiple music tracks play at once, you'll need better checking and validations but this is a decent starting point.
@llYuki0okami
@llYuki0okami Жыл бұрын
It works for Sound Wave files, but when I use my Sound Cue with Concatenator node music stops when load another level.. EDIT:when i deleted Loop node from Sound Cue it working but.. not looping the list
@chickishot8172
@chickishot8172 Жыл бұрын
Can you do a tutorial on how to do music zones without using the third person character? Basically when the player enters a certain area of the same map/level the music will change depending on the area of that map. There aren’t many tutorials on this and the one I found uses the third person character BP.
@Сма_йлик
@Сма_йлик 3 жыл бұрын
👍👏👍👏
@dadandme
@dadandme 2 жыл бұрын
Super useful video! At the same time I learned other nice tips such as dragging the connections into the function block to automatically create the inputs. Thanks!
@adammcevoy6505
@adammcevoy6505 2 жыл бұрын
Hi Matt, great explanation. What I'm having trouble with is playing one song for the menu and another for the game level. I'm a noob so followed the official tutorial on adding the option (i.e. main) menu and pause menu to the default first person shooter level, but none of them show you how to include music. I tried to add a Play 2D sound node into the main menu , but the music doesn't play until I choose 'Play the game'. And then, when I click 'Play' in the editor, the main menu is now bypassed and goes straight to the first person view shooter, as you've used in the video :( Any help would be appreciated!
@peli6501
@peli6501 3 жыл бұрын
Great tutorial as usual. Could you make a tutorial series in Behaviour Tree? (If you already did link it plz couldnt find it)
@cursedbishstudio
@cursedbishstudio Жыл бұрын
What about when you want the music to stop :) ? please and it plays 2-3-4 times if you click back to the main menu.
@applejetgg
@applejetgg 3 жыл бұрын
Hey bro can you make a series on how to make game like pubg pc with all it's features like customizable key control, voice chat etc.
@tonystark7776
@tonystark7776 3 жыл бұрын
Go for udemy similar game like pubg couse available
@MattAspland
@MattAspland 3 жыл бұрын
Hey mate, nice idea. I can add it to my list :)
@babagkahing5124
@babagkahing5124 3 жыл бұрын
Hi matt, Can you make level unlocking system please
@programmerxix7129
@programmerxix7129 3 жыл бұрын
Another one❤️ Every time I struggle with motivation at times then I get an update about a new video you’ve uploaded . It always restores my motivation .
@programmerxix7129
@programmerxix7129 3 жыл бұрын
Does it have to be like bit music? “Does the play sound 2D” have anything to do with the type / quality of music?
@TheGhos1Face
@TheGhos1Face 3 жыл бұрын
@@programmerxix7129 no my man it can be any type of music it does not matter
@programmerxix7129
@programmerxix7129 3 жыл бұрын
@@TheGhos1Face appreciate you
@MattAspland
@MattAspland 3 жыл бұрын
That's amazing to hear mate! Thanks for all of your support! :)
@casey_shame
@casey_shame 3 жыл бұрын
@@programmerxix7129 as long as it is a .wav file format you should be okay to add it!
@HDbacon
@HDbacon 10 ай бұрын
TY
@rifat.ahammed
@rifat.ahammed Жыл бұрын
Tricky . Thank you
@dubtube6691
@dubtube6691 Жыл бұрын
thank you !
@abrahamrkj
@abrahamrkj Жыл бұрын
How to stop? :')
@derekadair5320
@derekadair5320 9 ай бұрын
10/10
@rayoseldev819
@rayoseldev819 3 жыл бұрын
How do stop music when you want? And this music is in LOOP?
@mateuszmroz5908
@mateuszmroz5908 5 ай бұрын
Dont work UE5.3 :(
@mateuszmroz5908
@mateuszmroz5908 5 ай бұрын
Restart and work :D THX!
@diontaeshuron3950
@diontaeshuron3950 3 жыл бұрын
How can I add multiple soundtracks and switch between the soundtracks?
@74nz1l
@74nz1l 11 ай бұрын
music lap overs if i open any other ui such as option. pls give a fix of that
@HDbacon
@HDbacon 10 ай бұрын
Create a Sound concurrency (call it anything you'll remember it by) double click on it and change the settings and on option 1 change to 1 then on option 3 select prevent new. Hit save (floppy disc icon). Then go over to your blueprint of your game instance that you made and plug in Concurrency settings into the play audio function (where you should have sound, volume, persist if you followed the video the exact way) then save and compile. Now go to the level you have the audio start, and open its Level BP. Now the play audio should have the concurrency settings there, select your Sound concurrency that you made, save and compile and it should work.
@lisab7647
@lisab7647 3 жыл бұрын
what do i do if i want to play two audio cues, both looped? if i set them after each other the first one will always stop playing after a while
@EslamBiker
@EslamBiker 3 жыл бұрын
hello matt , can you post a video how increase fps
@MattAspland
@MattAspland 3 жыл бұрын
Hey mate, I can look into that yeah. I have a few videos on optimisation, for example culling distances and world composition. Hope they can help too :) Foliage Culling: kzbin.info/www/bejne/aqutioWQgM90g6c World Composition: kzbin.info/www/bejne/rpatq2VsgperpJY
@hijinxvr1027
@hijinxvr1027 2 жыл бұрын
Is there a way to adapt this to use a media player playlist instead of just one audio file?
@d3ktYoshy
@d3ktYoshy 2 жыл бұрын
How would i stop it from playing twice when reopening the Main Menu?
@Im_Derivative
@Im_Derivative 3 жыл бұрын
When I return to the menu screen my music doubles up, any idea why?
@TheZoobZoobs
@TheZoobZoobs 2 жыл бұрын
Hey Matt, what if you want to play the audio in only select levels?
@r_e_d_squirrel367
@r_e_d_squirrel367 2 жыл бұрын
another gem. thanks
@realNoobDog
@realNoobDog 3 жыл бұрын
do you make all this alone??? HOW DO YOU KNOW EVERYTHINK can you say me how you learned unreal engine, IT IS to HAAAARD. but i think a bit easier THAN coding. The Main question:: How did you learned all this???
@realNoobDog
@realNoobDog 3 жыл бұрын
And how could a dumb Person Like ME! learn this? I mean everythink with blueprints Not Just Sound. I mean dificult thinks Like blueprinting a Vehicle or a advanced Player or a whole game
@MattAspland
@MattAspland 3 жыл бұрын
Hey mate, I do all of this alone yeah :) The first step is to realise the mistake in what you said. You're not dumb at all, you've got the drive and passion for it, and with that you can do anything. It just takes hard work and dedication, and if you keep at it, you'll keep on improving. More practical methods of learning, are to make sure that when you follow a tutorial, you try and understand what is happening, rather then just copying it. Also, enter game jams. Game jams are a great way to build a lot of knowledge and confidence in a short period of time, they cause you to think outside of the box, learn in a short period, and try to find the most efficient way of doing something. Plus, when I started to learn, I got into Unreal and just messed around with the nodes. So I saw what everything did and how they all worked with each other, getting a basic knowledge of the different nodes really helps you to create more advanced systems, or come up with solutions to your problems. You've got this mate, you can 100% learn more and keep improving. I wish you all the best of luck on your journey! :)
@realNoobDog
@realNoobDog 3 жыл бұрын
@@MattAspland so i tried a bit on myself and i will say what i do and with what i need a bit help: i have a float names health normal its 100, i want that the health is 0 , the boolean 'Death' get a yes. but i dont know how it didnt worked=( thats my issue short: i want that the float tick the box of the boolean, but how?
@MattAspland
@MattAspland 3 жыл бұрын
@@realNoobDog Hey, you could come out of the return value of the float, and get an "==" node, which goes into the "condition" of a "branch". Out of true of this branch, set the Boolean to be true. That way, if the health is equal to 0, the Boolean will be set to true. I actually set this up in today's video for my animal AI :) kzbin.info/www/bejne/mF6adWV9ga6mbsU
@realNoobDog
@realNoobDog 3 жыл бұрын
@@MattAspland Thanks so helpfull!
@thatdudewithfacts
@thatdudewithfacts 3 жыл бұрын
can you please show us how to make the 4.26 water plug in rivers swimable?
@MattAspland
@MattAspland 3 жыл бұрын
I can look into that :)
@thatdudewithfacts
@thatdudewithfacts 3 жыл бұрын
@@MattAspland Thank you!! YOU ARE THE BEST
@itsxfields420x4
@itsxfields420x4 3 жыл бұрын
Thanks again for another amazing yet so simple tut!
@MattAspland
@MattAspland 3 жыл бұрын
Thanks so much for all of your support mate!
@itsxfields420x4
@itsxfields420x4 3 жыл бұрын
@@MattAspland you've been great help so keep it up!!