I am attempting to create an ambisonic encoder and decoder object set for MaxMSP5. Although I seem to have been able to create the objects I cannot get them to function correctly.
The main processing has been built into a DSP chain using the standard 'svec' process. The result however is distorted audio, which is apparently quite a difficult issue to resolve. The formulas used are:
*out1 = *in1 * 1 / sqrt2
*out2 = *in1 * cos(A) * sin(E)
*out3 = *in1 * sin(A) * cos(E)
*out4 = *in1 * sin(E)
As this is the most simple (first order, non velocity orientated) encoder I cannot seem to find an issue.
The decoder process is then set for 'n' speakers as:
*Speaker = 1 / n * (*in1 / sqrt2 + *in2 *cos(A) * *cos(E) + *in3 * sin(A) * cos(E) + *in4 * sin(E))
Where A is azimuth, E is elevation and n is number of speakers.
In order to do the encoding/decoding in real time will I need to implement a buffer system that is more advanced than svec?
Many thanks in advance, it is something I am really struggling with, any suggestions are extremely appreciated.