Created
August 24, 2013 15:17
-
-
Save NalaGinrut/6328700 to your computer and use it in GitHub Desktop.
encode a frame for arduino TTS
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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