diff --git a/NOTICE.md b/NOTICE.md index 67d062b..dcd6596 100644 --- a/NOTICE.md +++ b/NOTICE.md @@ -82,4 +82,6 @@ voices, belong to their owners: . - **SAM** (`sam-*`): Software Automatic Mouth, Don't Ask Software, 1982 (now SoftVoice, Inc.). Built from the C port at . -- **MacInTalk** (`mac-*`): Apple's voices, spoken by macOS's `say`. +- **MacInTalk and PlainTalk** (`mac-*`): Apple's voices (MacinTalk 3, and + the PlainTalk MacinTalk Pro voices Victoria, Agnes, Bruce and Vicki), + spoken by macOS's `say`. diff --git a/README.md b/README.md index 30388e9..56f401b 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,7 @@ A telephone speaking clock for Asterisk and FreePBX. Its voices include the UK's TIM (Pat Simmons), Australia's Gordon Gow, the whole Steve's Talking Clock library of talking clocks and watches, and classic speech synthesisers -(Microsoft Sam and the other SAPI4 voices, DECtalk, SAM, MacInTalk), each +(Microsoft Sam and the other SAPI4 voices, DECtalk, SAM, MacInTalk, PlainTalk), each able to give the time to the second. - **`asterisk/`**: `app_speakingclock`, the `SpeakingClock()` dialplan @@ -110,7 +110,8 @@ tools/synth_voices.py --list # the voices it knows tools/synth_voices.py voices sapi4:microsoft-sam # SAPI4, via tetyys.com DECTALK_SAY=~/dectalk/dist/say tools/synth_voices.py voices dectalk:paul SAM=~/SAM/sam tools/synth_voices.py voices sam:sam -tools/synth_voices.py voices mac:Fred # on a Mac +tools/synth_voices.py voices mac:Fred # MacInTalk, on a Mac +tools/synth_voices.py voices mac:Victoria # PlainTalk, on a Mac ``` ## Licence diff --git a/tools/synth_voices.py b/tools/synth_voices.py index c7b72cf..7a2e027 100755 --- a/tools/synth_voices.py +++ b/tools/synth_voices.py @@ -121,10 +121,17 @@ SAM = { "extra-terrestrial": (100, 64, 150, 200, "SAM Extra-Terrestrial"), } -MAC = ["Fred", "Ralph", "Junior", "Kathy", "Albert", "Bahh", - "Bells", "Boing", "Bubbles", "Cellos", "Trinoids", "Whisper", - "Zarvox", "Bad News", "Good News", "Wobble", "Jester", "Organ", - "Superstar"] +# macOS's own say speaks them. The MacinTalk 3 voices (1993) and the +# PlainTalk ones (MacinTalk Pro, 1994-95, the voices of System 7.5 to Mac +# OS 9). Which ones a Mac still has depends on its macOS: say -v '?'. +MAC_FAMILY = { + "MacInTalk": ["Fred", "Ralph", "Junior", "Kathy", "Albert", "Bahh", + "Bells", "Boing", "Bubbles", "Cellos", "Trinoids", "Whisper", + "Zarvox", "Bad News", "Good News", "Wobble", "Jester", "Organ", + "Superstar", "Princess"], + "PlainTalk": ["Victoria", "Agnes", "Bruce", "Vicki"], +} +MAC = {v: f for f, vs in MAC_FAMILY.items() for v in vs} last_request = [0.0] @@ -174,6 +181,12 @@ def sam(vid, text, out): check=True, stdout=subprocess.DEVNULL) +def mac_check(vid): + have = subprocess.run(["say", "-v", "?"], capture_output=True, text=True).stdout + if not any(line.split(" ")[0].strip() == vid for line in have.splitlines()): + sys.exit("this Mac has no voice %r (say -v '?' lists the ones it has)" % vid) + + def mac(vid, text, out): aiff = out + ".aiff" subprocess.run(["say", "-v", vid, "-o", aiff, text], check=True) @@ -188,8 +201,10 @@ ENGINES = { "DECtalk (Digital Equipment Corp.), https://github.com/dectalk/dectalk"), "sam": (sam, SAM, lambda v: (SAM[v][4], "Software Automatic Mouth (Commodore 64, 1982)"), "SAM, Don't Ask Software (now SoftVoice, Inc.), C port https://github.com/s-macke/SAM"), - "mac": (mac, {v: v for v in MAC}, lambda v: ("MacInTalk " + v, "Apple MacInTalk voice"), - "Apple MacInTalk, spoken by macOS's say"), + "mac": (mac, MAC, lambda v: ("%s %s" % (MAC[v], v), + "Apple PlainTalk (MacinTalk Pro) voice" if MAC[v] == "PlainTalk" + else "Apple MacInTalk 3 voice"), + "Apple MacInTalk / PlainTalk, spoken by macOS's say"), } @@ -203,6 +218,8 @@ def finish(raw, out): def build(out_dir, engine, vid): fn, table, info, source = ENGINES[engine] name, desc = info(vid) + if engine == "mac": + mac_check(vid) d = os.path.join(out_dir, "%s-%s" % (engine, vid.lower().replace(" ", "-"))) if os.path.exists(d): shutil.rmtree(d)