Author Topic: HOW DO I Equalise volume on all recordings?  (Read 15568 times)

chipppy

  • Veteran
  • ***
  • Posts: 65
    • View Profile
HOW DO I Equalise volume on all recordings?
« on: May 09, 2009, 01:44:42 pm »
Hello

I have an odd question.  I would like to equalise the volume across all recordings, movies, music.
The reason for this is because I currently have different recording that play at different volumes.  I even have different movies that play at different volumes.  I am not refering to a loud action movie-v- a quiet library scene.  I have one kids movie that I need o set the volume level on the TV to 25 and another kids movie that requires a TV volume level of 58.

I vaguely remember a function in Real Player 10, I think, that equalises the volume of all the music files to be the same.  I would like to try and do this for all my recording so that I can leave the TV volume alone.

This is important as the kids love both movies and they complain because the 'noise is broken' (they are 2 and 3 years old can drive the video but still cannot adjust the TV or HTPC volume)

Cheers
chipppy
ASUS P5Q SE/R, Gigabyte 8400GS - Composite TV, 4GB 1066, Intel E8500 3.15GHz dual core, 500GB HDD + 1TG HDD, Divco FusionHDVT DVB-T Digital Dual 4 TV tuner.

'Cry wolf and let slip the dogs of war'

Marie.O

  • Administrator
  • LinuxMCE God
  • *****
  • Posts: 3676
  • Wastes Life On LinuxMCE Since 2007
    • View Profile
    • My Home
Re: HOW DO I Equalise volume on all recordings?
« Reply #1 on: May 09, 2009, 03:25:06 pm »
afaik, there are utilities which allow you to do that with mp3 files, but I've never seen stuff like that for videos.

colinjones

  • Alumni
  • LinuxMCE God
  • *
  • Posts: 3003
    • View Profile
Re: HOW DO I Equalise volume on all recordings?
« Reply #2 on: May 09, 2009, 11:44:02 pm »
I did log a feature request for this in mantis a long time ago, but it got lost. Its actually quite a complex thing to add - you would need to add functionality to scan the audio track of all your AV media files, and calculate a file-wide record level average, then write a scaling factor into an attribute that would get stored in the db and id3 tag/file. Then xine would need to be modified to read this at the start of playback and modify the current volume level based on this... but it couldn't be done transparently because you can't pre-scale audio like that when using digital audio connections, you have to actually change the amp volume. So you would need to implement the concepts of "current volume" and a temporary "playback volume" so that xine would change the amp's volume back to "current volume" at the end of playback.

Alternatively, you would need to find a 3rd party tool actually to permanently rewrite the audio tracks of all your media files based on the same calculation, so that LMCE doesn't have to do anything... this obviously could be dangerous as you can never be sure how well it will do this, or good well the audio sync will be afterwards... good idea to back up first!

skeptic

  • Addicted
  • *
  • Posts: 615
    • View Profile
Re: HOW DO I Equalise volume on all recordings?
« Reply #3 on: May 10, 2009, 04:53:05 am »
you could try avidemux.  You can set it to copy the video, and use automatic gain (-3db max).  You can use it from the cli with a small script to batch process it all.  I have no clue if this will do what you want, I've never tried it, but it exists.  Probably want to make a copy of your movies first just in case it screws them up (bad sound, out of sync, whatever).  For mp3s I think there are a few options, but I don't know anything about them. 

chipppy

  • Veteran
  • ***
  • Posts: 65
    • View Profile
Re: HOW DO I Equalise volume on all recordings?
« Reply #4 on: May 10, 2009, 04:44:36 pm »
hmmmmm

Sounds like way to techy for me personally.

Posde:  Do you know the names of any other utilities.  I might have friend a look at the source code and see if he thinks if it is a big or huge job to stripe it out and mod it up to have a go on my HTPC.  He is one of those people that loves a challange.  Might be best to give him a few diffeent utiliities to have a look at to have the best chance of actually getting some good code though.

Cheers
chipppy
ASUS P5Q SE/R, Gigabyte 8400GS - Composite TV, 4GB 1066, Intel E8500 3.15GHz dual core, 500GB HDD + 1TG HDD, Divco FusionHDVT DVB-T Digital Dual 4 TV tuner.

'Cry wolf and let slip the dogs of war'

alx9r

  • Guru
  • ****
  • Posts: 187
    • View Profile
Re: HOW DO I Equalise volume on all recordings?
« Reply #5 on: May 10, 2009, 10:55:44 pm »
chipppy,
I had a similar problem and expected that the solution would have to be something like skeptic or colinjones' proposed solution.  After some investigation I found that the biggest volume differences could be tamed with a few tweaks to the way volume is handled throughout my system.

Here is what I found for my particular setup and media library:
 * The audio of some videos is played over the analog output of my sound card while others are played over SPDIF.  I have both a TRS=>RCA cable (for analog audio) and a spdif cable hooked up between my media director and receiver.
 * Audio on a spdif input of my receiver is played back much louder than similar audio on an analog input.
 * The comfortable listening volume of audio files is different from video files.
 * The comfortable listening volume of mp3, wma, and flac audio files is fairly consistent across my collection.
 * The comfortable viewing volume of videos played back over spdif is fairly consistent across my collection.
 * The comfortable viewing volume of videos played back over analog is fairly consistent across my collection.

To normalize the sound as much as possible I did the following:

Part One - Normalize Pre-amp Volumes
1. Selected a video that played back over spdif and another that played back over analog to use as samples for adjusting volume.
2. Adjusted the pre-amp volume on my receiver such that both the analog and spdif videos played at the same listening volume without adjusting the master volume on my receiver. (iirc the difference was a full 18 dB)

Part Two - Automatic Master Volume Adjustment on Playback
1. Determined my receiver's master volume setting such that a typical video file plays back at a comfortable volume.
2. Determined my receiver's master volume setting such that a typical audio file plays back at a comfortable volume.
3. Created two 'Respond to Events' entries to set the receiver volume to the corresponding volumes when starting video and audio playback, respectively.

Part Three - Enable Audio Compression on Receiver
1. Selected a video with a very high dynamic range audio track.  (I think I used the opening scene of transformers.  Anything with loud action mixed with quiet dialog should work.)
2. I increased the audio compression setting on my receiver until I could hear the dialog and loud action comfortably without adjusting the master volume. (On my receiver the audio compression masquerades as "Night Mode".)

The benefits:
 * Playback is always started with a comfortable listening volume.  No more embarassingly and disturbingly loud initial volume when switching from video to movie or recorded tv show or from movie to mp3 track.
 * Much less adjustment of volume from scene to scene in a movie.

Limitations:
 * I still need to adjust the volume occasionally to get just the right volume.
 * Purists will not like the idea of enabling audio compression full-time.

Hope this helps you or someone else.

Alex

dlewis

  • Guru
  • ****
  • Posts: 401
    • View Profile
Re: HOW DO I Equalise volume on all recordings?
« Reply #6 on: May 10, 2009, 11:01:41 pm »
Is there a way to fix this permanently?

alx9r

  • Guru
  • ****
  • Posts: 187
    • View Profile
Re: HOW DO I Equalise volume on all recordings?
« Reply #7 on: May 10, 2009, 11:06:07 pm »
Is there a way to fix this permanently?

I'm not sure what you mean by permanently.  Do you mean across different user's installations?

dlewis

  • Guru
  • ****
  • Posts: 401
    • View Profile
Re: HOW DO I Equalise volume on all recordings?
« Reply #8 on: May 10, 2009, 11:14:29 pm »
Is there a way to fix this permanently?

I'm not sure what you mean by permanently.  Do you mean across different user's installations?

Meaning a permanent fix, i.e. maybe adding these settings to the webmin, which would make it receiver agnostic.

alx9r

  • Guru
  • ****
  • Posts: 187
    • View Profile
Re: HOW DO I Equalise volume on all recordings?
« Reply #9 on: May 10, 2009, 11:55:47 pm »
Meaning a permanent fix, i.e. maybe adding these settings to the webmin, which would make it receiver agnostic.

Hmm...the actual values for pre-amp volume offsets, and master volume are subjective (i.e. a person listens and makes decisions accordingly).  The values depend on at least the receiver, speaker, and sound chip models and probably also the size of the room and how it's furnished.  That dependence precludes installation-agnostic values.

The process might be able to be made somewhat more user-friendly by implementing a wizard to guide a user through the process.  Normalizing volume in this way is definitely an interactive process.

Alex

dlewis

  • Guru
  • ****
  • Posts: 401
    • View Profile
Re: HOW DO I Equalise volume on all recordings?
« Reply #10 on: May 10, 2009, 11:57:58 pm »

Hmm...the actual values for pre-amp volume offsets, and master volume are subjective (i.e. a person listens and makes decisions accordingly).  The values depend on at least the receiver, speaker, and sound chip models and probably also the size of the room and how it's furnished.  That dependence precludes installation-agnostic values.

The process might be able to be made somewhat more user-friendly by implementing a wizard to guide a user through the process.  Normalizing volume in this way is definitely an interactive process.

Alex

Your last paragraph is what I was referring to.

skeptic

  • Addicted
  • *
  • Posts: 615
    • View Profile
Re: HOW DO I Equalise volume on all recordings?
« Reply #11 on: May 11, 2009, 05:43:13 pm »
The downside of that approach is it assumes all analog output videos are similar, and all spdif output videos are similar, then adjusts analog/spdif to be similar.  Then uses receiver functions ("Night Mode") to deal with videos that have very loud stuff mixed in with quiet stuff.  If I had similar equipment and video files to Alex, this approach could work well, but unfortunately at the moment I don't. 

The best way I can think of would be to have the sound mixer crank up the volume if below a low thresh hold, and lower it below a high one.  This would increase quiet talking without making loud explosions too loud (like a "Night Mode" in a receiver), as well as equal out the volume across all videos.  Unfortunately I don't know of anything that does this. 

The next best universal fix is to process/re-encode the audio tracks of all videos applying an audio filter to do the same thing, which is what I believe the automatic gain feature of avidemux is for. 

This is a problem I deal with constantly by grabbing a remote and changing volume.  In some movies it's a real hassle 'cause the volume varies wildly between loud stuff and quiet.  Now that you have me thinking about an actual solution I'm going to do some googling to see if there is a better way to do this.

alx9r

  • Guru
  • ****
  • Posts: 187
    • View Profile
Re: HOW DO I Equalise volume on all recordings?
« Reply #12 on: May 11, 2009, 06:54:06 pm »
The best way I can think of would be to have the sound mixer crank up the volume if below a low thresh hold, and lower it below a high one.  This would increase quiet talking without making loud explosions too loud (like a "Night Mode" in a receiver), as well as equal out the volume across all videos.  Unfortunately I don't know of anything that does this. 
skeptic,
What you are describing is similar to what an audio compressor does.  "Night Mode" on my receiver is just an audio compressor (aka dynamic range compressor).  The nomenclature here is overloaded, what I mean is described in this wikipedia article:
http://en.wikipedia.org/wiki/Dynamic_range_compression

An aggressive compressor stage in your system would probably get you most of the way there.  It seems like there might be a few ways to accomplish this:
*a software compressor stage acting on audio before it is sent to the sound card
*transcoding your media library with a compressor applied
*use a receiver with an audio compressor built-in
*use a hardware audio compressor like an Alesis 3630 between your soundcard and whatever you are using to drive your speakers

The most effective audio compressors I have worked with are multi-band.  They adjust the gain of different regions of the audio spectrum separately depending on the audio signal.

Hope that helps,

Alex

skeptic

  • Addicted
  • *
  • Posts: 615
    • View Profile
Re: HOW DO I Equalise volume on all recordings?
« Reply #13 on: May 11, 2009, 09:21:45 pm »
The best way I can think of would be to have the sound mixer crank up the volume if below a low thresh hold, and lower it below a high one.  This would increase quiet talking without making loud explosions too loud (like a "Night Mode" in a receiver), as well as equal out the volume across all videos.  Unfortunately I don't know of anything that does this. 
skeptic,
What you are describing is similar to what an audio compressor does.  "Night Mode" on my receiver is just an audio compressor (aka dynamic range compressor).  The nomenclature here is overloaded, what I mean is described in this wikipedia article:
http://en.wikipedia.org/wiki/Dynamic_range_compression
Yes, basically the same.  I was trying to avoid adding in new terms such as audio compression.  What I would like would be audio compression, both upwards (raising volume of quiet stuff) as well as downward compression (lower volume of loud stuff).  I think of this as normalization, which may or may not be the correct term.
Quote

An aggressive compressor stage in your system would probably get you most of the way there.  It seems like there might be a few ways to accomplish this:
*a software compressor stage acting on audio before it is sent to the sound card
*transcoding your media library with a compressor applied
*use a receiver with an audio compressor built-in
*use a hardware audio compressor like an Alesis 3630 between your soundcard and whatever you are using to drive your speakers

The most effective audio compressors I have worked with are multi-band.  They adjust the gain of different regions of the audio spectrum separately depending on the audio signal.

Hope that helps,

Alex
For a solution to be universal to lmce, I think the only way would be what you are referring to as the software compressor stage (within the mixer in my mind).

alx9r

  • Guru
  • ****
  • Posts: 187
    • View Profile
Re: HOW DO I Equalise volume on all recordings?
« Reply #14 on: May 11, 2009, 09:38:10 pm »
For a solution to be universal to lmce, I think the only way would be what you are referring to as the software compressor stage (within the mixer in my mind).
The software compressor stage won't help when the sound card is the audio source only part of the time.  That is, when a receiver is used to switch between, for example, radio, blu-ray players, gaming consoles, and the media director sound card.

Alex