Audio: Difference between revisions

From Han Wiki
Jump to navigation Jump to search
Adjusting equalizer ==
 
(3 intermediate revisions by the same user not shown)
Line 1: Line 1:
= Notes on EQ =
== Adjusting equalizer ==
<pre>
human ears can hear 20 Hz to 20kHz
most human hearing tops out around 15kHz or 16kHz
piano's highest note is about 4.2kHz
overtunes 10 to 14 kHz
most of ears really focus on live between 60 hz ~ 4000 hz ("meat of music)
first thing you want to try with EQ is to decrease the level of a frequency, rather than increase it.
Sub bass 20 - 60 Hz
Bass 60 - 200 Hz
- around 200 Hz affect the very lowest boom of acoustic guitars, piano, vocals, lower brass, and strings
(change heaviness of sound)
Upper bass to lower midrange 200 - 800 Hz
- lighter side of the low end
- add EQ volume around the middle of this spectrum (add a bit of oomph)
- moving to 800 Hz region, affects the body of instruments
Midrange 800 Hz to 2 kHz
- Putting on the brakes in this region can take away the brittle sound of instruments
- Gives metallic touch -- not good for ears if pushed
Upper mids 2 kHz to 4 kHz
- Adding a little push here can give more clarity to vocal consonances, as well as acoustic and electric guitar and piano.
Presence/siblance register 4kHz to 7kHz
The top end of this region is also responsible for the sharp hissing “s” of vocals, known as sibilance.
Brilliance/sparkle register 7 kHz to 12 kHz
- Raising or decreasing the level at the lower end of this register can help bring some vibrance and clarity, adding a tighter attack and a more pure sound. If things are a little too sharp, or causing some pain after listening for too long, lowering the bottom end of this register can help out quite a bit. Toward the top is where things start to space out into less tangible definition, moving away from what you can hear and more toward what you can feel. That shimmering resonance at the tip of a cymbal crash floats around in the regions of this space
Open air: 12kHz to 16kHz
Once you get up here, things really become more subjective. The bottom registers continue to affect the higher overtones of instrumentation, and synth effects from electronic music can pop around in that region as well. Moving further up, it becomes more about creating a spacier, open sound. However, there are very few points in which you’d want to affect the sound much around 14kHz or above — many older listeners won’t be able to even hear these sounds. If you want to boost a bit of space in the belfries of the music, you can add some level here. Too much, however, will make things start to sound synthetic.
</pre>
= LAME =
= LAME =
== Converting audio files ==
== Converting audio files ==
Line 14: Line 58:
=== multiple files for speech ===
=== multiple files for speech ===


I had a bunch of old, large audio files that were recorded from a mixer. It recorded at stereo 44 kHz, 256kbps.  There were just a lot of them, and in order to save space I modified a PowerShell script for myself. The original source can be found at [https://rolfeleveld.wordpress.com/2014/12/20/mp3-music-too-large-solved-with-powershell-and-lame/ Rolf Eleveld's Blog]. This handles all files, including subfolders recursively.  When you try to use the script for the first time, you may want to uncomment the wait for key press lines (lines 94 & 95), and remove line 96--it overwrites the original file with converted one.
I had a bunch of old, large audio files that were recorded from a mixer. It recorded at stereo 44 kHz, 256kbps.  There were just a lot of them, and in order to save space I modified a PowerShell script for myself. The original source can be found at [https://rolfeleveld.wordpress.com/2014/12/20/mp3-music-too-large-solved-with-powershell-and-lame/ Rolf Eleveld's Blog]. This handles all files, including subfolders recursively.  When you try to use the script for the first time, you may want to uncomment the wait for key press lines (lines 99 & 100), and comment out line 97--it overwrites the original file with converted one.
 
You can change the target parameters on line 62.


<source lang="ps1" line highlight="61,94-95">
<source lang="ps1" line highlight="62,97,99-100">
#PowerShell script
#PowerShell script


# Update $sourceRoot here to point to the folder where you keep  
# Update $sourceRoot here to point to the folder where you keep  
$sourceRoot = "M:\audio\2015";
$sourceRoot = "M:\audio\2015";
$lameExecutable = "C:\Files\tools\lame.exe";
$albumTitle = "Speech for Year 2015";
$albumTitle = "Speech for Year 2015";
$genreName = "Speech";
$genreName = "Speech";
Line 77: Line 124:
     if( $bitrate -gt $maximumBitRate ) {
     if( $bitrate -gt $maximumBitRate ) {
       #Create the file processing string, note that my Lame is deployed into the public applications folder, this allows me to run the script from all accounts  
       #Create the file processing string, note that my Lame is deployed into the public applications folder, this allows me to run the script from all accounts  
       $expression = "C:\Files\tools\lame.exe --resample 22.05 -m m -b 48";
       $expression = "$lameExecutable --resample 22.05 -m m -b 48";
       # include -B$maximumBitRate in the call to Lame??-V2 should give atotal average around 190 Kbps, but since we trust the shell object it's only looking at the average of the first few seconds
       # include -B$maximumBitRate in the call to Lame??-V2 should give atotal average around 190 Kbps, but since we trust the shell object it's only looking at the average of the first few seconds
       # if needed to use a fixed bitrate use: -b192 instead of -V2
       # if needed to use a fixed bitrate use: -b192 instead of -V2

Latest revision as of 17:37, 1 April 2018

Notes on EQ

Adjusting equalizer

human ears can hear 20 Hz to 20kHz
most human hearing tops out around 15kHz or 16kHz
piano's highest note is about 4.2kHz
overtunes 10 to 14 kHz

most of ears really focus on live between 60 hz ~ 4000 hz ("meat of music)

first thing you want to try with EQ is to decrease the level of a frequency, rather than increase it.

Sub bass 20 - 60 Hz

Bass 60 - 200 Hz
- around 200 Hz affect the very lowest boom of acoustic guitars, piano, vocals, lower brass, and strings
(change heaviness of sound)

Upper bass to lower midrange 200 - 800 Hz
- lighter side of the low end
- add EQ volume around the middle of this spectrum (add a bit of oomph)
- moving to 800 Hz region, affects the body of instruments

Midrange 800 Hz to 2 kHz
- Putting on the brakes in this region can take away the brittle sound of instruments
- Gives metallic touch -- not good for ears if pushed

Upper mids 2 kHz to 4 kHz
- Adding a little push here can give more clarity to vocal consonances, as well as acoustic and electric guitar and piano.

Presence/siblance register 4kHz to 7kHz
The top end of this region is also responsible for the sharp hissing “s” of vocals, known as sibilance.

Brilliance/sparkle register 7 kHz to 12 kHz
- Raising or decreasing the level at the lower end of this register can help bring some vibrance and clarity, adding a tighter attack and a more pure sound. If things are a little too sharp, or causing some pain after listening for too long, lowering the bottom end of this register can help out quite a bit. Toward the top is where things start to space out into less tangible definition, moving away from what you can hear and more toward what you can feel. That shimmering resonance at the tip of a cymbal crash floats around in the regions of this space

Open air: 12kHz to 16kHz

Once you get up here, things really become more subjective. The bottom registers continue to affect the higher overtones of instrumentation, and synth effects from electronic music can pop around in that region as well. Moving further up, it becomes more about creating a spacier, open sound. However, there are very few points in which you’d want to affect the sound much around 14kHz or above — many older listeners won’t be able to even hear these sounds. If you want to boost a bit of space in the belfries of the music, you can add some level here. Too much, however, will make things start to sound synthetic.

LAME

Converting audio files

  • Last tested with LAME 3.99.5 (64-bits) on Windows 10 (10.0.14393)

for speech

Downsampling to mono 22.05 KHz with CBR of 48 kbps (works fine for recording of speech)

C:\Files> lame --resample 22.05 -m m -b 48 source.mp3 target.mp3

multiple files for speech

I had a bunch of old, large audio files that were recorded from a mixer. It recorded at stereo 44 kHz, 256kbps. There were just a lot of them, and in order to save space I modified a PowerShell script for myself. The original source can be found at Rolf Eleveld's Blog. This handles all files, including subfolders recursively. When you try to use the script for the first time, you may want to uncomment the wait for key press lines (lines 99 & 100), and comment out line 97--it overwrites the original file with converted one.

You can change the target parameters on line 62.

#PowerShell script

# Update $sourceRoot here to point to the folder where you keep 
$sourceRoot = "M:\audio\2015";
$lameExecutable = "C:\Files\tools\lame.exe";
$albumTitle = "Speech for Year 2015";
$genreName = "Speech";

# just to make sure we have the right index for bitrate, and ID3 tags these will be set in the first cycle
$bitrateAttribute = 0;
$titleAttribute = 0;
$contribAttribute = 0;
$genreAttribute = 0;
$albumAttribute = 0;
$yearAttribute = 0;
$trackAttribute = 0;
$maximumBitRate = 50;

#interact with the file-system (extensions)
$shell = new-object -com shell.application
# get a list of all files that exist in the subdirectory of type mp3
#directory object does not return folder name as per http://stackoverflow.com/questions/1153819/get-list-of-files-recursively-by-bit-rate-in-powershell
$files = Get-ChildItem -LiteralPath $sourceRoot -Filter '*.mp3' -Recurse -File -ErrorAction SilentlyContinue

$files | foreach {
  # only process Audio files of type MP3
  #filesystem reference object
  $directoryObject = $shell.NameSpace( $_.Directory.FullName );
  #object reference to instance of the file in context of the filesystem
  $file = $directoryObject.ParseName( $_.Name );
  #name placeholders of the file
  $currentFileName = $_.FullName;
  $newFileName = $_.DirectoryName+"\_"+$_.Name
  # see http://blogs.technet.com/b/heyscriptingguy/archive/2008/08/13/how-can-i-find-files-metadata.aspx how it may work.
  # Find the index of the bit rate attribute, if necessary.
  for( $index = 5; -not ($bitrateAttribute -and $titleAttribute) -and $index -le 266; ++$index ) {
    $name = $directoryObject.GetDetailsOf( $directoryObject.Items, $index )
    if( $name -eq 'Bit rate' ) { $bitrateAttribute = $index }
    if( $name -eq 'Title' ) { $titleAttribute = $index }
    if( $name -eq 'Contributing artists' ) { $contribAttribute = $index }
    if( $name -eq 'Genre' ) { $genreAttribute = $index }
    if( $name -eq 'Year' ) { $yearAttribute = $index }
    if( $name -eq 'Album' ) { $albumAttribute = $index }
    if( $name -eq '#' ) { $trackAttribute = $index }
    [System.String]::Format("Attribute: {0} - has index {1} with value: {2}", $name, $index, $directoryObject.GetDetailsOf( $file, $index ) )
  }
  #get song Details and ID3 tag
  $songBitrate = $directoryObject.GetDetailsOf( $file, $bitrateAttribute );
  $songTitle = $directoryObject.GetDetailsOf( $file, $titleAttribute );
  $songArtist = $directoryObject.GetDetailsOf( $file, $contribAttribute );
  $songGenre = $directoryObject.GetDetailsOf( $file, $genreAttribute );
  $songYear = $directoryObject.GetDetailsOf( $file, $yearAttribute );
  $songAlbum = $directoryObject.GetDetailsOf( $file, $albumAttribute );
  $songTrack = $directoryObject.GetDetailsOf( $file, $trackAttribute );
  # If the file has the desired bit rate, include it in the results.
  [System.String]::Format("Looking at file: {0} with bitrate {1}", $_.Name, $songBitrate )
  # Get the bit rate of the file.
  if( $songBitrate -match '\d+' ) {
    [int]$bitrate = $matches[0];
    if( $bitrate -gt $maximumBitRate ) {
      #Create the file processing string, note that my Lame is deployed into the public applications folder, this allows me to run the script from all accounts 
      $expression = "$lameExecutable --resample 22.05 -m m -b 48";
      # include -B$maximumBitRate in the call to Lame??-V2 should give atotal average around 190 Kbps, but since we trust the shell object it's only looking at the average of the first few seconds
      # if needed to use a fixed bitrate use: -b192 instead of -V2
      if (![System.String]::IsNullOrWhiteSpace($songTitle)) {
        $songTitle = $songTitle.Replace("""","'");
        $expression += " --tt ""$songTitle""";
      }
      if (![System.String]::IsNullOrWhiteSpace($songArtist)) {
        $songArtist = $songArtist.Replace("""","'");
        $expression += " --ta ""$songArtist""";
      }
      if (![System.String]::IsNullOrWhiteSpace($songAlbum)) {
        $songAlbum = $songAlbum.Replace("""","'");
        $expression += " --tl ""$songAlbum""";
      } else {
        $expression += " --tl ""$albumTitle""";
      }
      if ($songYear -match '\d+') {
        $expression += " --ty $songYear";
      }
      if ($songTrack -match '\d+') {
        $expression += " --tn $songTrack ";
      }
      if (![System.String]::IsNullOrWhiteSpace($songGenre)) {
        $songGenre = $songGenre.Replace("""","'");
        $expression += " --tg ""$songGenre""";
      } else {
        $expression += " --tg ""$genreName""";
      }
      $expression += " --ignore-tag-errors ""$currentFileName"" ""$newFileName""";
      #just to see what is going on??$expression;
      # rename the file
      #Rename-Item -LiteralPath $currentFileName -NewName $newFileName
      # process the file
      Invoke-Expression -Command $expression
      Move-Item -Force "$newFileName" "$currentFileName"
      # wait for a keypress
      # Write-Host "Press any key to continue ..."
      # $x = $host.UI.RawUI.ReadKey("NoEcho,IncludeKeyDown")
    }
  }
}