Reference   Language | Libraries | Comparison | Changes

I2S library

This library allows you to use the I2S protocol on SAMD21 based boards (i.e Arduino or Genuino Zero, MKRZero or MKR1000 Board).

I2S (Inter-IC Sound), is an electrical serial bus interface standard used for connecting digital audio devices together. It is used to communicate PCM audio data between integrated circuits in an electronic device.

An I2S bus that follows the Philips standard is made up of at least three wires:

  • SCK (Serial Clock): is the clock signal also referred as BCLK (Bit Clock Line);
  • FS (Frame Select): used to discriminate Right or Left Channel data also referred WS (Word Select);
  • SD (Serial Data): the serial data to be transmitted;

As detailed below, the device who generates SCK and WS is the Master.

The SCK line has a frequency that depends on the sample rate, the number of bits for channel and the number of channels in the following way:

Frequency = SampleRate x BitsPerChannel x numberOfChannels

In a typical setup, the sender of audio data is called a Transmitter and it transfers data to a Receiver at the other end. The device that controls the bus clock, SCK, together with the Word Select - WS - signal is the Master in the network and in any network just one device can be Master at any given time; all the other devices connected are in Slave mode. The Master can be the Transmitter, or the Receiver, or a standalone controller. The digitized audio data sample can have a size ranging from 4 bits up to 32.

As a general rule of thumb, the higher the sample rate (kHz) and bits per sample, the better audio quality (when the digital data is converted back to analog audio sound).

For more information about the I2S protocol see the I2S specifications.


  • SimpleTone : Generate a simple tone over I2S
  • InputSerialPlotter : Show over the serial plotter the input waveform captured by an I2S microphone

    Last revision 2016/11/30 by AG

I2S class

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.