Skip to content

ensonic/photon-waveout

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

photon-waveout

Audio playback library for the particle.io photon using two digital pins to create an 8bit mono audio stream at 7874 Hz using AC PWM. This is not an official Google product.

how to use it

First you need to convert you audio sample into a c header. One way you can do it is:

gst-launch-1.0 -q uridecodebin uri=file:///path/to/audio-file ! audioconvert ! \
  audioresample ! audioconvert ! "audio/x-raw,format=S8,rate=7874,channels=1" ! \
  filesink location=/tmp/snd; \
  perl ~/bin/bin2hex.pl /tmp/snd 1 | sed -e 's/bin_data|wave_data/' >/tmp/wave_data.h

An alternative for bin2hex.pl would be:

size=$(stat -c "%s" /tmp/snd); \
(
  echo "static uint8_t wave_data[] = { /* ${size} */";
  hexdump -v -e '15/1 "0x%02X," "\n"' /tmp/snd | sed -e 's/0x  ,//g';
  echo "};"
) >wave_data.h

gstreamer is included with most linux distros and I found the bin2hex.pl at http://www.chami.com/tips/delphi/052098D.html

wiring

wiring

About

audio playback library for the particle.io photon

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages