Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

How to mute/lower sound in Media Player

Ok, a lot of people seem to have the problem of NOT playing sound, I have the opposite problem:

In my scene I have a number of TVs playing a video; I want them to be muted, until the player triggers something and the audio starts again. How can I do that?

I'm guessing the sound mix could be of some use, but I don't get how to combine it in my blueprints.

Product Version: UE 4.10
more ▼

asked Feb 17 '16 at 10:50 AM in Blueprint Scripting

avatar image

200 16 15 23

avatar image Narghile Feb 17 '16 at 11:11 AM

There are multiple Sound nodes you can use, which one are you using?


avatar image ocramot Feb 17 '16 at 11:45 AM

That's the point - I'm not using Sound nodes, I'm using a MediaPlayer object, which reproduces a movie in .mp4 formtat - with both audio and video parts. The TV is a Blueprint and it's using the MovieTexture, but I don't know how to handle the sound, there.

avatar image gmpreussner STAFF Feb 17 '16 at 07:15 PM

Create a MediaSoundWave from the MediaPlayer. You can use that asset just like any other sound node.

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

2 answers: sort voted first

Hey ocramot,

I'm not hugely knowledgeable about the media player specifically (gmpreussner is currently the expert) but I can help you with general mixing.

The sound that you are playing with the media player is a USoundWave type which has all the power of other audio, including sound classes and sound mixes.

Unfortunately, the UE4 mix system isn't well documented (I'm working on getting that documented!) but briefly, the way it works is:

  • 1) Create a sound class that you want to play your media sound waves with (or any sound wave)

  • 2) Set whatever default volumes you want with the sound class

  • 3) Make sure to add this new sound class as the sound class field of the sound waves you want to affect with it.

  • 4) Create a sound mix (USoundMix) object with the volume of the sound class you want to set to 0 in the "sound class adjustment" list of the sound mix

  • 5) When you want to mute the mix of the sound classes based on gameplay, from BP, use the function PushSoundMixModifier and pass in the sound mix you want to add to the mix.

  • 6) When you want to remove the muting mix, just call PopSoundMixModifier with the soundmix.

Some cool things about the mix system is that you can have any number of sound mixes at the same time and their sound-class adjustments "mix" together in the way you'd expect. You can also have sound mixes trigger automatically based on volume thresholds in a sound class (sort of like a ducking system).

more ▼

answered Feb 17 '16 at 09:20 PM

avatar image

Minus_Kelvin STAFF
932 23 5 31

avatar image ocramot Feb 26 '16 at 02:33 PM

Thank you! I suppose you're talking about C++ coding, and I'm doing a Bluprints-only project at the time (and I'm also a noob at C++ programming in UE4). Anyway I'll try to implement your solution ASAP

avatar image Minus_Kelvin STAFF Feb 27 '16 at 01:16 AM

No, this is all BP. PushSoundMixModifier is a BP function, so is PopSoundMixModifier. To create a sound mix, it's in the sound context menu (like SoundCue, etc). It's all BP.

avatar image localstarlight Mar 28 '16 at 09:24 PM

Hey MinusKelvin,

I'm also trying to figure out how to adjust/mute the volume of a Media Player. I'm trying to follow your steps above, but have gotten stuck.

I cannot figure out how to do step (3) – how do you add a sound class to a media player? In the graph of the sound class itself there doesn't seem to be a way to link it up to specific variables (only create an hierarchy of sound classes) and I can't seem to even bring a sound class as a variable into another blueprint and link it up that way.

So I have a UMG widget that contains my video player. Inside that I have my Media Player, which I am controlling playback for, and within which I want to be able to control the volume. What do I need to do to assign this Media Player a sound class which I can then affect by popping/pushing mix modifiers?

Thanks for any help!

avatar image Minus_Kelvin STAFF Mar 29 '16 at 10:03 PM

Hey man, a media sound wave generated from the media player (check out https://docs.unrealengine.com/latest/INT/Engine/MediaFramework/index.html if you haven't) is just a regular USoundBase type, which means that theoretically you can hook up sound classes to it like any USoundBase. If you double click the sound player wave, it does appear like the "sound" group that you can see in most soundwaves is missing. This is probably because originally the programmer who made this wasn't thinking it would be relevant.

However, ff you drag your sound wave from the content browser to the editor, it will make an ambient sound component automatically for you. In that case, you can just add a sound class override to the ambient actor like in the following screenshot (i just tested media player waves working with the sound class system): alt text

avatar image localstarlight Mar 30 '16 at 12:15 AM

Thanks for your response!

I'm still not quite there though.

I've done what you suggested: 1. Created a Media Sound Wave from the Media Player 2. Added it to the scene to create and AmbientSound 3. Created a Sound Class and set the Sound Class into the Sound Class Override section of the AmbientSound details

For testing purposes, I've set the Sound Class to make the volume 0. But when I:

  1. Open up the Media Player and play the video (which I am doing through UMG) the volume is still on maximum.

I feel like there's a step I'm missing to connect the AmbientSound to actually be the sound stream for the Media Player...?

Additionally, I'm just trying to get the AmbientSound to play separately, and that's not even working. Here's my setup for that:

alt text

Thanks for your help!

avatar image localstarlight Mar 30 '16 at 12:17 AM

Also, from your setup it looks like the right direction if I was planning to have the Media Player as a texture in a 3D scene. I'm ultimately trying to have volume controls on a video player based entirely in the UMG, so I wonder if an AmbientSound will work for that at all?

avatar image Minus_Kelvin STAFF Mar 30 '16 at 06:11 PM

I'm not sure how media player works through UMG -- I'll have to ping one of the guys who knows media player (or UMG) more than I do.

avatar image gmpreussner STAFF Mar 30 '16 at 06:21 PM

Hey localstarlight,

There are no volume controls on the MediaPlayer or the MediaSoundWave. You need to control the volume on your sound assets instead. The MediaSoundWave works just like any other SoundWave node and can be used in the Sound Editor.

avatar image gmpreussner STAFF Mar 30 '16 at 06:29 PM

Sorry, I might have misunderstood. It seems that you're trying to play the audio in the UI, is that correct?

avatar image localstarlight Apr 01 '16 at 07:50 AM

Hi gmpreussner, Yes, that's correct. I would like to be able to adjust the volume of videos playing in the UMG - how can I go about that?

avatar image Minus_Kelvin STAFF Mar 30 '16 at 06:47 PM

So, if you're playing audio from UMG in general, you just need to emulate the way we play audio for UMG with any sound asset. Check out FSlateSoundDevice::PlaySound to see how that's done. The media sound wave is inherits from the same class as a regular sound wave so you can use it where you would normal sound waves. So, for example, you can create a sound cue, add a wave player node, then drop your media wave in the wave reference entry for the wave player. Then once you have that you can module the audio like you can anything else -- for example, you can select the "output" node and change the sound class. Or you can add a manual volume modulator, etc.

All you need to do is play the sound cue before you play the media player. The code for the media sound wave automatically knows what media player it's associated with and "procedurally generates" the audio for the sound from the playing video. There are currently some issues with sync (especially if the video loops and you drop in and out of PIE) that we are planning on fixing in the future.

Here's a screenshot of a sound cue that I just tested that uses the media wave instead of a normal wave:

alt text

avatar image localstarlight Mar 30 '16 at 11:27 PM

Hey guys,

I'm either doing something really wrong, or I'm facing some kind of bug here. I wasn't able to upload images here for some reason, so you can download them here: http://we.tl/BvGE7anssD

Trying to follow your instructions:

Created the Media Sound Wave (Image 1)

Created the Sound Cue (Image 2)

Added Wave Player to Sound Cue, and simply linked it up to the output (Image 3)

Then I tried what I assumed would be a simple setup to just test playing the Sound Cue in Blueprint (Image 4)

But nothing happens, no sound. I thought maybe that setup was wrong, so I went back to the Sound Cue editor and just tried to play the sound in there using the play button (Image 5)

No sound playing from there either. Perhaps there's something wrong with the Media Sound Wave itself?

Oddly, I noticed that if I open the Media Player I used to generate the Media Sound Wave, it doesn't actually list any audio tracks: (Image 6)

And yet, if I play the Media Player in that editor, it plays fine with sound. And if I play the Media Player in the UMG, it also plays fine with sound. Why would it not list any audio track and yet play with sound? Could this be the source of the problem with why the Sound Cue won't play?

I'm a bit flummoxed by all this! All I really need to do actually is be able to control the master volume for the entire game with a slider in the UMG. Is there an easier way to do this? I want a single slider that the user can use to control the total volume of everything. Being able to control the volume for a Media Player would also be useful as well, and I would like to figure out how to do that also.

Thanks for all your help, I'm sure we'll get there in the end.

avatar image Minus_Kelvin STAFF Mar 31 '16 at 12:17 AM

If you try to play the media sound wave by itself it won't generate audio. It creates audio "on the fly" when the media player itself plays. If it's playing audio when you preview the media file, then it's definitely working. Unfortunately you wont be able to preview the sound cue on its own with audio without playing the media file.

As for the real issue you're trying to do: turn down all volume. Luckily all audio is by default using the master sound class. So you can just push a sound mix that sets the master sound class to 0 volume (by using the volume adjuster for the master class in the sound mix).

HOWEVER, until very recently (as in, won't be available till 4.12 I believe), UE4 didn't support direct dynamic volume-control of a sound class in a sound mix, which, besides a number of good sound-design use-cases, makes user-preference sliders for audio problematic (without a C++ hack). To fix this, I added a feature for paragon to allow you to override (or add) any sound class volume or pitch adjuster in any sound mix at any time from BP.

In the short term, until you get the new dynamic sound-class volume feature, you can approximate a dynamic slider by creating say ~5 sound mixes (or however many you want) that set the master sound class to various levels of volume adjustment and either snap to those in the user-pref slider or just pick the nearest one.

avatar image Minus_Kelvin STAFF Mar 31 '16 at 12:17 AM

To be more concrete:

1) Create N number of sound mixes that set a sound-class adjustment of volume for the "master" sound class. For example, they might be named SoundMix_Master_0, SoundMix_Master_25, SoundMix_Master_50, SoundMix_Master_75, SoundMix_Master_100, for 0-volume, 25% volume, 50% volume, 75% volume, and 100% volume. Make the "interpolation" fade-time something reasonable like 0.25 seconds or something.

2) In the UMG code that handles the user-pref slider, find the points in the slider fraction that you want to hook up to the above sound mixes.

3) Keep track of what the current sound mix is, and "pop" the sound mix when the user switches to a new sound-mix, then push the sound mix that corresponds to the value you want.

Agreed that this is totally not ideal, but it should theoretically work to set all game volume based on a user-pref slider. If you have github access you should be able to get the new feature from this integration to main from our internal dev-framework stream:


"Change 2874623 on 2016/02/19 by Aaron.McLeran

 UE-27131 Support for changing sound class volumes dynamically

 - new BP function to override a sound mix sound class adjuster
 - cleanup of AudioDevice.h and AudioDevice.cpp
    - removing unnecessarily forward declares on various types
    - removing unnecessary spaces and (void) params, etc"
avatar image localstarlight Mar 31 '16 at 12:37 AM

OK, this is starting to make sense.

But when you say "master sound class" are you referring to something that already exists, or a Sound Class I need to create myself and somehow apply to everything?

When I create a Sound Mix, in the Sound Classes -> Sound Class Effects -> Sound Class section there's no option to select a 'master sound class', only Sound Classes I've created myself.

So if it's the case that I need to create this 'master sound class' myself, then I'm still a little confused as to how to apply it to all the many Media Players that I have (over 500). This is what you were trying to help me with originally – which involved dragging Media Waves into the editor to create AmbientSounds, but that seems like the wrong approach for a UMG-based video/audio player.

I completely understand the pop/push approach to volume control using a variety of different Sound Mixes, that shouldn't be any problem to set up, just still confused about this issue of a master sound class that incorporates everything, and how to link my Media Players into it.

Thanks again for your help.

avatar image localstarlight Apr 16 '16 at 12:47 PM


I left this alone for a little while but have come back and still trying to figure it out. What exactly do you mean by master sound class?

I have created a Sound Mix (https://we.tl/1KIrKvUo2t) which should set the volume to 0. In BP, if I push this sound mix, it doesn't do anything to effect the volume.

The only place in the Sound Mix I can see you can change the volume is if you add a Sound Class Effect, where you can change the Volume Adjuster to 0. But I can't see anything about it affecting a 'master sound class'.

What am I doing wrong?

avatar image Minus_Kelvin STAFF Apr 17 '16 at 10:31 PM

There is a global master sound class that exists by default -- you don't need to set it. All sounds automatically play in the master sound class (look at the sound class entries for various USoundBase objects like SoundCues, SoundWaves, etc). It will default "master" in the sound class entry. You can create a sound mix that turns the volume of the master class to 0 by doing what you describe and adding a sound class adjuster for the master class and setting it to 0. If you want to use your own sound class you can do that too, but you have to make sure the sounds you want to set to 0 are using your new sound class.

avatar image localstarlight May 15 '16 at 09:47 PM

I'm probably being really annoying here, but this still isn't working for me.

Here's what I'm trying:

  1. I have a UMG video player with two buttons, one which starts/stops the video, one which for purposes of testing simply mutes/unmutes the audio.

  2. I have created two Sound Mixes, one which sets the volume to 0 ( Volume_0 ) and one which sets it to 1 ( Volume_1 ).

  3. At BeginPlay, the Volume_1 mix is pushed onto the system.

  4. When the mute button is pushed it either: (1) pops the Volume_1 mix and pushes the Volume_0 mix to mute, or (2) pops the Volume_0 mix and pushes the Volume_1 mix to unmute.

Based on what you said about these Sound Mixes affecting the master class without needing to do anything, this seems like it should work, right? But it doesn't do anything – it has no affect whatsoever on the audio.

I'm obviously still missing out a step here, but I've been reading over and over this thread and can't figure out what it is!

Here are the two sound mixes, and the blueprint for the UMG widget:

alt text alt text alt text

What am I still doing wrong?

avatar image localstarlight May 26 '16 at 09:01 PM

Hey MinusKelvin, any idea how to make this work? Still can't seem to affect the volume of Media Players...

avatar image Minus_Kelvin STAFF May 26 '16 at 09:29 PM

Just looking at this briefly, it looks like you're sound mixes aren't applied to any sound classes. If you want your sound mix to apply to the master sound class, you need to specify the master sound class in the sound mix.

alt text

I think you were confused when we said it would work automatically for sounds. New sounds will by default play on the master sound class. What that means is your sound waves, sound-cues, etc, will look like this by default:

alt text

I'm not 100% familiar yet with media player, but all it is is a "procedural source" that is a derived class of USoundBase, which is the thing that does this default behavior with sound classes, etc. So it should just work with the sound mix system.

soundmix.png (35.6 kB)
soundwave.png (33.2 kB)
avatar image localstarlight May 31 '16 at 04:31 PM

So I finally figured out how to find the Master sound class! I had to go to View Options -> Show Engine Content in order to be able to select that in the sound mix.

However, it still isn't working with the setup I listed above. I suspect it's because the Media Sound Wave hasn't been assigned a class? But when I open it up, it doesn't look like the one you've posted (your soundwave.png above), it looks like this:

alt text

There's nowhere to choose the sound class. From what you're suggesting, they should be affected by the Master soundclass anyway, but that doesn't seem to be the case, unless my BP setup is wrong in the first place...?

avatar image Minus_Kelvin STAFF May 31 '16 at 06:05 PM

When you drag the media sound wave into the level, it should create a ambient actor. Ambient actor's will have audio component UI that let you edit/override the sound class for any sound played in the actor.

avatar image localstarlight Jun 03 '16 at 12:45 PM

Ok, so I dragged the Media Sound Wave into the scene to create an AmbientSound. As you said, I was able to set the sound class (though it doesn't look exactly the same as your example):

alt text

But ... it still doesn't work. Bear in mind I am playing the sound/video in UMG, so is the creation of an AmbientSound really the right approach?

Just to explain again, this is the current setup:

  1. A video file brought in as Media Player

  2. UMG widget with the Media Player playing as a video (as brush in an image widget)

  3. Two Sound Mixes, one with volume set to 0, one with volume set to 1. Both are set to affect the Master sound class.

  4. A button in the UMG which toggles (with combined pop/push operations) between the two sound classes, essentially toggling to mute/unmute the sound.

  5. A Media Sound Wave created from the Media Player has been added to the scene to create an AmbientSound actor

  6. The AmbientSound actor has had its sound class set to Master, so that it should be affected by the pop/push of the Sound Mixes (which are set to affect the Master sound class)

And yet, the mute/unmute button does nothing to affect the sound coming out of the Media Player playing in the UMG.

I am happy to send the project if that would help?

Do you have a working example of a setup where you can control the volume of a Media Player video playing in the UMG?

avatar image Minus_Kelvin STAFF Jun 03 '16 at 11:36 PM

Yes, at this point, I think you're correct that UMG is the issue. Have you been able to get it to work without using UMG? I'm not quite familiar how media player works in UMG. I followed the documentation here: https://docs.unrealengine.com/latest/INT/Engine/MediaFramework/

Create a media texture and play the media that way. In that case, it does play the audio correctly.

It could be that UMG is not playing audio through the ambient actor but instead doing something else (and not setting up the sound class properly).

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
more ▼

answered Apr 12 '19 at 06:10 AM

avatar image

197 10 26 26

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question