- Home /
How can I improve OGG music quality?
I downloaded an mp3 music file that I want to play in the background of my game. It sounds terrible. The music actually slows down and speeds up, there's painful clicks all the time and the quality is very 'hard' like a bad radio or really high compression.
What I have tried that didn't work:
set sound to 2D
bypass all effects on playback
change sound priority
change compression quality (did have some effect ofc but didn't fix it)
change the load type
It is related to the computer it runs on. I have an AMD Athlon 64 Dual Core 5600+ which doesn't have the problem that much. It get's much worse on my Mobile Core i5 laptop.
The game btw is very CPU-heavy, because it generates a lot of the map in real time on a separate thread.
Oh, BTW, even if you can't help, I would be interested to know if other people also experienced problems with OGG playback on a normal desktop computer.
Thanks!
@reptilebeats Well, the source mp3 sounds fine, off course. Playing in the Unity Editor or as a built executable makes no difference.
Update: I have a new, very fast computer now and the problem is no longer there. Apparently OGG is just a very bad codec in that if it doesn't get enough CPU time it will start playing raw bytes which is terribly painful to the ears (ins$$anonymous$$d of, for example, muting). Boggles my $$anonymous$$d anyone would accept such behaviour let alone in what is supposed to become a serious gamedev environment.
ogg is not that bad. I would think your issue is that you had a mp3 in the first place which is already a compression format, then you compressed again a compressed file which result in double loss of quality. You'd rather use a wav (if you can) that you convert to ogg. Then you will see the quality is not so bad.
themipper says : I have the same problem and it doesn't seem to be a problem of the soundfile.
I generate a lot of meshes during runtime. The vertices, indices and normals are generated in separate threads (ThreadPool). Unity's main methods are not thread safe which means that the final steps of creating/updating the mesh, assigning it to the meshfilter and collider have to be done in the main thread.
This is the point where the problem originates. The music starts to stutter. It seems that the sound system is not running in its own thread which leads to the stuttering. Or the thread has a really low priority?
Does anybody know if there is a way to give the music thread a higher priority?
Answer by dotJack · Oct 03, 2012 at 10:49 AM
The music actually slows down and speeds up
This is usually a matter of 3D sound and is caused by the doppler effect, used to emulate things going towards or moving away from the audio listener; This also applies to stuff like random panning, spread, etc.
If you are being affected by this, chances are you're using the sound in 3D and you're not applying the 2D settings, either way, you should probably turn the doppler down to 0.
there's painful clicks all the time and the quality is very 'hard' like a bad radio or really high compression.
use Audacity to convert it to OGG yourself - listen to it. If it's still horrible or if it is in fact horrible in the mp3 format, then it's not Unit'-s problem, if your version of the OGG is horrible, up the compression. I had this strange bug where the compression rates inside Unity didn't really change anything and I had to re-export a bunch of stuff by-hand and ignore Unity's own settings.
Your answer
Follow this Question
Related Questions
Does creating several "audio players" load several AudioClips in the memory? 1 Answer
Array of AudioClips not playing, please help 3 Answers
Different music for pause menu? 1 Answer
How to play music/audio 2 Answers
Dynamic Backgroundmusic 1 Answer