Are there really any difference to opus audio files and for example m4a files detectable to human ears?

28 réponses [Dernière contribution]
GrevenGull
Hors ligne
A rejoint: 12/18/2017

I... really can't distinguish them. Of course I am not testing properly.

But have any of you guys in here something to say in this matter?

Are there any distinguishable differences between the formats?

chaosmonk

I am a member!

I am a translator!

Hors ligne
A rejoint: 07/07/2017

The standard way to store audio information digitally is pulse-code modulation (PCM)[1]. This consists of a sequence of samples representing the amplitude of the signal at different moments. For example, say you record yourself speaking into your computer's microphone. Your voice causes a fluctuation in air pressure, which the microphone converts into a fluctuation in voltage. Your computer's sound card[2] then checks the voltage 44100 times per second (assuming CD quality audio) and stores all those values. Playback does the same thing in reverse. Your sound card converts the samples back to voltage levels, which your speakers convert back to air pressure, which your ears detect and perceive as sound.

The quality of the audio depends on the quality of your sound card, the sample rate (44100 Hz is standard for CDs, but you can go higher), and the bit depth[3] (basically how much we round the sample values). However, once the signal is converted to samples, the audio quality will stay the same as long as those samples are not modified. wav and aiff files are PCM formats. They sound identical, because they store the exact same information. Nothing is going to sound better than a PCM format.

However, wav and aiff files are huge. It is often desirable to compress them. flac[4] is an an example of a "lossless" compression format, which means that although it compresses the data, it does so in a way that the original data can be exactly reconstructed, so the quality of a flac file is just as good as wav or aiff, but it is a smaller file.

A flac is still pretty big, though. We can get even smaller if we compromise a bit on quality. "Lossy" compression, as opposed to "lossless" compression, compresses the data in a way that not all of it can be recovered. Lossy compression algorithms try to only throw out details that humans are unlikely to miss, but there is a tradeoff between file size and quality. The better a compression algorithm is, the better quality it can retain with the same file size, or the smaller a file size it can achieve with the same quality.

Here is a comparison of a recording as a wav file, and then compressed to the same size with both mp3 and ogg vorbis.

https://en.wikipedia.org/wiki/File:Test_ogg_mp3_48kbps.wav

To my ear, the wav sounds the best, as expected. The ogg vorbis loses some details, but still sounds decent. The mp3 sounds like crap to me. It sounds muted, because it is missing some of the higher frequencies. If you can't hear this, you can see it in a spectrogram. I downloaded the file and used Audacity to generate the attached image. It is a plot of frequency over time. Notice how the third segment (mp3) has all those empty spots at the top representing the higher end of the spectrum, and how the second segment (ogg vorbis) has those mostly filled in, but still looks a little different from the first segment (wav).

So to finally answer your initial question, lossless formats all sound the same, but lossy formats sound different from each other and not as good as a lossless format, and yes, humans can tell the difference. I haven't specifically compared opus and m4a, though.

[1] https://en.wikipedia.org/wiki/PCM
[2] https://en.wikipedia.org/wiki/Digital-to-analog_converter
[3] https://en.wikipedia.org/wiki/Audio_bit_depth
[4] https://en.wikipedia.org/wiki/FLAC

Screenshot at 2018-06-12 23:30:53.png
GrevenGull
Hors ligne
A rejoint: 12/18/2017

Wow! Thank you so much for taking time to write this :)

With your example I totally agree wav sounds beautiful, ogg sounds ok and mp3 is garbage lol :P

but wav, aiff and flac are proprietary formats right? I know it's not a software program so it isn't a freedom issue per se, but I just ask.

When does it matter if a sound file format is proprietary?

I mean... after your demonstration I totally want PCM sound files :P

chaosmonk

I am a member!

I am a translator!

Hors ligne
A rejoint: 07/07/2017

> but wav, aiff and flac are proprietary formats right?

I know that wav is not proprietary. I haven't looked into aiff, but I don't think that it it is proprietary. flac is definitely libre. In fact, "flac" stands for "free lossless audio codec" and the "free" is as in freedom.

> When does it matter if a sound file format is proprietary?

An example I'm familiar with was* mp3 support in Digital Audio Workstations[1]. Any music distributed in an mp3 format was subject to royalties, but if the patent-holders went after artists it would simply drive them toward another format. Instead, they would go after the developers of the software that the artists use to create mp3 files. The developers would pay for mp3 support, and the expense would get passed onto the user in the price of the software.

This is why Audacity did not include support for mp3 by default. Their website includes instructions[1] for how to enable mp3 support, but it uses an external link to the necessary software since they couldn't distribute it themselves. Otherwise, the Audacity would have to choose between paying royalties or risk their users having to pay royalties later one.

However, the version of Audacity packaged in Trisquel does have mp3 support by default, and did even before the patent was expired. This is because, unlike Audacity, Trisquel is based in a country whose government rightly does not grant software patents.

Also see this: https://www.gnu.org/philosophy/why-audio-format-matters.html

*I say "was" because the patent on the mp3 format has expired, so this shouldn't be an issue any longer.

> I mean... after your demonstration I totally want PCM sound files :P

Lossless formats do sound better, but lossy formats have their place. You can fit much more music on a hardware audio player if it is compressed, and lossy formats are capable of greater compression than lossless formats like flac. Also, the audio formats that can be embedded in a web page using the html5 tag include wav, ogg vorbis, and mp3 (although not all browsers support all of these). Unless the file is very short, you would not want to use wav, because it would take a very long time to buffer.

[1] https://en.wikipedia.org/wiki/Digital_audio_workstation
[2] https://manual.audacityteam.org/man/installing_and_updating_audacity_on_windows.html#winlame

GrevenGull
Hors ligne
A rejoint: 12/18/2017

> I know that wav is not proprietary. I haven't looked into aiff, but I don't think that it it is proprietary. flac is definitely libre. In fact, "flac" stands for "free lossless audio codec" and the "free" is as in freedom.

Well hallelujah!

> Lossless formats do sound better, but lossy formats have their place. You can fit much more music on a hardware audio player if it is compressed, and lossy formats are capable of greater compression than lossless formats like flac. Also, the audio formats that can be embedded in a web page using the html5 tag include wav, ogg vorbis, and mp3 (although not all browsers support all of these). Unless the file is very short, you would not want to use wav, because it would take a very long time to buffer.

I see I see

Heather

I am a member!

Hors ligne
A rejoint: 03/06/2013

Yup.

The practical reality is that both have their purposes. I'd much rather
listen to a flac but if I just wake up one morning and randomly want to
learn how to play the theme song from M*A*S*H on my 12 string lawsuit
Martin and can't remember how the chorus went, an .mp3 is a quick and
easy fix.

I'll resist the urge to bore you with how music affects us in other ways
than what our ears can hear, how kids used to play acoustic guitars
instead of candy crush, how it's different when my rib cage doesn't
vibrate and I can't feel the music I'm hearing, and how I can't quite
bring myself to laugh at Neil Young's failed pono player because I can't
completely disagree with him that maybe bad music quality really is at
the heart of what's wrong with the world.

GrevenGull, one quick practical hint is to grab some external speakers
or a decent headset if you're using a laptop. It's not a lot of money
for a HUGE improvement.

GrevenGull
Hors ligne
A rejoint: 12/18/2017

> I'll resist the urge to bore you with how music affects us in other ways

You didn't resist it though..

GrevenGull
Hors ligne
A rejoint: 12/18/2017

Also:

> how kids used to play acoustic guitars
instead of candy crush

This is a grotesque generalization without roots in reality.

Yes more kids are playing candy crush today compared to whatever time period you refer to, most likely because whatever time period you're referring to didn't contain Candy Crash or Smartphones. That's like saying "ahh there's so many more people today flying airplanes than in 1721, I wonder why...".

And there are plenty of kids today that plays acoustic guitars.

Feel free to be nostalgic about the past and whine about "what's wrong with the world" (even though I think the majority of the world's population would agree the world is becoming a gradually better place to live, all of this is subjective of course.
But I just got "an urge" to point out that "what's wrong with world" maybe has something to do with you and your perspective about things plus maybe you're getting older and getting depressed about that, and then you're projecting the problem which is in yourself up upon "the world".

Magic Banana

I am a member!

I am a translator!

Hors ligne
A rejoint: 07/24/2010

There are many parameters to a lossy encoding process (e.g., to JPEG for raster images, to Vorbis for sounds or to VP8 for videos). They allow to fix the trade-off between the quality and the size of the file. Programs producing such files usually hide all that complexity behind one single quality number (e.g., GIMP asks you to set the quality of the saved JPEG image between 0 and 100) or presets such as "very low" quality, "low", "normal", "high", "very high" and "insanely high".

Even choosing an "insanely high" quality, the file that is produced will almost always be smaller than what can be achieved with lossless formats (e.g., PNG for raster images or FLAC for sound). And it is called "insane" for a reason: I remember reading the results of a double-blind study showing that basically nobody, not even people audio engineers, can hear a difference between the CD playing and a MP3 version of the same tune encoded with the quality parameter set to "high" (or "very high", those presets certainly mean different things in different programs). So, well, it is actually hard to justify the use of lossless codecs unless you professionally work with such files and want to be able, in the future, to distribute files with an even better quality/size trade-off, using codecs that do not exist yet.

Indeed, you cannot increase the quality of a file that is in a lossy format. For instance, converting MP3 to Vorbis or Opus will never increase the quality. What the MP3 lost is lost. The Vorbis or Opus codec can only lose more information. Starting from the lossless file though, the Vorbis codec (or, even more, the Opus codec) will provide you a higher-quality output file than MP3 for a same size. Or, equivalently, they will provide you a smaller file for the same quality. So people who threw away their CDs after converting them to MP3 ten years ago (when Opus did not exist) cannot take advantage of Opus to get an enhanced quality (for the same size or even smaller).

GrevenGull
Hors ligne
A rejoint: 12/18/2017

I see I see!

But "how much" smaller in size is Opus/Vorbis compared to FLAC?

And "how much" better is Vorbis/Opus compared to MP3?

I know this isn't measurable per se, but I'm asking nonetheless and looking for a "general type of answer" :P

Anyway.. what about ogg? Is ogg in the same ballpark as mp3?

loldier
Hors ligne
A rejoint: 02/17/2016

Muddy Waters London Sessions CD (twelve songs):

1. Ogg Vorbis 34 MB
2. FLAC 219 MB

Magic Banana

I am a member!

I am a translator!

Hors ligne
A rejoint: 07/24/2010

Here is what I suggest you:

  1. Choose a CD track you like and make a FLAC out of it (e.g., using SoundJuicer);
  2. Convert that FLAC into MP3, Ogg Vorbis and Opus with different quality settings for each (e.g., using SoundConverter, which proposes six quality presets for all formats);
  3. Make a playlist out of the files with a lossy encoding and grab your best headset;
  4. Ask a friend who is interested as well in the topic (you can exchange roles afterwards) to play that playlist shuffled (so that only him/her knows the name of the file currently played);
  5. For every file, tell him/her whether you can hear a difference with the FLAC version (that you are allowed to listen whenever you want, knowing it is the FLAC version);
  6. Among the files for which you cannot perceive any difference with FLAC, see which one is the smallest.

The result will probably be Opus at a "normal", "high" or very high" quality (depending on how good your ear and your headset are). At least that is what ABX tests suggest. Those ABX tests are better than what I proposed above but last longer (you would have to listen the FLAC and a lossy format, presented in a tandom order, and pick which one is FLAC, ... doing that many times for each lossy encoding): https://en.wikipedia.org/wiki/ABX_test

GrevenGull
Hors ligne
A rejoint: 12/18/2017

This a great suggestion! Thank you for this :D

GrevenGull
Hors ligne
A rejoint: 12/18/2017

Soundjuicer is neither in FSF's free software directory nor in Trisquel's repo though.

Do you have a more "accessible" alternative? :)

Again, thank you for this great suggestion

onpon4
Hors ligne
A rejoint: 05/30/2012

sudo apt install sound-juicer

loldier
Hors ligne
A rejoint: 02/17/2016

Ninja'd. Anyway, here's a screenshot I already prepared.

sound_juicer.png
GrevenGull
Hors ligne
A rejoint: 12/18/2017

ah, 'twas a dash in the name :) thanks

loldier
Hors ligne
A rejoint: 02/17/2016

Rolling Stones Steel Wheels 17 tracks 53 mins. Opus and Vorbis set to max bitrate.

332M rstones_flac
123M rstones_opus
186M rstones_vorbis
536M rstones_wav

SuperTramp83

I am a translator!

Hors ligne
A rejoint: 10/31/2014

Hmm, Muddy and Rolling? Kitty got some style :)

Get some quality headphones, otherwise I can guarantee you, you won't hear any difference at all between a decent mp3 and whatever flac or such. Most people won't hear the differnece even with the best headphones.

Have an songy, kitty -> https://www.youtube.com/watch?v=og5jI6XWXjA

loldier
Hors ligne
A rejoint: 02/17/2016

That was great (Nemrud). A blast from the past.

Whatabout this? Buffy in her seventies.

https://youtu.be/o5zb0WTSLsY

buffy.jpg
jxself
Hors ligne
A rejoint: 09/13/2010

"Are there really any difference to opus audio files and for example m4a files detectable to human ears?"

The primary difference isn't quality-related: Opus is a royalty-free codec, meaning that it's free of patent problems. So if you can't hear a difference, use the patent-free one. :)

GrevenGull
Hors ligne
A rejoint: 12/18/2017

Gotcha :)

nadebula.1984
Hors ligne
A rejoint: 05/01/2018

I can't tell the difference between opus and AAC using my Rockbox player (11 years old Creative Zen).

But opus is still not commonly supported by the official (often proprietary) firmware of latest Hi-Fi players. I can't test it on those players. I also won't buy any new player, because "Secure Boot" is already well developed (by Tivo, Microsoft, etc.).

strypey
Hors ligne
A rejoint: 05/14/2015

As I understand it, Opus is a replacement for both Vorbis and Speex (lossy codecs for music and speech respectively). Opus allows for a variable bitrate, so if you have song where the music stops in the middle, and there is only someone singing a chorus (or whatever), the bitrate is dropped for this bit. The benefits of Opus are a) you get smaller files for the same or better sound quality, and b) you don't have to think about which bitrate to choose, the Opus encoder will do that for you.

As for the lossy vs. lossless thing, I think it depends very much on a) what kind of music are you encoding, b) what kind of speakers are you going to play the resulting files on, and c) how much do you care about how much storage space the files take up?

* If you are encoding the Sex Pistols, the Dead Kennedies, or the Tall Dwarfs, audio quality isn't the point, and the music already sounds like it was recorded with the microphones dipped in a bowl of soup. No point using a lossless codec for stuff like that. If you are encoding classical or dub, or other music where subtle differences in the sound make a big difference to the emotional impact of the music, it might be worth using a lossless codec like FLAC.

* If you are encoding any kind of music to listen to on headphones or computer speakers, even the best quality ones, you won't hear the difference between files encoded with lossy and lossless codecs, just use a lossy codec like Opus. If you plan to start DJing, and you hope to play the files on a huge sound system at an outdoor festival, then it's worth having your collection in FLAC.

* If you have near-infinite amounts of storage space, you might as well use a lossless codec anyway, just in case you get a chance to play the files on a bigger rig, or you're sharing them with someone who might. You can use the FLAC files to encode lossy files for use on portable players, and in other situations where you need smaller file sizes.

GrevenGull
Hors ligne
A rejoint: 12/18/2017

Good tips and nice read! thank you

Substance2004
Hors ligne
A rejoint: 11/05/2013

One last advice : use Spek, a ligth software for good spectrograms.

You'll see all the differences between formats and compression levels.

GrevenGull
Hors ligne
A rejoint: 12/18/2017

I'll check it out:)

Magic Banana

I am a member!

I am a translator!

Hors ligne
A rejoint: 07/24/2010

Sure... but what is the point of seeing differences you cannot hear?

GrevenGull
Hors ligne
A rejoint: 12/18/2017

You sure know how to spread happiness MB :P

to answer your question:

it might be interesting, things doesn't always have to have a "point"