{"id":36704402,"url":"https://github.com/vasilevp/sam","last_synced_at":"2026-01-12T11:41:20.228Z","repository":{"id":57536990,"uuid":"138978301","full_name":"vasilevp/sam","owner":"vasilevp","description":"SAM: Software Automatic Mouth (Ported from https://github.com/vidarh/SAM)","archived":false,"fork":false,"pushed_at":"2019-07-30T12:15:56.000Z","size":1843,"stargazers_count":35,"open_issues_count":0,"forks_count":5,"subscribers_count":5,"default_branch":"master","last_synced_at":"2024-06-20T12:08:10.618Z","etag":null,"topics":["golang","sam","software-automatic-mouth","text-to-speech","tts","tts-engine"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/vasilevp.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}},"created_at":"2018-06-28T06:52:26.000Z","updated_at":"2024-03-23T14:28:07.000Z","dependencies_parsed_at":"2022-08-29T00:50:14.867Z","dependency_job_id":null,"html_url":"https://github.com/vasilevp/sam","commit_stats":null,"previous_names":["exploser/sam"],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/vasilevp/sam","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vasilevp%2Fsam","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vasilevp%2Fsam/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vasilevp%2Fsam/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vasilevp%2Fsam/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/vasilevp","download_url":"https://codeload.github.com/vasilevp/sam/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vasilevp%2Fsam/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28338972,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-12T10:58:46.209Z","status":"ssl_error","status_checked_at":"2026-01-12T10:58:42.742Z","response_time":98,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":["golang","sam","software-automatic-mouth","text-to-speech","tts","tts-engine"],"created_at":"2026-01-12T11:41:19.466Z","updated_at":"2026-01-12T11:41:20.207Z","avatar_url":"https://github.com/vasilevp.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"SAM\n===\n\nSoftware Automatic Mouth - Tiny Speech Synthesizer \n\nThis is a Go port of the great SAM speech synthesizer. It's basically a semi-automatic rewrite from C to Go of what was, in turn, a semi-automatic rewrite from Assembly to C :). Consequently, this is not meant to be readable.\n\n\nOriginal repo: https://github.com/vidarh/SAM. Based on [this commit](https://github.com/vidarh/SAM/commit/8a8219e2cfef5f4ec5db2af55470e8d402937fea).\n\nWhy port this to go?\n--------------------\n\nAs a challenge and just for fun.\n\n-----------------------------\n\nOriginal README\n===============\n\nWhat is SAM?\n============\n\nSam is a very small Text-To-Speech (TTS) program written in C, that runs on most popular platforms.\nIt is an adaption to C of the speech software SAM (Software Automatic Mouth) for the Commodore C64 published \nin the year 1982 by Don't Ask Software (now SoftVoice, Inc.). It includes a Text-To-Phoneme converter called reciter and a Phoneme-To-Speech routine for the \nfinal output. It is so small that it will work also on embedded computers. On my computer it takes\nless than 39KB (much smaller on embedded devices as the executable-overhead is not necessary) of disk space and is a fully stand alone program. \nFor immediate output it uses the SDL-library, otherwise it can save .wav files. \n\nAn online version and executables for Windows can be found on the web site: http://simulationcorner.net/index.php?page=sam\n\nCompile\n=======\n\nSimply type \"make\" in your command prompt.\nIn order to compile without SDL remove the SDL statements from the CFLAGS and LFLAGS variables in the file \"Makefile\".\n\nIt should compile on every UNIX-like operating system. For Windows you need Cygwin or MinGW( + libsdl).\n\n\nUsage\n=====\n\ntype\n\n\t./sam I am Sam\n\nfor the first output.\n\nIf you have disabled SDL try\n\n\t./sam -wav i_am_sam.wav I am Sam\n\nto get a wav file. This file can be played by many media players available for the PC.\n\nyou can try other options like\n\t-pitch number\n\t-speed number\n\t-throat number\n\t-mouth number\n\nSome typical values written in the original manual are:\n\n\tDESCRIPTION          SPEED     PITCH     THROAT    MOUTH\n\tElf                   72        64        110       160\n\tLittle Robot          92        60        190       190\n\tStuffy Guy            82        72        110       105\n\tLittle Old Lady       82        32        145       145\n\tExtra-Terrestrial    100        64        150       200\n\tSAM                   72        64        128       128\n\n\nIt can even sing\nlook at the file \"sing\"\nfor a small example.\n\nFor the phoneme input table look in the Wiki.\n\n\nA description of additional features can be found in the original manual at\n\thttp://www.retrobits.net/atari/sam.shtml\nor in the manual of the equivalent Apple II program\n\thttp://www.apple-iigs.info/newdoc/sam.pdf\n\n\nAdaption To C\n=============\n\nThis program was converted semi-automatic into C by converting each assembler opcode.\ne. g. \n\n\tlda 56\t\t=\u003e\tA = mem[56];\n\tjmp 38018  \t=\u003e\tgoto pos38018;\n\tinc 38\t\t=\u003e\tmem[38]++;\n\t.\t\t\t.\n\t.\t\t\t.\n\nThen it was manually rewritten to remove most of the \njumps and register variables in the code and rename the variables to proper names. \nMost of the description below is a result of this rewriting process.\n\nUnfortunately its still a not very good readable. But you should see where I started :)\n\n\n\nShort description\n=================\n\nFirst of all I will limit myself here to a very coarse description. \nThere are very many exceptions defined in the source code that I will not explain. \nAlso a lot of code is unknown for me e. g. Code47503. \nFor a complete understanding of the code I need more time and especially more eyes have a look on the code. \n\nReciter\n-------\n\nIt changes the english text to phonemes by a ruleset shown in the wiki.\n\nThe rule\n\t\" ANT(I)\",\t\"AY\",\nmeans that if he find an \"I\" with previous letters \" ANT\", exchange the I by the phoneme \"AY\".\n\nThere are some special signs in this rules like\n\t#\n\t\u0026\n\t@\n\t^\n\t+\n\t:\n\t%\nwhich can mean e. g. that there must be a vocal or a consonant or something else. \n\nWith the -debug option you will get the corresponding rules and the resulting phonemes.\n\n\nOutput\n------\n\nHere is the full tree of subroutine calls:\n\nSAMMain()\n\tParser1()\n\tParser2()\n\t\tInsert()\n\tCopyStress()\n\tSetPhonemeLength()\n\tCode48619()\n\tCode41240()\n\t\tInsert()\n\tCode48431()\n\t\tInsert()\n\t\t\n\tCode48547\n\t\tCode47574\n\t\t\tSpecial1\n\t\t\tCode47503\n\t\t\tCode48227\n\n\nSAMMain() is the entry routine and calls all further routines. \nParser1 transforms the phoneme input and transforms it to three tables\n\tphonemeindex[]\n\tstress[]\n\tphonemelength[] (zero at this moment)\n\t\nThis tables are now changed: \n\nParser2 exchanges some phonemes by others and inserts new. \nCopyStress adds 1 to the stress under some circumstances\nSetPhonemeLength sets phoneme lengths. \nCode48619 changes the phoneme lengths\nCode41240 adds some additional phonemes\nCode48431 has some extra rules\n\n\nThe wiki shows all possible phonemes and some flag fields.  \nThe final content of these tables can be seen with the -debug command.\n\n\nIn the function PrepareOutput() these tables are partly copied into the small tables:\n\tphonemeindexOutput[]\n\tstressOutput[]\n\tphonemelengthOutput[]\nfor output.\n\nFinal Output\n------------\n\nExcept of some special phonemes the output is build by a linear combination:\n\t\n\tA =   A1 * sin ( f1 * t ) +\n\t      A2 * sin ( f2 * t ) +\n\t      A3 * rect( f3 * t )\n\nwhere rect is a rectangular function with the same periodicity like sin. \nIt seems really strange, but this is really enough for most types of phonemes. \n\nTherefore the above phonemes are converted with some tables to \n\tpitches[]\n\tfrequency1[]  =  f1\n\tfrequency2[]  =  f2\n\tfrequency3[]  =  f3\n\tamplitude1[]  =  A1\n\tamplitude2[]  =  A2\n\tamplitude3[]  =  A3\n\t\nAbove formula is calculated in one very good omptimized routine.\nIt only consist of 26 commands:\n\n    48087: \tLDX 43\t\t; get phase\t\n    CLC\t\t\n\tLDA 42240,x\t; load sine value (high 4 bits)\n\tORA TabAmpl1,y\t; get amplitude (in low 4 bits)\n\tTAX\t\t\n\tLDA 42752,x\t; multiplication table\n\tSTA 56\t\t; store \n\n\tLDX 42\t\t; get phase\n\tLDA 42240,x\t; load sine value (high 4 bits)\n\tORA TabAmpl2,y\t; get amplitude (in low 4 bits)\n\tTAX\t\t\n\tLDA 42752,x\t; multiplication table\n\tADC Var56\t; add with previous values\n\tSTA 56\t\t; and store\n\n\tLDX 41\t\t; get phase\n\tLDA 42496,x\t; load rect value (high 4 bits)\n\tORA TabAmpl3,y\t; get amplitude (in low 4 bits)\n\tTAX\t\t\n\tLDA 42752,x\t; multiplication table\n\tADC 56\t\t; add with previous values\n\n\tADC #136\t\t\n\tLSR A\t\t; get highest 4 bits\n\tLSR A\t\t\n\tLSR A\t\t\n\tLSR A\t\t\n\tSTA 54296\t;SID   main output command\n\n\nThe rest is handled in a special way. At the moment I cannot figure out in which way. \nBut it seems that it uses some noise (e. g. for \"s\") using a table with random values. \n\nLicense\n=======\n\nThe software is a reverse-engineered version of a commercial software published more than 30 years ago.\nThe current copyright holder is SoftVoice, Inc. (www.text2speech.com)\n\nAny attempt to contact the company failed. The website was last updated in the year 2009.\nThe status of the original software can therefore best described as Abandonware \n(http://en.wikipedia.org/wiki/Abandonware)\n\nAs long this is the case I cannot put my code under any specific open source software license\nUse it at your own risk.\n\n\n\nContact\n=======\n\nIf you have questions don' t hesitate to ask me.\nIf you discovered some new knowledge about the code please mail me.\n\nSebastian Macke\nEmail: sebastian@macke.de\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvasilevp%2Fsam","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvasilevp%2Fsam","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvasilevp%2Fsam/lists"}