Skip to content

Instantly share code, notes, and snippets.

@NalaGinrut
Created August 24, 2013 15:17
Show Gist options
  • Save NalaGinrut/6328700 to your computer and use it in GitHub Desktop.
Save NalaGinrut/6328700 to your computer and use it in GitHub Desktop.
encode a frame for arduino TTS
def str_to_playframe(s0):
ss = s0.decode("utf-8")
l = "%c%c" % ((len(ss)&0xff00)>>8, len(ss)&0xff)
s = ss.encode("GB2312")
op = "\x01\x00"
return "\xfd" + l + op + s
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment