Reference Language | Libraries | Comparison | Changes
ArduinoSound
AudioInI2S.sampleRate()
Description
Query the sample rate of the I2S input
Syntax
AudioInI2S.sampleRate();
Returns
Current sample rate of the I2S interface in Hz.
Example
…
// setup the I2S audio input for 44.1 kHz with 32-bits per sample
if (!AudioInI2S.begin(44100, 32)) {
Serial.println("Failed to initialize I2S input!");
while (1); // do nothing
}
Serial.print(“sample rate = “);
Serial.println(AudioInI2S.sampleRate()); // prints out the sample rate used in begin(...)
Serial.print(“bit per sample = “);
Serial.println(AudioInI2S.bitsPerSample()); // prints out the bits per sample rate used in begin(...)
Serial.print(“channels = “);
Serial.println(AudioInI2S.channels()); // prints out 2, I2S always has 2 channels
…
See also
Reference Home
Corrections, suggestions, and new documentation should be posted to the Forum.
The text of the Arduino reference is licensed under a
Creative Commons Attribution-ShareAlike 3.0 License. Code samples in the reference are released into the public domain.