Created
September 10, 2022 18:32
-
-
Save AkBKukU/922343e0d638da678ea8af67cefe96fc to your computer and use it in GitHub Desktop.
Python script for writing to DECtalk devices with resets for commands
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
#!/usr/bin/python3 | |
import serial | |
import sys | |
# DECtalk output over serial with command resetting | |
ser = serial.Serial('/dev/ttyUSB0',9600,timeout=1) # open serial port with 9600 8N1 defaults | |
print(ser.name) # check which port was really used | |
for line in sys.stdin: | |
# ser.write( bytes(str(line),'ascii') ) # No command resetting | |
ser.write( bytes(str(line)+str('^K\r [:nh][:dv ap 90 pr 0].END OF LINE[:np][:pp 0][:cp 0][:rate 200][:say line][:punct none][:pitch 35].\r'),'ascii') ) # DTC01 Reset with CTRL+K escape sequence | |
# ser.write( bytes(str(line)+str('[:phonem off][:nh][:dv ap 90 pr 0].END OF LINE[:np][:pp 0][:cp 0][:rate 200][:say line][:punct none][:pitch 35].\r'),'ascii') ) # Newer DECtalk versions reset | |
ser.close() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment