ALAC info missing / confusing!

hi all,

basically, I want to be able to export direct to ALAC. here, it says that is possible:

http://wiki.audacityteam.org/wiki/FFmpeg_integration

right above the chart:

“Audacity also now supports import and export of 16-bit Apple Lossless (ALAC).”

here it says the opposite:

http://wiki.audacityteam.org/wiki/Exporting_your_Audacity_Project_into_iTunes_and_iPod#M4A_.28Apple_proprietary_format.2C_lossy_and_lossless_variants.29

“Current versions of Audacity can export directly to M4A (AAC, but not ALAC)”

so my question is:

CAN I actually export direct to ALAC as a m4a?

if so, how?

if not, why not?

and does anyone know of a small, nifty lightweight utility to convert FLAC to ALAC?

thx.

Thanks for pointing out the discrepancy.

ALAC export works, but only if you export using (external program). I’ve updated both pages, please see those for more information.

Please post to the Forum board for your operating system if asking questions about encoding and decoding files. Assuming you are still using Windows, try dBPowerAmp .


Gale

thank you!

the command worked great, I was able to import my wav from DVD to audacity natively at 48khz (by first setting it as the project rate prior to import) and then I was able to export it to ALAC as a m4a, and play it in winamp, also at 48khz. so very smooth once I had your knowledge boost!

however, the wav files had some rudimentary tag info, that audacity seemingly recognizes, (as does windows explorer), but unfortunately this info was not populated / xfer’d into the m4a. had to do that part manually. is there a switch I can add to your ALAC command line to xfer tags?

thanks again!

You can explicitly add metadata with something like:

ffmpeg -i - -acodec alac -metadata title=my_title "%f"

but note that a limitation is that the metadata cannot include spaces.

I don’t know if it’s different on Linux, but on Windows (for LAME and FFmpeg) you can include spaces in tags by quoting the tag for example:

ffmpeg -i - -acodec alac -metadata title="cats and dogs" "%f"

This page has some information on permitted FFmpeg tags: FFmpeg Metadata - MultimediaWiki but it could be somewhat out-of-date.

Gale

That’s what should happen, but it didn’t work for me on Linux. Possibly a minor bug. It works fine at the command line, but in Audacity FFmpeg complains because it thinks that a quoted tag is a file.

The project rate should change to the rate of the imported file unless you already have another track present.

Gale

i’ll just enter metadata after the fact. doing it at the command line isn’t for me. I was hoping for an automated way via a switch. no big deal.

well, it didn’t for me.

my wav’s are 48khz b/c they are from DVD. I imported to audacity and first made FLACs, and later noticed the FLACs were 44.1

I then got your post, and on my own, saw the project rate dropbox, set it to 48khz, and imported the wavs. made the ALACs and they were 48khz.

so it would seem Audacity has a small bug, if its supposed to match the files sample rate on import.

here’s another question I have:

what is the version of FFmpeg I should be using?

I installed whatever ver the audacity DL buttons in the prefs sent me to, which looks like 0.6.2

is that the current, latest, stable ver? in the command window when u make an ALAC, it looks like its from 2010/2011.

hmm, I just did an experiment and I can’t reproduce. on wav import and export to flac, the whole thing went at 48khz automatically, even after I changed the default rate in prefs to 44.1

what I can’t explain then, is why my initial FLACs were 44.1? they were, but how that happened I have no idea, as I know I didn’t mess around with the prefs or project rate until AFTER making that initial FLAC.

but if I can’t figure out the steps to reproduce, I can’t prove the bug. I don’t use audio editing much, but i’ll try to keep an eye out from now on. (maybe it has something to do with how things were the last time I used Audacity, or the upgrade I did to 2.0.5 from 2.0.3 I believe)

No it’s not the latest version of FFmpeg. Audacity 2.0.5 for Windows can’t use later than FFmpeg 0.6.2 when importing or when exporting using one of the (FFmpeg) options.

But for exporting using (external program) you can download the latest 32-bit static build from Zeranoe and point the Audacity command to that ffmpeg.exe (using Browse… in the window where you type the alac command we gave you). Obviously I assume you are on Windows - you still have not confirmed that.

The next 2.0.6 release of Audacity is expected to support a much more recent version of FFmpeg for all importing and exporting.


Gale

As I said, if the file you import is the first file in that project window, then the project rate should change to the rate of the file if not already set at that file’s rate.

If after importing a 48000 Hz FLAC you changed the project rate to back to 44100 Hz and imported another 48000 Hz FLAC, the project rate would remain at 44100 Hz.

Perhaps you already had a track in the project when you imported the first FLAC file? If so the project rate would not change to 48000 Hz.

However you should understand that whatever the project rate changes to or doesn’t, the FLAC is imported at its native rate and is not resampled. Look above the Mute / Solo buttons of the track to confirm its rate is still 48000 Hz or whatever its native rate is.

Nonetheless if you have imported a 48000 Hz file and the project rate is at 44100 Hz then the export will at that point be resampled to 44100 Hz (or mixed to 44100 Hz in the project if you choose Tracks > Mix and Render).


Gale

that’s Kool and the Gang, i’ll just wait for that.

I am using win7 64.

if I could though, I’d like to suggest that Audacity support ALAC natively, as it does FLAC, which I think it should be able to now since apple made ALAC open source and royalty free. it would greatly simplify things for casual users like me, and allow tags to xfer like they do for FLAC.

right, ok, and thats the behavior I now seem to be experiencing…

that’s just it, I didn’t. it was blank. the only thing I can think of is I did upgrade just prior… but I am not saying that is related, I just don’t know.

perhaps that then explains it… it would make sense. I think the prefs & project were set 44.1 so on export the wav to flac was converted to 44.1

I know the project rate should have switched as you say, but it didn’t. can’t explain it.

maybe in prefs make it clear that the default project rate is for new recordings only, while the project rate for anything imported will use the first thing imported?

thanks for all your help!

I don’t think we could directly add ALAC support because although it is open source it’s licensed under Apache v2 which isn’t compatible with the Audacity GPL v2 licence.

However after some ferreting around I notice that the libsndfile library that we use for import/export of lossless formats has ALAC support listed in https://github.com/erikd/libsndfile/blob/master/src/sndfile.h.in in their development code. I see that ALAC support is included in their libsndfile 1.2.6 pre-release source code download.

So if ALAC support is added to the 1.2.6 libsndfile release, then when Audacity updates to libsndfile 1.2.6 ALAC export should appear as an encoding option when you export using “Other uncompressed files”. However you won’t be able to export ALAC with M4A extension because libsndfile does not support that. In the libsndfile pre-releases, ALAC encoding is marked as for Apple Core Audio Format CAF extension only.


Gale

The developers would not want explanatory text in the interface however I think the Manual is reasonably clear about the purpose of Default Sample Rate:
Audacity Manual .

The Manual does lack an explanation of the sample rate and sample format at which files are imported, how Default Sample Format affects that and how empty projects affect the project rate when importing, so I have added that to the Importing Audio page in the Manual.

The changes will appear in the Manual for the next release of Audacity.


Gale

hi Gale,

i want to thank you again for your posts and attention to these issues, its very helpful.

i want to build on the previous posts.

now that the current ver is 2.1.1, i was wondering what the situation was regarding ALAC?

i read this:

http://manual.audacityteam.org/o/man/tutorial_exporting_to_itunes.html#alac

and so it would seem that ffmpeg is still needed to create ALAC’s in m4a, is that correct? (albeit using a much newer ver of ffmpeg, but whats the newest that can be used?)

however, in this thread you said it might be possible to natively export ALAC to the CAF format, does that now exist? if so, should it be added to that wiki link?

obviously, i would like to be able to natively export ALAC to m4a, but i understand if its not possible. still, native export to CAF would be helpful, b/c in winamp (using a plugin by Thinktink) i believe it is easy to convert ALAC CAF to ALAC m4a.

any feedback is welcome, and thanks again! Audacity is a truly wonderful project.

The information at http://manual.audacityteam.org/o/man/tutorial_exporting_to_itunes.html#alac is still correct for the upcoming 2.1.2 release.

For exporting via (external program) you can point Audacity to any static build of FFmpeg from Zeranoe, even if very recent.

Audacity is still at libsndfile 1.0.24 at the moment. I will mention the possibility on our developers list of update to 1.0.26 after release of Audacity 2.1.2. There are some security fixes in 1.0.26. The ALAC support probably isn’t that useful given iTunes (at least on Windows) cannot play the saved CAF files. However the ALAC support does include 16-, 20-, 24- or 32-bit files.


Gale

that sounds great. i know the CAF container isn’t very useful; however if i am correct that i can easily convert ALAC CAF to ALAC m4a in winamp, it could be very useful to me (and others) b/c we could then easily & natively create (export) CAF ALAC files with a quick vanilla out of the box Audacity install. that probably sounds a lot more compelling to me than to you, but it would be a really nice improvement from my POV.

thanks for being open to it.

and thanks again for your prompt reply! i will patiently wait to see if its added in 2.1.3

(besides 16 to 32 bit files, afaik ALAC also supports multiple sample rates like 96 or 192khz, and multiple channels, like “5.1” …its like FLAC in that way, and i don’t think it matters which container it is in, insofar as what capabilities it has, but as always i could be mistaken)

Apple has finally decided to fix at least nine of the very old security problems in Quicktime for Windows: APPLE-SA-2016-01-07-1 QuickTime 7.7.9.

Maybe a fix for playing ALAC files in iTunes is also included?

I have to guess here, as I only have CVE’s for security problems. Nothing for bugfixes, besides the usual readme in the download.

I’ll see if I can export/find a .caf file to test with itunes on Mac…