{"id":17406,"date":"2023-07-16T20:21:21","date_gmt":"2023-07-17T00:21:21","guid":{"rendered":"https:\/\/scruss.com\/blog\/?p=17406"},"modified":"2023-07-16T20:21:21","modified_gmt":"2023-07-17T00:21:21","slug":"adding-speech-to-mmbasic","status":"publish","type":"post","link":"https:\/\/scruss.com\/blog\/2023\/07\/16\/adding-speech-to-mmbasic\/","title":{"rendered":"Adding speech to MMBasic"},"content":{"rendered":"\n<figure class=\"wp-block-video\"><video height=\"480\" style=\"aspect-ratio: 854 \/ 480;\" width=\"854\" controls src=\"https:\/\/scruss.com\/wordpress\/wp-content\/uploads\/2023\/07\/MMbasic-syn6988.webm\"><\/video><\/figure>\n\n\n\n<p>Yup, it&#8217;s another &#8220;let&#8217;s wire up a SYN6988 board&#8221; thing, this time for <a href=\"https:\/\/mmbasic.com\/\">MMBasic<\/a> running on the <a href=\"https:\/\/micromite.org\/shop\/kits\/armmitestm407module\/\">Armmite STM32F407 Module<\/a> (aka &#8216;Armmite F4&#8217;). This board is also known as the <a href=\"https:\/\/github.com\/mcauser\/BLACK_F407VE\/tree\/master\">BLACK_F407VE<\/a>, which also makes a nice little MicroPython platform.<\/p>\n\n\n\n<p>Uh, let&#8217;s not dwell too much on how the SYN6988 seems to parse 19:51 as &#8220;91 minutes to 20&#8221; &#8230; <\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Wiring<\/h2>\n\n\n\n<figure class=\"wp-block-table\"><table><tbody><tr><td class=\"has-text-align-center\" data-align=\"center\"><strong>SYN6988<\/strong><\/td><td class=\"has-text-align-center\" data-align=\"center\"><strong>Armmite F4<\/strong><\/td><\/tr><tr><td class=\"has-text-align-center\" data-align=\"center\">RX<\/td><td class=\"has-text-align-center\" data-align=\"center\">PA09 (<em>COM1 TX<\/em>)<\/td><\/tr><tr><td class=\"has-text-align-center\" data-align=\"center\">TX<\/td><td class=\"has-text-align-center\" data-align=\"center\">PA10 (<em>COM1 RX<\/em>)<\/td><\/tr><tr><td class=\"has-text-align-center\" data-align=\"center\">RDY<\/td><td class=\"has-text-align-center\" data-align=\"center\">PA08<\/td><\/tr><\/tbody><\/table><figcaption class=\"wp-element-caption\">your choice of 3.3 V and GND connections, of course<\/figcaption><\/figure>\n\n\n\n<p><strong>Where to buy<\/strong>: AliExpress \u2014 <a href=\"https:\/\/www.aliexpress.com\/store\/1102695560\">KAIKAI Electronics Wholesale Store<\/a> : <a href=\"https:\/\/www.aliexpress.com\/item\/1005005348524077.html\">High-end Speech Synthesis Module Chinese\/English Speech Synthesis XFS5152 Real Pronunciation TTS<\/a><\/p>\n\n\n\n<p>Yes, I know it says it&#8217;s an XFS5152, but I got a SYN6988 and it seems to be about as reliable a source as one can find. The board is marked <em>YS-V6E-V1.03<\/em>, and even mentions SYN6988 on the rear silkscreen:<\/p>\n\n\n\n<figure class=\"wp-block-image aligncenter size-full is-resized\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/scruss.com\/wordpress\/wp-content\/uploads\/2023\/07\/ys-v6E-v1.03-front.jpg\" alt=\"\" class=\"wp-image-17407\" width=\"334\" height=\"336\" srcset=\"https:\/\/scruss.com\/wordpress\/wp-content\/uploads\/2023\/07\/ys-v6E-v1.03-front.jpg 1016w, https:\/\/scruss.com\/wordpress\/wp-content\/uploads\/2023\/07\/ys-v6E-v1.03-front-318x320.jpg 318w, https:\/\/scruss.com\/wordpress\/wp-content\/uploads\/2023\/07\/ys-v6E-v1.03-front-160x160.jpg 160w, https:\/\/scruss.com\/wordpress\/wp-content\/uploads\/2023\/07\/ys-v6E-v1.03-front-768x774.jpg 768w\" sizes=\"auto, (max-width: 334px) 100vw, 334px\" \/><\/figure>\n\n\n\n<figure class=\"wp-block-image aligncenter size-full is-resized wp-duotone-unset-1\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/scruss.com\/wordpress\/wp-content\/uploads\/2023\/07\/ys-v6E-v1.03-back.jpg\" alt=\"\" class=\"wp-image-17408\" width=\"330\" height=\"332\" srcset=\"https:\/\/scruss.com\/wordpress\/wp-content\/uploads\/2023\/07\/ys-v6E-v1.03-back.jpg 1016w, https:\/\/scruss.com\/wordpress\/wp-content\/uploads\/2023\/07\/ys-v6E-v1.03-back-318x320.jpg 318w, https:\/\/scruss.com\/wordpress\/wp-content\/uploads\/2023\/07\/ys-v6E-v1.03-back-160x160.jpg 160w, https:\/\/scruss.com\/wordpress\/wp-content\/uploads\/2023\/07\/ys-v6E-v1.03-back-768x774.jpg 768w\" sizes=\"auto, (max-width: 330px) 100vw, 330px\" \/><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\">Code<\/h2>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\nREM                 SYN6988 speech demo - MMBasic \/ Armmite F4\nREM                 scruss, 2023-07\n\nOPEN &quot;COM1:9600&quot; AS #5\nREM                 READY line on PA8\nSETPIN PA8, DIN, PULLUP\n\nREM    you can ignore font\/text commands\nCLS\nFONT 1\nTEXT 0,15,&quot;&#x5B;v1]Hello - this is a speech demo.&quot;\nsay(&quot;&#x5B;v1]Hello - this is a speech demo.&quot;)\nTEXT 0,30,&quot;&#x5B;x1]soundy&#x5B;d]&quot;\nsay(&quot;&#x5B;x1]soundy&#x5B;d]&quot;): REM    chimes\nTEXT 0,45,&quot;The time is &quot;+LEFT$(TIME$,5)+&quot;.&quot;\nsay(&quot;The time is &quot;+LEFT$(TIME$,5)+&quot;.&quot;)\nEND\n\nSUB say(a$)\n  LOCAL dl%,maxlof%\n  REM     data length is text length + 2 (for the 1 and 0 bytes)\n  dl%=2+LEN(a$)\n  maxlof%=LOF(#5)\n  REM     SYN6988 simple data packet\n  REM      byte  1 : &amp;amp;HFD\n  REM      byte  2 : data length (high byte)\n  REM      byte  3 : data length (low byte)\n  REM      byte  4 : &amp;amp;H01\n  REM      byte  5 : &amp;amp;H00\n  REM      bytes 6-: ASCII string data\n  PRINT #5, CHR$(&amp;amp;hFD)+CHR$(dl%\\256)+CHR$(dl% MOD 256)+CHR$(1)+CHR$(0)+a$;\n  DO WHILE LOF(#5)&amp;lt;maxlof%\n  REM       pause while sending text\n    PAUSE 5\n  LOOP\n  DO WHILE PIN(PA8)&amp;lt;&gt;1\n    REM       wait until RDY is high\n    PAUSE 5\n  LOOP\n  DO WHILE PIN(PA8)&amp;lt;&gt;0\n    REM       wait until SYN6988 signals READY\n    PAUSE 5\n  LOOP\nEND SUB\n<\/pre><\/div>\n\n\n<p>For more commands, please see <a href=\"https:\/\/github.com\/scruss\/micropython-SYN6988#embedded-text-commands\">Embedded text commands<\/a><\/p>\n\n\n\n<p>Heres the auto-translated manual for the SYN6988: <\/p>\n\n\n\n<div data-wp-interactive=\"core\/file\" class=\"wp-block-file\"><object data-wp-bind--hidden=\"!state.hasPdfPreview\" hidden class=\"wp-block-file__embed\" data=\"https:\/\/scruss.com\/wordpress\/wp-content\/uploads\/2023\/07\/SYN6988-translated.pdf\" type=\"application\/pdf\" style=\"width:100%;height:600px\" aria-label=\"Embed of SYN6988-translated.\"><\/object><a id=\"wp-block-file--media-2044b9b6-686e-4b20-b567-3ceecbd113a3\" href=\"https:\/\/scruss.com\/wordpress\/wp-content\/uploads\/2023\/07\/SYN6988-translated.pdf\">SYN6988-translated<\/a><a href=\"https:\/\/scruss.com\/wordpress\/wp-content\/uploads\/2023\/07\/SYN6988-translated.pdf\" class=\"wp-block-file__button wp-element-button\" download aria-describedby=\"wp-block-file--media-2044b9b6-686e-4b20-b567-3ceecbd113a3\">Download<\/a><\/div>\n","protected":false},"excerpt":{"rendered":"<p>Yup, it&#8217;s another &#8220;let&#8217;s wire up a SYN6988 board&#8221; thing, this time for MMBasic running on the Armmite STM32F407 Module (aka &#8216;Armmite F4&#8217;). This board is also known as the BLACK_F407VE, which also makes a nice little MicroPython platform. Uh, let&#8217;s not dwell too much on how the SYN6988 seems to parse 19:51 as &#8220;91 [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":true,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[7,3315],"tags":[2062,3299,1427,3324,3238],"class_list":["post-17406","post","type-post","status-publish","format-standard","hentry","category-computers-suck","category-electronics","tag-basic","tag-mmbasic","tag-speech","tag-syn6988","tag-tts"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_shortlink":"https:\/\/wp.me\/pQNZZ-4wK","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/scruss.com\/blog\/wp-json\/wp\/v2\/posts\/17406","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/scruss.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/scruss.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/scruss.com\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/scruss.com\/blog\/wp-json\/wp\/v2\/comments?post=17406"}],"version-history":[{"count":2,"href":"https:\/\/scruss.com\/blog\/wp-json\/wp\/v2\/posts\/17406\/revisions"}],"predecessor-version":[{"id":17412,"href":"https:\/\/scruss.com\/blog\/wp-json\/wp\/v2\/posts\/17406\/revisions\/17412"}],"wp:attachment":[{"href":"https:\/\/scruss.com\/blog\/wp-json\/wp\/v2\/media?parent=17406"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/scruss.com\/blog\/wp-json\/wp\/v2\/categories?post=17406"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/scruss.com\/blog\/wp-json\/wp\/v2\/tags?post=17406"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}