Log in to Freesound

Problems logging in?
Don't have an account? Join now

Problems logging in?

Enter your email or username below and we'll send you a link to help you login into your account.

Back to log in

Almost there!

We've sent a verification link by email

Didn't receive the email? Check your Spam folder, it may have been caught by a filter. If you still don't see it, you can resend the verification email.

Default title

  • Sounds
  • Tags
  • Forum
  • Map
    • Sounds
    • Packs
    • Forum
    • Map
    • Tags
    • Random sound
    • Charts
    • Donate
    • Help

Freesound Forums

  • Freesound Forums
  • Bug Reports, Errors and Feature Requests
  • Using Opus codec for sound previews?

Using Opus codec for sound previews?

Subscribe

Started February 5th, 2020 · 4 replies · Latest reply by copyc4t 5 years, 10 months ago

unfa

974 sounds

78 posts

5 years, 10 months ago
#1

I was wondering if Freesound's previews could be slowly migrating towards using Opus instead of MP3 encoding.

That would provide significant sound quality improvement with the same bitrate, because Opus is a much more modern and advanced codec.

I don't think re-generating the preview files at once would be possible or even make sense, but maybe the newly uploaded sounds could start using that, and then maybe each week the top N most popular sounds's previews could be encoded to the new coded to improve preview quality until all are processed eventually? (maybe excluding sounds below a certain popularity threshold which would I guess limit the workload that'd provide hardly any visible benefit to the site users).

I believe the Opus Codec is widely supported by all web browsers already.

More information: https://opus-codec.org/

What do you think?

Wanna learn about music proudction? YouTube
copyc4t

283 sounds

654 posts

5 years, 10 months ago
#2

I've done a quick test on a song for which I have the wav and a cbr 128kb/s mp3.

I've used opusenc from the opus-tools package, and obtained a cbr 128kb/s opus which is half the size of the mp3.

The result shows 2 side effects, one unavoidable but not necessarily too relevant for the preview use case (source was 44.1kHz, output is 48kHz), and one not controllable via opusenc options (source peaks at -0.1dB, output peaks at +0.675dB) which may be an issue with hot recordings; even though the output doesn't sound badly distorted, Audacity shows a lot of clipping.

That said, mp3 conversion also tends to boost the gain, so maybe that's already accounted for by the preview creation (haven't checked the code atm).

As for the complete substitution, it could be throttled down not to hog too many resources, no matter how long it takes, and ordering/filtering by popularity as you suggest would make it useful since the beginning of the whole process.

All in all, I like the idea.

copyc4t - http://soundcloud.com/copyc4t
unfa

974 sounds

78 posts

5 years, 10 months ago
#3

As for the issues with clipping after encoding - I usually see people recommending to master your music to -1 dBFS True Peak (inter-sample peaks taken into account).

I guess `sox` could be used to perform limiting if necessary, to avoid clipped previews before they are encoded. Probably something like that is already used done.

Wanna learn about music proudction? YouTube
copyc4t

283 sounds

654 posts

5 years, 10 months ago
#4

Yes, -1dB is my usual target, I've had to go to -1.5dB only for some very busy mixes.

Anyway I've taken a peek at the code, and the preview creation does no gain adjustment at all on the source; since it hasn't been an issue so far with the mp3 previews, I guess it'd be the same with opus ones.

copyc4t - http://soundcloud.com/copyc4t
Post reply
About Freesound Terms of use Privacy Cookies Developers Help Donations Blog Freesound Labs Get your t-shirt!
© 2025 Universitat Pompeu Fabra