arduino / ArduinoCore-API

Hardware independent layer of the Arduino cores defining the official API
https://www.arduino.cc/reference/en/
GNU Lesser General Public License v2.1
205 stars 117 forks source link

AudioStream API #10

Open sandeepmistry opened 8 years ago

sandeepmistry commented 8 years ago

Hi @PaulStoffregen,

We're exploring adding an AudioStream API to Arduino that extends the current Stream type. The draft interface can be found here: api/Audio/AudioStream.h. We would appreciate any feedback you have on it.

We've taken a look at the Teensy Core's AudioStream type and noticed it doesn't have any public interfaces to access the raw sample data. Was this done for performance reasons?

Uses cases we are thinking about include:

PaulStoffregen commented 8 years ago

Was this done for performance reasons?

Yes. AudioStream on Teensy is an API for passing blocks of audio data, not individual samples. Typically the block size is 128 samples (256 bytes), which leads to very good performance and pretty good tolerance for software latency imposed by other libraries and common Arduino coding practices.