From 98053ca5ba4ce09f4c17fdb097485e26018f45c3 Mon Sep 17 00:00:00 2001 From: onefang Date: Fri, 23 May 2025 11:56:32 +1000 Subject: A few other speaking tweaks. --- aataaj.lua | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) (limited to 'aataaj.lua') diff --git a/aataaj.lua b/aataaj.lua index d34ad8f..47a2f50 100755 --- a/aataaj.lua +++ b/aataaj.lua @@ -205,21 +205,21 @@ table.sort(Cards, function(a, b) return a.card < b.card end) print('') io.flush() - local speak = function(card, subdevice, device, words, printIt, forkIt, ...) local files = {...} local s = '' + if nil == subdevice then subdevice = '' elseif '' ~= subdevice then subdevice = ',' .. subdevice end if 0 == #files then local file = os.tmpname() .. '.wav' D('Creating temporary script file at ' .. file) -- s = '#!/bin/bash\necho "' .. words .. '" | ALSA_CARD=' .. device .. ' ' .. speaker --- s = '#!/bin/bash\necho "' .. words .. '" | ' .. speaker .. ' -d hw:' .. device .. ',' .. subdevice - s = '#!/bin/bash\n' .. speaker .. ' -d hw:' .. device .. ',' .. subdevice .. ' "' .. words .. '"' --- s = '#!/bin/bash\necho "' .. words .. '" | ' .. speaker .. ' -w ' .. file .. ' ; aplay --device=hw:' .. device .. ',' .. subdevice .. ' ' .. file --- s = '#!/bin/bash\n' .. speaker .. ' -w ' .. file .. ' "' .. words .. '" ; aplay --device=hw:' .. device .. ',' .. subdevice .. ' ' .. file +-- s = '#!/bin/bash\necho "' .. words .. '" | ' .. speaker .. ' -d hw:' .. device .. subdevice + s = '#!/bin/bash\n' .. speaker .. ' -d hw:' .. device .. subdevice .. ' "' .. words .. '"' +-- s = '#!/bin/bash\necho "' .. words .. '" | ' .. speaker .. ' -w ' .. file .. ' ; aplay --device=hw:' .. device .. subdevice .. ' ' .. file +-- s = '#!/bin/bash\n' .. speaker .. ' -w ' .. file .. ' "' .. words .. '" ; aplay --device=hw:' .. device .. subdevice .. ' ' .. file else - s = 'aplay --device=hw:' .. device .. ',' .. subdevice - for i, v in ipairs(files) do s = s .. ' ' .. v .. '.wav' end + s = 'aplay -q --device=hw:' .. device .. subdevice + for i, v in ipairs(files) do s = s .. ' /usr/local/share/doc/aataaj/' .. v .. '.wav' end end print(s) if printIt then print(words) end @@ -236,6 +236,7 @@ if 'start' == cmd then print('Your ' .. cnt .. ' audio devices are - ') for k,C in pairs(Cards) do for j,c in ipairs(C['playbackDevs']) do + speak(C.name, nil, C.card - 1, 'Your ' .. cnt .. ' audio devices are - ', false, true, 'your', numbers[cnt], 'devices') speak(C.name, C['playbackDevs'][j], C.card - 1, 'Your ' .. cnt .. ' audio devices are - ', false, true, 'your', numbers[cnt], 'devices') end end @@ -243,6 +244,7 @@ if 'start' == cmd then __'sleep 6':Do() for k,C in pairs(Cards) do for j,c in ipairs(C['playbackDevs']) do + speak(C.name, nil, C.card - 1, 'Device number ' .. C.card - 1 .. ', sub device ' .. C['playbackDevs'][j] .. ' : ' .. C.name, true, false, 'device', numbers[C.card - 1], 'sub', numbers[tonumber(C['playbackDevs'][j])]) speak(C.name, C['playbackDevs'][j], C.card - 1, 'Device number ' .. C.card - 1 .. ', sub device ' .. C['playbackDevs'][j] .. ' : ' .. C.name, true, false, 'device', numbers[C.card - 1], 'sub', numbers[tonumber(C['playbackDevs'][j])]) end __'sleep 1':Do() @@ -252,6 +254,7 @@ if 'start' == cmd then print('Please type the device number you heard best - ') for k,C in pairs(Cards) do for j,c in ipairs(C['playbackDevs']) do + speak(C.name, nil, C.card - 1, 'Please type the device number you heard best - ', false, true, 'best') speak(C.name, C['playbackDevs'][j], C.card - 1, 'Please type the device number you heard best - ', false, true, 'best') end end -- cgit v1.1