configured to receive the energy ratios and from the analysis generate a quantization resolution for the direction parameters (in other words a quantization resolution for elevation and azimuth values) for all of the time-frequency blocks in the frame. This bit allocation may for example be defined by bits_dir0[0:N-1][0:M-1] The metadata encoder/quantizer 111 may comprise a direction index generator 205. The direction index generator 205 is configured to receive the direction parameters (such as the azimuth (p(k, n) and elevation 0(k, n) 108 and the quantization bit allocation and from this generate a quantized output. In some embodiments the quantization is based on an arrangement of spheres forming a spherical grid arranged in rings on a ‘surface’ sphere which are defined by a look up table defined by the determined quantization resolution. In other words the spherical grid uses the idea of covering a sphere with smaller spheres and considering the centres of the smaller spheres as points defining a grid of almost equidistant directions. The smaller spheres therefore define cones or solid angles about the centre point which can be indexed according to any suitable indexing algorithm. Although spherical quantization is described here any suitable quantization, linear or non-linear may be used. For example in some embodiments the bits for direction parameters (azimuth and elevation) are allocated according to the table bits_direction []; if the energy ratio has the index /, the number of bits for the direction is bits_direction[/]. The structure of the direction quantizers for different bit resolutions is given by the following variables: const short bits_direction [] = { 3 , 5 , 6 , 8 , 9 , 10, 11, 11}; const short no theta [] = /* from 1 to 11 bits */ {/*1, - 1 bit 1,*/ /* 2 bits */ 1 , /* 3 bits */ 2 , /* 4 bits */ 4 , /* 5 bits */ 5 , /* 6 bits */ 6 , /* 7 bits */ 7 , /* 8 bits */