
Accept string in speaker.playAudio
Closed this issue ยท 1 comments
Accept a string in speaker.playAudio(), converting the string from file.read() to an array with integers makes zero sense
Au contraire! I think accepting a list of audio samples makes a lot of sense. We went that way for a couple of reasons:
- This allows users to work with multiple audio formats (e.g. DFPWM, WAV). If we accepted a string, we'd have to have a single canonical format that everything else must be converted to.
- Similar to the above, accepting the raw samples allows you to write code that changes those samples first (for instance, changing sample rate, adding echo, etc...). If we accepted a string, you'd then have to re-encode the audio, which just feels a little silly!