当前位置: 首页>>代码示例 >>用法及示例精选 >>正文


Arduino ArduinoSound - AudioInI2S.sampleRate()用法及代码示例


说明

查询I2S输入的采样率

用法

AudioInI2S.sampleRate();

返回

I2S 接口的当前采样率,以 Hz 为单位。

示例


  // 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

相关用法


注:本文由纯净天空筛选整理自arduino.cc大神的英文原创作品 ArduinoSound - AudioInI2S.sampleRate()。非经特殊声明,原始代码版权归原作者所有,本译文未经允许或授权,请勿转载或复制。