2 problems with playing custom sound

Jul 26, 2015
694
819
I am trying to play some custom music files throughout my map using an ambient_generic but I have encountered two problems

1) The sound was too quiet, so I stacked up two ambient_generics to play the sound at once, but now the sound cuts off halfway through playing. This was not an issue when I used only one entity.

2) I am using AddOutput on the ambient_generic to change the audio file I want to play, but it says "EmitAmbientSound: sound not precached: " in the console and does not play the sound.

EDIT: I solved the above problem, I just put an inactive ambient_generic with the desired sound in the keyvalue.

The sounds are 320 Kbps, 44,100 Hz, 16 Bit, Stereo, MP3. They are activated manually and are not meant to loop.
 
Last edited:

Pocket

Half a Lambert is better than one.
aa
Nov 14, 2009
4,694
2,579
Are you, perchance, trying to use a WAV file instead of an MP3? Because that was the issue (I guess) when I had a similar problem. Might have something to do with limited space in the sound cache, or a hard limit on filesize... who knows.
 
Jul 26, 2015
694
819
Are you, perchance, trying to use a WAV file instead of an MP3? Because that was the issue (I guess) when I had a similar problem. Might have something to do with limited space in the sound cache, or a hard limit on filesize... who knows.

I am using MP3 files. I'd like to note that they did play in full at one point but somehow I did something to break them.

EDIT: The file is also 1.38 MB in size.
 
Last edited:
Jul 26, 2015
694
819
THIS ISSUE HAS BEEN SOLVED

Alright, so I remade the audio files at a lower quality (112 kbps, 44100 Hz) and now they seem to play. I suppose you were right about the file size issue, since these are longer audio files than usual.
 

henke37

aa
Sep 23, 2011
2,075
515
Use a soundscript. That way you get to specify the mixer channel to use and the mixer settings to use. Which just so happens to include the attenuation.
 

BigfootBeto

Party Time 2.0!
aa
Jun 8, 2016
496
847
2) I am using AddOutput on the ambient_generic to change the audio file I want to play, but it says "EmitAmbientSound: sound not precached: " in the console and does not play the sound.

EDIT: I solved the above problem, I just put an inactive ambient_generic with the desired sound in the keyvalue.

I tried this and the sounds were still not precached. Am I missing something?

Edit: I fixed it. Lesson of the day: Always double check your file names...
 
Last edited: