Sorry for reviving an older thread, but I just came across this, thought I would add my discoveries.
I also had the exact same issues when using the WM8731 codec on my TGA Pro board which I reported in
this thread. Turning on the I2S first, then attempting to configure the codec with I2C has reliability issues where the CODEC I2C transfers are occasionally corrupted. I was unable to produce the problem with the SGTL5000 board. Suffice it to say, the SGTL is robust to the the I2S bus being active before the codec has been properly configured. I think the other codecs (at least the WM8731 and perhaps the AK4558) have issues if you don't configured the CODEC first.
Since the I2S Audio objects turn on the I2S bus in their constructors, and usually the objects are global, the bus will always turn on before you can configure the codec in the setup() function.
I found several workarounds:
1) Modify the audio library so that the I2S objects do not turn on the bus in their constructor, basically don't call begin() in the constructor. Make the user call it manually at a time of their choosing (after you have configured the codec). This would be a great addition to the Audio library, add a new constructor that allows you to call begin() later.
2) Hit the teensy with a sledgehammer (i.e. manually shut down the I2S clocks at the register level). Not an ideal solution.
Code:
// On the T3.6:
CORE_PIN9_CONFIG = PORT_PCR_MUX(1); // disable the clock to stop the I2S
// ...configure the codec...
CORE_PIN9_CONFIG = PORT_PCR_MUX(6); // turn the I2S clock back on
3) Modify the AudioControlWM8731 class to detect failed I2C transfers and retry. This is the solution I went with, you can see the implementation in the BAAudioControlWM8731::write() method
here