Run time memory perspective, which format is effective (.mp3 or .wav).?
Mp3 is compressed, as opposed to Wav which is (generally speaking) raw Data.
Wav uses more memory, but mp3 requires more processing power. Its an interesting trade-off, although as most devices have built-in mp3 and mp4 hardware decoder, I believe that using mp3 is a better solution.
This is in general applicable for music, as for general sounds (interface and so on), perhaps it is better to use wav.
So generally speaking I believe that the best practices are:
- Mp3 for long sound files (Music and ambient sounds)
- Wav for small sound files (Interface and game sounds)
You can find additional discussion on the topic in the following links:
for efficiency I would recommend you look at a rolling buffer so you dont have to keep the full music file in memory.
I maid an Asset to do just this, it works on Win, Max, Linux, iOS, android…
Asset - uAudio: Mp3 Player/Streamer
first, let’s take a look at several formats, source from: How Audio File Formats Differ and What This Means for Listeners
MP3: Designed by the Moving Pictures Experts Group (MPEG), an organization that develops standards for coded audio and video programs, the MPEG-1/MPEG-2 Layer 3 (MP3) is arguably the most prolific and supported audio file type. MP3 is both a compressed and lossy audio format, with bit rates ranging from 8 kbit/s up to a maximum of 320 kbit/s, and sampling frequencies ranging from 16 kHz to a maximum of 48 kHz. The smaller file sizes of MP3s means faster file transferring and less space used, but at the cost of a reduction in sound quality (versus lossless).
WAV: Also developed by Microsoft, the Waveform Audio File Format (WAVE, or more commonly known as WAV) is a standard for Windows-based systems and compatible with a variety of software applications. WAV is both an uncompressed (but can also be coded as compressed) and lossless audio format, essentially an exact copy of the source data. Individual files can take up a significant amount of space, making the format more ideal for archiving and/or audio editing. WAV audio files are similar to PCM and AIFF audio files.
But if I were you, I will convert them freely and choose the best one I like, M4A to WAV - Convert Audio with the Best Quality I am usually using wav format for high quality.