{"id":22248691,"url":"https://github.com/scruss/micropython-syn6988","last_synced_at":"2025-10-18T13:28:07.326Z","repository":{"id":176934624,"uuid":"659436895","full_name":"scruss/micropython-SYN6988","owner":"scruss","description":"MicroPython library for the VoiceTX SYN6988 text to speech module","archived":false,"fork":false,"pushed_at":"2023-06-29T01:22:54.000Z","size":1284,"stargazers_count":19,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-10-13T04:13:37.474Z","etag":null,"topics":["micropython","speech-synthesis","syn6988","tts"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/scruss.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2023-06-27T20:47:44.000Z","updated_at":"2025-05-16T12:04:59.000Z","dependencies_parsed_at":null,"dependency_job_id":"c3a498cd-5ca8-478a-ab0f-e1c5daa7e4d6","html_url":"https://github.com/scruss/micropython-SYN6988","commit_stats":null,"previous_names":["scruss/micropython-syn6988"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/scruss/micropython-SYN6988","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/scruss%2Fmicropython-SYN6988","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/scruss%2Fmicropython-SYN6988/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/scruss%2Fmicropython-SYN6988/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/scruss%2Fmicropython-SYN6988/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/scruss","download_url":"https://codeload.github.com/scruss/micropython-SYN6988/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/scruss%2Fmicropython-SYN6988/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279538807,"owners_count":26187257,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-18T02:00:06.492Z","response_time":62,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["micropython","speech-synthesis","syn6988","tts"],"created_at":"2024-12-03T06:17:44.646Z","updated_at":"2025-10-18T13:28:07.294Z","avatar_url":"https://github.com/scruss.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# micropython-SYN6988\nMicroPython library for the YuTone VoiceTX SYN6988 text to speech module.\n\n## Demo\n\nhttps://github.com/scruss/micropython-SYN6988/assets/425706/bf107dc3-3db7-4eb7-90a4-6cfe5986529f\n\nor demo audio download: \u003ca href=\"images/syn6988-micropython-demo.mp3\"\u003esyn6988-micropython-demo.mp3\u003c/a\u003e\n\nwhich \"reads\" the following text:\n```\n[g2]Hello! [g1]你好![g2]\nI can speak in English, and also in Chinese:\n[g1]千里之行，始于足下。[g2]\nwhich means: a journey of five hundred kilometres starts with the first step\n[s1]I can speak slowly, [s9] and I can speak very fast[s5]\n[v5]I can be [v10]loud or [v1]very quiet. [v5]\nI can use [t1]low tones [t5]or [t8]high tones[t5]\n[d][g0]my work here is done [x1]soundy[d]\n```\n\n## Introduction \n\n\u003cimg src=\"images/syn6988-front.webp\" width=\"628\" height=\"600\"\nalt=\"blue circuit board with central processor chip and audio outputs\"\n/\u003e\n\nThe SYN6988 is one of several speech synthesizer / text-to-speech\n(TTS) modules available inexpensively on AliExpress and other\nvendors. It's impressive because:\n\n* it produces clear English speech without resorting to phonemes;\n\n* it has a line out / headphone jack and small speaker outputs, both\n  featuring very clean audio;\n  \n* it is easy to interface to, either through asynchronous serial or\n  SPI (the latter not attempted here);\n  \n* it has some flexibility in volume, pitch and rate of speech (but\n  it's no [DECtalk](https://github.com/dectalk/dectalk));\n  \n* it has a large library of alert tones built-in;\n  \n* it is not expensive, being around 🇨🇦 $15.\n\nOf course, there are downsides:\n\n* all of the documentation *so far* is in Chinese;\n\n* it has only one faintly-accented female voice with a slightly robotic\n  delivery;\n  \n* you may not get the board you ordered! I was sold this board as\n  having an XFS5152 chip when it clearly has a SYN6988.\n\n### Where to buy\n\nIt's hard to recommend a vendor, as I can't guarantee they are selling a board with a SYN6988 on it. Check that the vendor description says SYN6988 (there are similar chips SYN6288 and SYN6658 with different capabilities) and the board has a chip with a clear **SYN6988** silkscreen. I've seen a few boards for sale that say SYN6658 on the PCB silkscreen, but have a SYN6988 in the image and description.\n  \n## Interfacing\n\nThe SYN6988 is a 3.3 V device for both logic and power. It requires a\ntwo-wire UART connection plus an additional digital input pin to\nmonitor the busy status of the TTS.\n\n        SYN6988        MicroPython Board     Raspberry Pi Pico\n\t   =========      ===================   ===================\n\t   \n\t        RDY            Digital Input         GPIO 2\n\t\tRXD            UART TXD              GPIO 0 (UART 0 TX)\n\t\tTXD            UART RXD              GPIO 1 (UART 0 RX)\n\t\tGND            Ground                Any GND pin\n\t\t3V3            3V3 supply            3V3(OUT)\n\t\t\nThe SYN6988 uses a fixed serial port rate defined by the arrangement\nof resistors in the serial speed selection block. Mine is hard-wired\nfor 9600 baud.\n\nFor a Raspberry Pi Pico, these connections might be supported in code\nwith:\n\n```python3\nser = machine.UART(0, baudrate=9600, bits=8, parity=None, stop=1)\nbusyPin = machine.Pin(2, machine.Pin.IN, machine.Pin.PULL_UP)\n\n```\n\nAudio output is either through the headphone / line out jack or via\nthe speaker pins. This output is unamplified. I can drive a very small\noval speaker at a comfortable volume from the speaker pins, but large\nheaphones can be very quiet.\n\nThe board I have is not remotely breadboard-friendly. I solved that by\ntaking two 6-pin Arduino stacking headers, bending the pins out and\nback in at right angles, then gluing the two headers back to\nback. This gives a header block that bridges the central trough in a\nbreadboard, allowing the SYN6988 board to sit centrally.\n\n\u003cimg src=\"images/syn6988_pico.jpg\" width=\"1045\" height=\"1045\"\nalt=\"SYNC6988 with Raspberry Pi Pico and small speaker\" /\u003e\n\n## Operation\n\nIf the board is connected correctly, the red Ready LED will be lit\nwhen the TTS is not speaking. This LED will go out when the TTS is\nspeaking, and the RDY pin will go low shortly (about 0.1 to 0.7 s) after the\nspeech starts, and go high when speech is finished.\n\nIf the initialization code above is used, the following MicroPython\nwill speak a rather quiet \"Hello\" from the board:\n\n```python3\nimport syn6988\n\ns = syn6988.SYN6988(ser, busyPin)\ns.speak(\"[v1]hello\")\n```\n\nThere are very few methods and properties to this module:\n\n* **speak**(*string*) - sends *string* to the TTS. Output can be\n  shaped with embedded text commands. Accepts Unicode text including\n  Traditional Chinese characters. Makes an extremely poor job of\n  attempting non-English or non-Chinese language.\n  \n* **block** = *True* | *False* - by default, speech is emitted in\n  *blocking mode*: that is, the `speak()` method will not return until\n  the TTS has indicated it is finished. If `block = False` is set,\n  `speak()` will return immediately, but the TTS will still be speaking\n  and waiting is left up to the programmer.\n\n* **isBusy**() - if called in non-blocking mode, `isBusy()` returns\n  true while the TTS is speaking. This can be used to prevent\n  interrupting speech. If called in blocking mode, will always return\n  false.\n\n## Embedded text commands\n\nThe SYN6988 is controlled by commands surrounded by `[]`. There are\nmany of these, and I don't understand them all. I've put a few of them\nin `test-syn6988.py` with I hope clear meanings of what they do. In\nbrief:\n\n* `[d]` - reset the TTS to standard mode. Can be useful after calling\n  any of the alert sounds.\n  \n* `[g0]` - automatic language guessing; `[g1]` - Chinese language\n  preference; `[g2]` - English language preference. English spoken in\n  Chinese mode has strange intonation, while Chinese spoken in English\n  mode may not be correctly detected.\n  \n* `[p*]` - pause, for example `[p500]` pauses for 500 ms.\n\n* `[s*]` - speech rate: `[s0]` slowest to `[s10]` fastest.\n\n* `[t*]` - tone/pitch: `[t0]` lowest to `[t10]` highest.\n\n* `[x0]` / `[x1]` - interpret a string starting with \"sound\" as one\n  of several hundred (?) different tones, chimes and alarms. For\n  example `[x1]soundy[d]` plays a rather pleasing chime which I\n  overuse greatly. It's important to use `[d]` after this command or\n  unexpected results will occur. A sound table reference is here: [SYN-6988 Speech with MicroPython – We Saw a Chicken …](https://scruss.com/blog/2023/06/28/syn-6988-speech-with-micropython/)\n  \n* `[v*]` - volume: `[v0]` silent, `[v1]` quietest to `[v10]` loudest.\n\n\n## Internals\n\nThe SYN6988 accepts a wide range of input encodings, none of which are\nsupported by MicroPython. It does, however, support UTF16-BE (two\nbytes per char, no BOM, high byte first; eg: \"hello\" =\u003e\n`b'\\x00h\\x00e\\x00l\\x00l\\x00o'`) which can be fairly easily fudged to\nwork. If our UTF-16BE encoded data is in `data_bytes` and we define\n\n```python3\ntx_len = len(data_bytes) + 2\n```\n\nthe SYN6988 will accept the following byte stream over the serial port\nand attempt to speak it:\n\n\n    0xFD, tx_len // 256, tx_len % 256, 0x01, 0x04, data_bytes\n\nThe data string shouldn't be too long: something under 4096\ncharacters, perhaps. The board can take up to 700 ms to process text,\nand hence we pause for that long to make sure text is all spoken.\n\n## Author\n\nStewart Russell - [scruss.com](https://scruss.com/blog/) - aka [@scruss@xoxo.zone](https://xoxo.zone/@scruss)\n\n## Licence\n\nMIT. If you improve on this, though, please let me know so I can make this better.\n\n## To do\n\n* The UTF-8 -\u003e UTF-16BE code works but feels like it could be improved. It has to stay something I can understand, though.\n\n* There's a small chance that really long text will be skipped because I'm not waiting long enough for it to be processed when reading in blocking mode.\n\n* Generalize this code (if possible) to work with SYN6288, SYN6658 and XFS5152 chipsets. I have several of these on order.\n\n## References\n\n* YuTone VoiceTX SYN6988 documentation (in Chinese only): [语音合成芯\n  片-SYN6988中英文TTS语音芯\n  片](http://www.voicetx.com/product/detail.html?id=11).\n\n* My early attempts to drive this board from CPython: [Speech from\n  Python with the SYN6988 module – We Saw a Chicken\n  …](https://scruss.com/blog/2023/06/21/speech-from-python-with-the-syn6988-module/). This\n  produces sound, but I'm actually driving it wrongly. Still works,\n  though. Has an auto-translated copy of the programming reference,\n  which is all I have had to work from.\n\n* Richard Brautigan's poem *All Watched Over by Machines of Loving\n  Grace*, \"read\" by a SYN6988 TTS chip driven by MicroPython: [All\n  Watched Over By Machines of Loving Grace |\n  SoundCloud](https://soundcloud.com/user8899915/all-watched-over-by-machines-of-loving-grace).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fscruss%2Fmicropython-syn6988","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fscruss%2Fmicropython-syn6988","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fscruss%2Fmicropython-syn6988/lists"}