The direction index encoder may then be configured to determine whether there are bits remaining from the sub-band ‘pool’ of available bits. 

For example the direction index encoder 225 may be configured to determine a difference value 

diff = (allowed_bits- nb) 

Where diff > 0, in other words there are unused bits from the allocation then these bits may be redistributed to succeeding sub-bands. For example by updating the distribution defined by the array bits_dir1 [i+1 :N-1][0:M-1] 

Where diff =0 or <0 then subtract one bit from the allocation from the succeeding sub-band allocation. For example by updating the distribution defined by the array bits_dir1 [i+1][0] 

Flaving encoded all except the last sub-band then the last sub-band index values are encoded using a fixed rate encoding using a bit allocation defined by dir1 [N-1 ][0:M-1 ] bits. 

These may then be passed to a combiner 207. 

In some embodiments the encoder comprises an energy ratio encoder 223. The energy ratio encoder 223 may be configured to receive the determined energy ratios (for example direct-to-total energy ratios, and furthermore diffuse-to-total energy ratios and remainder-to-total energy ratios) and encode/quantize these. 

For example in some embodiments the energy ratio encoder 223 is configured to apply a scalar non-uniform quantization using 3 bits for each sub- band. 

Furthermore in some embodiments the energy ratio encoder 223 is configured to generate one weighted average value per subband. In some embodiments this average is computed by taking into account the total energy of each time-frequency block and the weighting applied based on the subbands having more energy. 

The energy ratio encoder 223 may then pass this to the combiner which is configured to combine the metadata and output a combined encoded metadata. 

With respect to Figure 3 is shown the operation of the Metadata encoder/quantizer 111 as shown in Figure 2. 

