Sounds Logical
Send Page To a Friend

Table Of Contents Previous Page Next Page

[M-Pack 1 overview]

M-Pack 1: WAV file processing: MATLAB function reference

chnmsk2spkrlist
Version 1.2 Requires MATLAB 6.0 (R12) or later

Convert the ChannelMask variable in the WAVE_FORMAT_EXTENSIBLE specification into a readable ordered list of speaker locations. Accepts ChannelMask in decimal, binary, or hexadecimal formats.

If no output arguments specified, results will be displayed on the screen.

File format: m-file
Editable source code:
yes
Utilises non-editable functions: no
Platform:
PC/Windows
Required MATLAB Toolboxes: none (except core MATLAB)
Demo version limitations: p-code only; demo banner displayed
Syntax:

[SpeakerList,ChannelMaskFormats]=chnmsk2spkrlist(ChannelMask);

[SpeakerList, ChannelMaskFormats]

 
=chnmsk2spkrlist(ChannelMask,formatstring);
chnmsk2spkrlist(ChannelMask);
chnmsk2spkrlist(ChannelMask,formatstring);
Arguments:
Inputs:
ChannelMask

value of the ChannelMask variable. Depending on the value of formatstring, the ChannelMask should be of the following type:

formatstring ChannelMask data type
not specified decimal [default] (e.g. 1551 for "5.1 surround format", see examples below)
'decimal' decimal (sames as above)
'binary' string containing binary number (e.g. '11000001111' for "5.1 surround format")
'hex' string containing hexadecimal number (e.g. '60F' for "5.1 surround format")
formatstring

format describing data type for ChannelMask (see table above)

Outputs:
SpeakerList [optional] cell-array of strings containing ordered list of speaker locations
ChannelMaskFormats [optional] structure containing the input ChannelMask expressed in all three formats (i.e. decimal, binary, and hexadecimal)

See the M-Pack 1 overview for a discussion of the WAV_FORMAT_EXTENSIBLE format.

The ChannelMask property is a method for deterministically linking channel numbers (in a multichannel WAV file or device) to speaker locations thereby providing consistency in defining the order in which the channels are laid out in the audio file. Several external standards have been compiled by Microsoft into the following default channel ordering list:

Speaker Location Hexadecimal value Binary bit number Decimal value
Front Left -- FL '1' 1 1
Front Right -- FR '2' 2 2
Front Center -- FC '4' 3 4
Low Frequency -- LF '8' 4 8
Back Left -- BL '10' 5 16
Back Right -- BR '20' 6 32
Front Left of Center -- FLC '40' 7 64
Front Right of Center -- FRC '80' 8 128
Back Center -- BC '100' 9 256
Side Left -- SL '200' 10 512
Side Right -- SR '400' 11 1024
Top Center -- TC '800' 12 2048
Top Front Left -- TFL '1000' 13 4096
Top Front Center -- TFC '2000' 14 8192
Top Front Right -- TFR '4000' 15 16384
Top Back Left -- TBL '8000' 16 32768
Top Back Center -- TBC '10000' 17 65536
Top Back Right -- TBR '20000' 18 131072
Reserved location '80000000' 31 2147483648
All layouts supported 'FFFFFFFF' 32 4294967296

The ChannelMask field in the WAV file indicates which channels are present in the multichannel stream. The least significant bit corresponds with the Front Left speaker, the next least significant bit corresponds to the Front Right Speaker, and so on, continuing in the order defined in the table above. The channels specified in the ChannelMask must be present in the prescribed order (from least significant bit up). In other words, if only Front Left and Front Center are specified, then Front Left should come first in the interleaved stream.

Ref[1]: "Enhanced Audio Formats For Multi-Channel Configurations And High Bit Resolution" Windows Multimedia Group Microsoft Corporation, 1999.

 

  spkrlist2chnmsk     convert speaker list to ChannelMask
  wavinfo     read the header from a WAV file
Examples:

The following examples show the speaker list and corresponding ChannelMask values for a range of popular multichannel layouts:

"3.1 Surround Sound Format"
Channel order:
Front Left, Front Right, Front Center, Low Frequency
ChannelMask (binary):
'1111'
(hexadecimal):
'F'
(decimal):
15
   
"5.1 Surround Sound Format":
Channel order:
Front Left, Front Right, Front Center, Low Frequency, Side Left, Side Right
ChannelMask (binary):
'11000001111'
(hexadecimal):
'60F'
(decimal):
1551
   
"6.1 Surround Sound Format":
Channel order:
Front Left, Front Right, Front Center, Low Frequency, Side Left, Side Right, Back Center
ChannelMask (binary):
'11100001111'
(hexadecimal):
'70F'
(decimal):
1807
   
"7.1 Surround Sound Format":
Channel order:
Front Left, Front Right, Front Center, Low Frequency, Side Left, Side Right, Back Left, Back Right
ChannelMask (binary):
'11000111111'
(hexadecimal):
''63F'
(decimal):
1599
   
Simple stereo pair:
Channel order:
Front Left, Front Right
ChannelMask (binary):
'11'
(hexadecimal):
'3'
(decimal):
3
   
Simple quadraphonic (four-corner):
Channel order:
Front Left, Front Right, Back Left, Back Right
ChannelMask (binary):
'110011'
(hexadecimal):
'33'
(decimal):
51
   
Un-ordered multichannel layout:
Channel order:
Arbitrary speaker arrangement. No prescribed channel mapping.
ChannelMask (binary):
'0'
(hexadecimal):
'0'
(decimal):
0 (specially reserved for this un-ordered case)
   

Top Of Page Table Of Contents Previous Page Next Page

Send Page To a Friend

home - news - products - store - support - site map - company info
© 2007 Sounds Logical. All rights reserved.
Sounds Logical
legal notice - privacy statement