Convert music files from FLAC to ALAC

 
 
  • Gérald Barré

If you store your music files as FLAC and you own an iPhone or an iPad, you know your phone cannot read these files with the Music application… Indeed, Apple uses its format to store music: ALAC. To play your music on your device, you need to convert the files from FLAC to ALAC. I haven't found a good guide for a free solution on the internet to do that, so I've made my own 😃

#What are FLAC and ALAC?

FLAC, Free Lossless Audio Codec, is a free lossless audio codec. FLAC can compress audio to about 50~60% without any quality loss. This format has been widely accepted by many Hi-Fi systems and audiophiles.

ALAC, Apple Lossless Audio Codec, is an audio compressing format, developed by Apple for lossless data compression of digital music. After initially keeping it proprietary from its inception in 2004, in late 2011 Apple made the codec available open-source and royalty-free.

Both formats use a lossless compression algorithm. Thus, you can convert from one format to the other without losing data. It's just another way to store the same data.

#Method 1: Using Foobar2000

If you use foobar2000, you can download the Free Encoder Pack. Then, you can convert all your playlist from foobar2000.

  1. Select the files you want to convert

  2. Select the output format

  3. Click the "convert" button and select the destination folder

#Method 2: Works on Windows, Linux and Mac

Before going into the conversion scripts, you need to download the following tools:

  1. PowerShell Core
  2. flac
  3. ffmpeg

Move flac.exe and ffmpeg.exe in a folder, for instance in C:\tools\. It will be easier to use from the scripts.

  1. Copy your FLAC files in a folder

  2. Start PowerShell Core

  3. Convert FLAC files to WAV

    PowerShell
    $folder = "d:\demo\"
    Get-ChildItem -Recurse "$folder\*.flac" | ForEach-Object {
        & C:\tools\flac.exe -d --force --silent $_.FullName
    }

  4. Convert WAV files to ALAC

    PowerShell
    $folder = "d:\demo\"
    Get-ChildItem -Recurse "$folder\*.wav" | ForEach-Object {
        $filename = [System.IO.Path]::ChangeExtension($_.FullName, ".m4a")
        & C:\tools\ffmpeg.exe -hide_banner -loglevel panic -i $_.FullName -acodec alac -sample_fmt s16p $fileName
    }

  5. Remove FLAC and WAV files

    PowerShell
    Get-ChildItem -Recurse "$folder\*.wav" | Remove-Item
    Get-ChildItem -Recurse "$folder\*.flac" | Remove-Item

Now you folder only contains ALAC files:

You can now use the application you want to copy your music files to your iPhone or iPad.

Do you have a question or a suggestion about this post? Contact me!

Follow me:
Enjoy this blog?Buy Me A Coffee💖 Sponsor on GitHub