Skip to main content

Notice

Please note that most of the software linked on this forum is likely to be safe to use. If you are unsure, feel free to ask in the relevant topics, or send a private message to an administrator or moderator. To help curb the problems of false positives, or in the event that you do find actual malware, you can contribute through the article linked here.
Topic: Apple users: what type of AIFF is produced by default? (Care to test-convert?) (Read 2764 times) previous topic - next topic
0 Members and 2 Guests are viewing this topic.

Apple users: what type of AIFF is produced by default? (Care to test-convert?)

I don't have access to any appleware myself.
I'd like to know what AIFF/AIFC flavour this "Automatic Selection" here does produce, and whether it depends on source.


The attachment contains 8 mono and 8 stereo files in various formats/endianness/sign, total less than two seconds. Would any Apple user be kind enough to convert to AIFF using this "Automatic Selection" and hand over the converted files? Please specify OS version. I don't even know if macOS and iOS (can) do the same things.

If that dialog box forces you to treat them one by one, you are probably fed up when done either the mono OR the stereo part. Better than nothing  ;)


Re: Apple users: what type of AIFF is produced by default? (Care to test-convert?)

Reply #2
That had some interesting source links, including one that disowns the twos completely and suggests it was never intended to be used.

But those don't answer what appleware nowadays will choose as default target format.

Re: Apple users: what type of AIFF is produced by default? (Care to test-convert?)

Reply #3
What app is that?

Re: Apple users: what type of AIFF is produced by default? (Care to test-convert?)

Reply #4
My bad, I was served this screenshot as the default. From the URL, I see it was wrong.

Does macOS offer a default sound conversion application?

Re: Apple users: what type of AIFF is produced by default? (Care to test-convert?)

Reply #5
My bad, I was served this screenshot as the default. From the URL, I see it was wrong.

Does macOS offer a default sound conversion application?

Not that I know of (except the cli af convert app), and I don't recognize this one.


Re: Apple users: what type of AIFF is produced by default? (Care to test-convert?)

Reply #7
Yeah, from the URL. *facepalms over self*

What will the Apple Music app do, when you request conversion to AIFF like this? https://support.apple.com/en-us/108961
(What bullshit they are serving, that Apple Lossless may degrade quality? Oh well, retire it then.)

Re: Apple users: what type of AIFF is produced by default? (Care to test-convert?)

Reply #8
Well here is what this converter produces with settings as in this screenshot.

Re: Apple users: what type of AIFF is produced by default? (Care to test-convert?)

Reply #9
What will the Apple Music app do, when you request conversion to AIFF like this? https://support.apple.com/en-us/108961
macOS Sonoma 14.7.1, Apple Music 1.4.6.32

It only recognized WAVs. Conversion result when using automatic settings is in  attachment.

Available settings are like this:
X

Re: Apple users: what type of AIFF is produced by default? (Care to test-convert?)

Reply #10
Thanks!

... and oh my ... Apple - of all - not supporting CAF.
The output is old-fashioned AIFF. So Apple first introduced the AIFC variant with subtypes fit for little-endian hardware, then tried to obsolete both of them with CAF - and then they reject CAF so much they won't even convert it, going all the way back to square one.

Not quite all the way - they hook up tags. Not only do they still use ID3v2.2, but they start with an additional botched ID3 header. From what I can read from the spec, an ID3 header should be 10 bytes. These ones start with ID3, then version bytes indicating version an additional five bytes (total eight). Then before the header is complete, follows the next "ID3".

I guess this must be known by insiders, but ... *mumbles something about Internet Explorer*

Re: Apple users: what type of AIFF is produced by default? (Care to test-convert?)

Reply #11
Are you referring to Apple Music not supporting CAF or the AIFF not being CAF?
Either way, both things make sense. The user created AIFF file. If it was in CAF container, it would not be AIFF.
CAF and its 64-bit sizes are not needed with Audio CDs or music tracks that the program handles. And CAF is nowhere near as widely supported as the formats Apple Music can convert to (AAC, MP3, WAV, AIFF, ALAC).

Re: Apple users: what type of AIFF is produced by default? (Care to test-convert?)

Reply #12
CAF was created for apple to request music to be submitted to their store AFAIK.

Re: Apple users: what type of AIFF is produced by default? (Care to test-convert?)

Reply #13
Are you referring to Apple Music not supporting CAF
Yes. Apple Music being unable to convert from CAF source files to any AIFF.

See my .zip attachment to the original post. It includes .caf sources - both big-endian and little-endian.
Background: Some googling led me to the information that Apple had silently "migrated" from old AIFF to AIFC. Of course, don't believe it just because it's on the internet (as Confusius, Mark Twain and Abe Lincoln are repeatedly quoted on). So ... ask someone to try. Since Apple had tried to push CAF, it didn't even strike me that it would be unreadable in their own applications ...

Indeed I wanted to test whether endianness would be preserved, so that CAF-LE would be converted to AIFC-sowt. Moot point, now that it seems Apple has reversed and gone for old AIFF again?!

... I should likely have included both AIFC sources then, to see if those are read in all thinkable flavours. Attached. Which of these work? Anyone? @danadam (who already did the dirty job)?
  • The ones with "sowt" and NONE in the filenames, are generated by flac. I don't know what applications do read "sowt" that aren't 16 bits. Cf. https://hydrogenaud.io/index.php/topic,127175.msg1059384.html#msg1059384 .
  • The ffmpegs are generated with -acodec copy; for unsigned 8-bits that results in type "raw" which I have not found generated elsewhere, but which is a type described for QuickTime, see previous link. WavPack usually does things right, but does not know this one. I suspect there is nothing such in AIFF really, and that ffmpeg devs have just taken the QuickTime types because, if user forces -codec copy then do codec copy and get as close as you can.
  • And a couple of ALACs for good measure.

I do not expect all of these to work! Trying to read these AIFC files with foobar2000 and with @Case's foo_audiomd5 (that uses ffmpeg to decode), I observe:
  • fb2k reads the 8-bit "NONE" and "sowt". IIRC 8-bit "sowt" support was introduced quite recently - and I don't even know if it is supposed to be a thing. And ffmpeg evaluates them to identical MD5 (which do agree with FLAC and WavPack, all OK here.)
  • fb2k also reads the 8-bit "raw" that ffmpeg creates, and bitcompares it to identical to the "NONE" and "sowt". Edit: The reason why ffmpeg evaluates that "raw" to a different MD5, is because it is unsigned, like .wav - it returns same MD5 as for the corresponding .wav. This is because ffmpeg - like WavPack - evaluates MD5 in source's endianness and signedness. FLAC on the other hand, converts everything to signed little-endian.
  • 16-bit files are all read and all OK. Two MD5s are produced because FLAC evaluates MD5 as if little-endian, while ffmpeg and WavPack evaluate in the source file's byte order.
  • 24-bit: 
. One %audiomd5% for AIFC-NONE, matching WavPack's MD5 - that's because they evaluates from source's byte order
. One %audiomd5% for flac-generated "sowt", matching WavPack's MD5 and also FLAC's since FLAC evaluates as little-endian.
foobar2000 cannot play the flac-generated "sowt" (maybe 24-bit sowt isn't supposed to be a thing?), but foo_audiomd5 can pass it on to ffmpeg which will return the same MD5.
. What about the "raw"? No, ffmpeg cannot read it. It happily produces an "aifc" it cannot read.


This was a can of worms ... and I started by touching the wrong lid.

Re: Apple users: what type of AIFF is produced by default? (Care to test-convert?)

Reply #14
... I should likely have included both AIFC sources then, to see if those are read in all thinkable flavours. Attached. Which of these work?
Looks like all but atest1ch-24_0.ffmpeg.aifc.

Also libsndfile has problems only with this file:
Code: [Select]
]$ sndfile-info atest1ch-24_0.ffmpeg.aifc
Error : Not able to open input file atest1ch-24_0.ffmpeg.aifc.
File : atest1ch-24_0.ffmpeg.aifc
Length : 31824
FORM : 31816
 AIFC
 FVER : 4
 COMM : 24
  Sample Rate : 44100
  Frames      : 10584
  Channels    : 1
  Sample Size : 24
AIFC : Unimplemented format :

File contains data in an unimplemented format.

Re: Apple users: what type of AIFF is produced by default? (Care to test-convert?)

Reply #15
Oh, it is worse. These two files come back as 16-bit with half the length:
atest1ch-08_0.sowt.aif
atest2ch-08_0.sowt.aif

For what this single test is worth, it suggests that:
  • either FLAC writes wrong 8-bit sowt
  • or Apple Music cannot read 8-bit sowt properly
  • or possibly: 8-bit sowt should not exist and therefore there is no "right" way to read nor write them

(@ktf, this might inform something about what flac -o filename.aifc should not do, to be safe?)


As for ffmpeg, it is easier to conclude that ffmpeg does wrong things, when it writes files it cannot read.

Re: Apple users: what type of AIFF is produced by default? (Care to test-convert?)

Reply #16
Look at ffmpeg git history for aiff/c changes perhaps this was fixed some sample in wild, and than aiff muxer was not properly updated?


Re: Apple users: what type of AIFF is produced by default? (Care to test-convert?)

Reply #18
what ffmpeg command you used to produce unsupported file?

Re: Apple users: what type of AIFF is produced by default? (Care to test-convert?)

Reply #19
ffmpeg -i infile.wav -codec copy outfile.aiff

I was trying to test for little-endian AIFC (sowt), and then to my surprise, ffmpeg produced a type "raw" which I have never seen in anything AIFF before.

Then the question arose - from that screenshot, which I mistook for a default app - whether sowt would/should exist for 24 bits.

Actually, I see now that ffmpeg refuses to do -acodec pcm_s24le outfile.aiff
Also I see that if I give
flac -d 24bitfile.flac --force-aiff-sowt-format
then it produces a file that ffmpeg thinks is 16-bit sowt

And I have yet to find the current AIFC spec ...

Re: Apple users: what type of AIFF is produced by default? (Care to test-convert?)

Reply #20
As for ffmpeg, it is easier to conclude that ffmpeg does wrong things, when it writes files it cannot read.
I can make it produce correct 24-bit aif file, in the sense that sndfile-convert can read and convert it properly. To do that I added the mapping between S24LE codec and "sowt" tag in libavformat/aiff.c:
Code: [Select]
     { AV_CODEC_ID_PCM_S16BE,    MKTAG('t','w','o','s') },
     { AV_CODEC_ID_PCM_S16LE,    MKTAG('s','o','w','t') },
+    { AV_CODEC_ID_PCM_S24LE,    MKTAG('s','o','w','t') },
     { AV_CODEC_ID_ADPCM_IMA_QT, MKTAG('i','m','a','4') },
     { AV_CODEC_ID_QDMC,         MKTAG('Q','D','M','C') },
Apple Music then reads such file but treats it as 16-bit. Without additional modifications ffmpeg also treats it at 16-bit.

The map/list above is used during encoding to find the tag corresponding to the codec. Without the change, it was storing bytes "01 00 00 00", with the change it stores "73 6f 77 74" (ie. "sowt").

During decoding things are more complicated. It also uses that map but there are many entries with the same value there:
Code: [Select]
const AVCodecTag ff_codec_aiff_tags[] = {
    { AV_CODEC_ID_PCM_S16BE,    MKTAG('N','O','N','E') },
    { AV_CODEC_ID_PCM_S8,       MKTAG('N','O','N','E') },
    { AV_CODEC_ID_PCM_U8,       MKTAG('r','a','w',' ') },
    { AV_CODEC_ID_PCM_S24BE,    MKTAG('N','O','N','E') },
    { AV_CODEC_ID_PCM_S32BE,    MKTAG('N','O','N','E') },
...
    { AV_CODEC_ID_PCM_S16LE,    MKTAG('s','o','w','t') },
    { AV_CODEC_ID_PCM_S24LE,    MKTAG('s','o','w','t') },    // <--- added by me
This is handled in libavformat/aiffdec.c:
Code: [Select]
        par->codec_id  = ff_codec_get_id(ff_codec_aiff_tags, par->codec_tag);    // <--- A
...
    if (version != AIFF_C_VERSION1 || par->codec_id == AV_CODEC_ID_PCM_S16BE) {
        par->codec_id = aiff_codec_get_id(par->bits_per_coded_sample);           // <--- B
        par->bits_per_coded_sample = av_get_bits_per_sample(par->codec_id);
For files with "NONE" it will first (A) find S16BE codec regardless of the actual bit-depth, because S16BE is the first entry with "NONE" in the map. Then (B) it will get proper S__BE codec based on the actual bit-depth field from the file.

To properly read "sowt" files a similar thing has to be done for S__LE codecs.

Re: Apple users: what type of AIFF is produced by default? (Care to test-convert?)

Reply #21
Apple Music then reads such file but treats it as 16-bit.
Oh, btw, the 24-bit sowt file from earlier (atest-aifc-and-alac-sources) is also treated as 16-bit and comes longer and heavily distorted.

Re: Apple users: what type of AIFF is produced by default? (Care to test-convert?)

Reply #22
As for the  afconvert, there is a manual page at https://ss64.com/mac/afconvert.html

Apparently it doesn't handle little-endian (sowt) AIFC - but it can do unsigned 8-bit. I.e. the "raw" according to ffmpeg.

Has Apple silently obsoleted the sowt altogether?