This commit is contained in:
2025-06-15 22:14:08 -04:00
parent 9c7005b4f7
commit 6a5517609c
2 changed files with 23 additions and 11 deletions

View File

@@ -12,9 +12,10 @@ end
local function startup()
speakerDriver.startup()
speakerDriver.playControlRoomAlarm(controlRoomSpeakers)
speakerDriver.playExternalAlarm(controlRoomSpeakers)
speakerDriver.playInternalAlarm(controlRoomSpeakers)
--speakerDriver.playControlRoomAlarm(controlRoomSpeakers)
--speakerDriver.playExternalAlarm(controlRoomSpeakers)
--speakerDriver.playInternalAlarm(controlRoomSpeakers)
speakerDriver.playTTSFile(controlRoomSpeakers, "test")
end
local function run()

View File

@@ -34,24 +34,35 @@ local function playInternalAlarm(speakers)
playSound(speakers,"internal_alarm")
end
local function playTTSFile()
local function playTTSFile(value)
local ttsRoute = "https://ttsmp3.com/makemp3_new.php"
local fileName = "tts"
local params = {
msg = "Test",
lang = "Gwyneth",
source = "ttsmp3"
local body = "msg=" .. textutils.urlEncode(value) .. "&lang=Gwyneth&source=ttsmp3"
local headers = {
["Content-Type"] = "application/x-www-form-urlencoded"
}
local stringBody = textutils.serialiseJSON(params)
local response = http.request({
url = ttsRoute,
method = "POST",
body = stringBody,
body = body,
headers = headers,
binary = false
})
-- Wait for the response
local event, resUrl, handle
repeat
event, resUrl, handle = os.pullEvent()
if event == "http_failure" and resUrl == url then
print("HTTP POST request failed for: " .. resUrl)
return
end
until event == "http_success" and resUrl == url
-- Read and parse response
local data = handle.readAll()
print(data)
handle.close()
end
local function createSoundFile(fileName)