Help - Search - Members - Calendar
Full Version: Multi-channel FLAC and DVD-Audio authoring
Hydrogenaudio Forums > Lossless Audio Compression > FLAC
davechapman
As some of you might know, I'm working on a DVD-Audio authoring program (dvda-author). The project page is here:

http://dvd-audio.sourceforge.net

There is also a HA thread about the project here

Current status is that dvda-author is able to author DVD-Audio discs from mono or stereo 16-bit audio at all 6 DVD-Audio samplerates (44.1KHz, 48KHz, 88.2KHz, 96KHz, 176.4KHz and 192KHz). It also supports up to 9 "groups" of tracks on the same DVD.

20-bit/24-bit and multi-channel support are next on my to-do list, which is why I'm posting here - I would like feedback on how multi-channel audio support should be added, and which are the important features to potential users.

The DVD-Audio standard supports any number of channels between 1 and 6, and (when using 3 or more channels) you have a choice about which speakers those channels are mapped to.

For example, with 3-channel audio, you could assign the channels to Left, Right and Centre, or to Left, Right and Rear, or to Left, Right and Lfe.

Another feature of DVD-Audio is the ability to assign the channels in a multichannel track to one of two groups, and use different audio formats for those two groups. e.g. in a 6-channel track, you could use 24-bit/96KHz audio for the front 3 channels, and 16-bit/48KHz audio for the other 3 channels. This combination requres 9.216Mbps, which comes in under the DVD-Audio limit of 9.6Mbps for uncompressed LPCM audio.

You can also specify custom downmixing co-efficients to enable multi-channel sound to be played back in Stereo. All DVD-Audio players have to support software downmixing.

I am also planning to incorporate a FLAC decoder into dvda-author to enable authoring of DVD-Audio discs directly from FLAC input files.

I am curious to know if anyone is actually using multi-channel FLAC, and if any applications (apart from the reference en/decoder) currently support it.

I would like to be able to pick up the channel assignments from meta-data in the FLAC file itself, but I'm assuming there are no standards for this kind of meta-data. For 1-channel (mono) and 2-channel (stereo) FLAC files, the channel assignment is obvious. but are there any de-facto standards for the channel assignments for multi-channel audio? How should an application know where the 6 channels should be mapped to, and in which order?

Is there even a standard for multi-channel WAV files?

As far as I can tell, the de-facto standard for multi-channel audio is to use seperate mono WAV files, but this seems a very inconvenient way to do things, so I would like to offer the choice of something better in my DVD-Audio authoring application.

Regards,

Dave.
unfortunateson
I havent tried multichannel FLAC before, but applications like Adobe Audition allow output 5.1 using one of three methods - one 6 channel wave file, 6 mono wave files, and one 6 channel Windows Media Pro (CBR, VBR, or lossless) file.
davechapman
QUOTE(unfortunateson @ Mar 24 2005, 12:50 AM)
I havent tried multichannel FLAC before, but applications like Adobe Audition allow output 5.1 using one of three methods - one 6 channel wave file, 6 mono wave files, and one 6 channel Windows Media Pro (CBR, VBR, or lossless) file.
*



When you output a 6-channel wave file from Adobe Audition, what is the order of the channels? I'm guessing channel 0 is left, channel 1 is right, but what about the other 4?

Dave.
spoon
Here is what Microsoft say:

Default Channel Ordering
The way to deterministically link channel numbers to speaker locations, thus providing consistency among multiple channel audio files, is to define the order in which the channels are laid out in the audio file. Several external standards define parts of the following master channel layout:

1. Front Left - FL
2. Front Right - FR
3. Front Center - FC
4. Low Frequency - LF
5. Back Left - BL
6. Back Right - BR
7. Front Left of Center - FLC
8. Front Right of Center - FRC
9. Back Center - BC
10. Side Left - SL
11. Side Right - SR
12. Top Center - TC
13. Top Front Left - TFL
14. Top Front Center - TFC
15. Top Front Right - TFR
16. Top Back Left - TBL
17. Top Back Center - TBC
18. Top Back Right - TBR

------------------

In a Waveformatextensible wave file you can specify which speakers are present.

As far as mappings in software - mp4/aac + ogg are different. I have not seen any code for FLAC that juggles the channels around so I am guessing they are as default mappings for unspecified Wave files.

But again - if you have 3 channel it can either be L + R + C or L + R + LFE (sub-woofer).
davechapman
QUOTE(spoon @ Mar 24 2005, 01:17 AM)
Here is what Microsoft say:


Thanks for that. Do you know if that standard is universally adhered to by applications supporting multi-channel WAV?

QUOTE
In a Waveformatextensible wave file you can specify which speakers are present.


Do you have any references for that?

My understanding is that FLAC ignores all but the very basic WAV meta-data, so am I right in saying that that information would be lost when a multi-channel WAV is converted to FLAC?

QUOTE
As far as mappings in software - mp4/aac + ogg are different. I have not seen any code for FLAC that juggles the channels around so I am guessing they are as default mappings for unspecified Wave files.


I'm assuming that when you say "ogg", you are thinking about Vorbis. But does that mean that a FLAC file in an Ogg container would be able to contain extra multi-channel metadata?

QUOTE
But again - if you have 3 channel it can either be L + R + C  or L + R + LFE (sub-woofer).


Or (in the DVD-Audio spec), L + R + S (surround).

I'm not worried about supporting non-standard mappings (I will add options to specify those), but I just want to make sure that my program uses sensible defaults for the mappings, and adheres to any existing standards or conventions.

Thanks,

Dave.
spoon
QUOTE
Thanks for that. Do you know if that standard is universally adhered to by applications supporting multi-channel WAV?


I would say application handling in general of > 2 channels is poor, I will not even mention audio files with 3 to 5 channels, take a good standard 5.1 - what you have here is:

Wave files as above from Microsoft.
AAC/Mp4 file (internally have a different mapping (I dont have it to hand),
Ogg Vorbis internally has 6 channel as L + C + R + LFE + BL + BR

QUOTE
Do you have any references for that?


There is an extra field dwChannelMask in WFXEX, it is only a DWORD and specifies what data is present, not the order. The mapping bits are:

CODE

// MicroSoft channel definitions (in correct default unspecified order)
#define SPEAKER_FRONT_LEFT             0x1
#define SPEAKER_FRONT_RIGHT            0x2
#define SPEAKER_FRONT_CENTER           0x4
#define SPEAKER_LOW_FREQUENCY          0x8
#define SPEAKER_BACK_LEFT              0x10
#define SPEAKER_BACK_RIGHT             0x20
#define SPEAKER_FRONT_LEFT_OF_CENTER   0x40
#define SPEAKER_FRONT_RIGHT_OF_CENTER  0x80
#define SPEAKER_BACK_CENTER            0x100
#define SPEAKER_SIDE_LEFT              0x200
#define SPEAKER_SIDE_RIGHT             0x400
#define SPEAKER_TOP_CENTER             0x800
#define SPEAKER_TOP_FRONT_LEFT         0x1000
#define SPEAKER_TOP_FRONT_CENTER       0x2000
#define SPEAKER_TOP_FRONT_RIGHT        0x4000
#define SPEAKER_TOP_BACK_LEFT          0x8000
#define SPEAKER_TOP_BACK_CENTER        0x10000
#define SPEAKER_TOP_BACK_RIGHT         0x20000


QUOTE
My understanding is that FLAC ignores all but the very basic WAV meta-data, so am I right in saying that that information would be lost when a multi-channel WAV is converted to FLAC?


Yes, this is true for everything (AFAIK) except WFXEX and WMA (off the top of my head) which can have Channel Mask. Ogg Vorbis and FLAC don't have such channel indications. I was in a discussion about Wavpack and RIFF chunks, if it stores the waveformat riff chunk then that is one of the few that stores what is contained.

WAVEFORAMEXTENSIBLE is well documented on the online MSDN. I have yet to see anything use the channel indicators, you are lucky if a program will read a WFXEX header and translate to WFX (an easy process) so they can read those files.

I would say on the PC there is:

1 channel Mono
2 Channel Stereo
4 Channel Quad
6 Channel 5.1
8 Channel 7.1

and depending upon the audio format determines the order these channels are.

I have over the last week been working on a Channel mapping matrix class (to handle conversions from say 4 channel to 7.1), as far as the user editing values I have chosen (perhaps some are wrong):

// Mono (Centre)
// Stereo (Left + Right)
// 2.1 (Left + Right + LFE)
// Quadraphonic (Left + Right + BackLeft + BackRight)
// Surround (Left + Right + Center + BackLeft + BackRight)
// 5.1 Surround (Left + Right + Center + LFE + BackLeft + BackRight)
// 7 Channel (Bit Wierd)
// 7.1 Theater (Left + Right + Center + LFE + BackLeft + BackRight + SideLeft + SideRight)

It could be that 3 channel L + R + C is more standard than L + R + LFE
spoon
That said with 18 speaker definitions I think it will be awhile before DVDs have 17.1 surround sound smile.gif
bryant
QUOTE(spoon @ Mar 24 2005, 02:05 AM)
Yes, this is true for everything (AFAIK) except WFXEX and WMA (off the top of my head) which can have Channel Mask. Ogg Vorbis and FLAC don't have such channel indications. I was in a discussion about Wavpack and RIFF chunks, if it stores the waveformat riff chunk then that is one of the few that stores what is contained.

WAVEFORAMEXTENSIBLE is well documented on the online MSDN. I have yet to see anything use the channel indicators, you are lucky if a program will read a WFXEX header and translate to WFX (an easy process) so they can read those files.
*


Yes, WavPack stores all the RIFF chunks verbatim so that it can always restore the .wav file exactly. I also found that I had to interpret the channel mask to encode multichannel sensibly. WavPack native blocks may have 1 or 2 channels, so for multichannel I had to group the channels in a reasonable way using the mask. For example, you wouldn't want left surround grouped with LFE (it would work for lossless, but would not be as efficient as grouping "similar" channels and would be downright silly in lossy mode).

The problem comes with samples that don't use WAVEFORMATEXTENSIBLE because then you really have no idea what the order is. I decided to still use the Microsoft order in those cases, but I've definitely seen samples that weren't in that order. I considered displaying a warning about ambigious channels assignments... sad.gif
tillywilly
This is my first post, seems I missed most of this discussion by a month, but I mess around with this stuff all the time. I have Audition, Surcode DTS Encoder, a Dolby AC3 Encoder, and even that funky Microsoft utility "WavAviMux" that wraps your 6 seperate files in an AVI wrapper (then what?). I was writing a post in another forum about DVD-Audio and multi-channel support, and I wanted to mention FLAC, googled it, and here you guys are talking about all of it. I was also saying how many DVD Authoring Apps don't support waveformatextensible yet, and certainly not mult-channel FLAC, etc., and here you are building one. Dave, I just wanted to give you all the encouragement I can, and I have to d/l your alpha version and check it out.

By the way, it looks like most of your questions were answered, all I can throw in is that the DTS encoder, which has 6 channels (sorry, not 18), matches Microsoft's order exactly, if you didn't already know. Also, here's a long-ass article with a lot of references to companies and people who work on on surround sound, if you haven't run across it:

http://www.surroundassociates.com/fqmain.html#2.1

After this project, maybe you can build an improved Ambisonic app so we can turn 2 channels into 6 without spending hours building graphs and learning advanced acoustical integrated molecular quantum calculus.

Good luck-Dave
tillywilly
And for my second post, Spoon, the legend, thank you for all the times I have only had to right click to change the sample rate of my audio files, or convert them in the wink of an eye. I am way over my head in this thread, aren't I?
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2008 Invision Power Services, Inc.