MP3: Difference between revisions

From Valve Developer Community
Jump to navigation Jump to search
mNo edit summary
(Sorse 2 has looping MP3s, although idk if games other than sampersandbox can make them.)
Line 2: Line 2:


{{modernWarning|Using GoldSrc or Source 1's default implementation of MP3 in a commercial game requires paying for the Miles Sound System license, which can be found in [http://www.radgametools.com/sales.htm RAD Game Tools website]. Consider implementing an alternative, such as Ogg Vorbis.}}
{{modernWarning|Using GoldSrc or Source 1's default implementation of MP3 in a commercial game requires paying for the Miles Sound System license, which can be found in [http://www.radgametools.com/sales.htm RAD Game Tools website]. Consider implementing an alternative, such as Ogg Vorbis.}}
{{modernWarning|<ul>
<li>MP3s '''''cannot''''' be [[looping a sound|properly looped]] in {{src|4}}! Looping can be simulated by scripting replaying the sound via [[entity I/O]] or code scripting, but there will be a gap.
<li>In {{src2|4}}, proper looping MP3s are possible ([https://wiki.facepunch.com/sbox/Guide_to_Sounds#loopingsounds use S&Box tools to flag VSND appropriately]), but they can only loop in their entirety.
</ul>{{modernConfirm|Can other {{src2}} games' tools flag MP3s as looping? The games themselves should be able to support reading them as looped, since the VSND has the loop points.}} }}
== Recommended minimum bitrates ==
== Recommended minimum bitrates ==
Unlike WAV, MP3 supports arbitrary bitrates, independent of sample rate and channel count. While this improves scalability, going below certain bitrates will result in noticeable quality degradation. Below are recommended minimum bitrates for the sample rates supported by {{src|4}}.
Unlike WAV, MP3 supports arbitrary bitrates, independent of sample rate and channel count. While this improves scalability, going below certain bitrates will result in noticeable quality degradation. Below are recommended minimum bitrates for the sample rates supported by {{src|4}} ({{src2|4}} supports {{w|MP3#Bit_rate|additional sample rates}}).


{| class="wikitable"
{| class="wikitable"
Line 20: Line 24:
|}
|}
{{tip|These are just minimums. If you have the space to spare, you can go up to 320 kbps for higher quality audio!}}
{{tip|These are just minimums. If you have the space to spare, you can go up to 320 kbps for higher quality audio!}}
== See also ==
* [[WAV]]
* [[VSND]]


== External links ==
== External links ==

Revision as of 04:46, 2 August 2023

MP3 is a lossy audio file format used by all of Valve's engines, and is available in all first-party titles. While engine limitations prevent it from being used for everything that WAV files can be used for, its smaller file sizes make it suitable for non-looping music or incidental ambient sounds in a soundscape.

Template:ModernWarning Template:ModernWarning

Recommended minimum bitrates

Unlike WAV, MP3 supports arbitrary bitrates, independent of sample rate and channel count. While this improves scalability, going below certain bitrates will result in noticeable quality degradation. Below are recommended minimum bitrates for the sample rates supported by Source Source (Source 2 Source 2 supports Wikipedia icon additional sample rates).

Sample rate Mono (1 channel) Stereo (2 channels)
11025 Hz 32 kbps 64 kbps
22050 Hz
44100 Hz 64 kbps 128 kbps
Tip.pngTip:These are just minimums. If you have the space to spare, you can go up to 320 kbps for higher quality audio!

See also

External links