diff options
| author | onefang | 2025-05-23 11:56:32 +1000 |
|---|---|---|
| committer | onefang | 2025-05-23 11:56:32 +1000 |
| commit | 98053ca5ba4ce09f4c17fdb097485e26018f45c3 (patch) | |
| tree | f6c9faa664ccc88a8e0296c2411d5a51f650ae62 | |
| parent | espeak-ng has an entirely undocumented way of speciyfying the output device. ... (diff) | |
| download | JackOnAllDevices-98053ca5ba4ce09f4c17fdb097485e26018f45c3.zip JackOnAllDevices-98053ca5ba4ce09f4c17fdb097485e26018f45c3.tar.gz JackOnAllDevices-98053ca5ba4ce09f4c17fdb097485e26018f45c3.tar.bz2 JackOnAllDevices-98053ca5ba4ce09f4c17fdb097485e26018f45c3.tar.xz | |
A few other speaking tweaks.
| -rwxr-xr-x | aataaj.lua | 17 |
1 files changed, 10 insertions, 7 deletions
| @@ -205,21 +205,21 @@ table.sort(Cards, function(a, b) return a.card < b.card end) | |||
| 205 | print('') | 205 | print('') |
| 206 | io.flush() | 206 | io.flush() |
| 207 | 207 | ||
| 208 | |||
| 209 | local speak = function(card, subdevice, device, words, printIt, forkIt, ...) | 208 | local speak = function(card, subdevice, device, words, printIt, forkIt, ...) |
| 210 | local files = {...} | 209 | local files = {...} |
| 211 | local s = '' | 210 | local s = '' |
| 211 | if nil == subdevice then subdevice = '' elseif '' ~= subdevice then subdevice = ',' .. subdevice end | ||
| 212 | if 0 == #files then | 212 | if 0 == #files then |
| 213 | local file = os.tmpname() .. '.wav' | 213 | local file = os.tmpname() .. '.wav' |
| 214 | D('Creating temporary script file at ' .. file) | 214 | D('Creating temporary script file at ' .. file) |
| 215 | -- s = '#!/bin/bash\necho "' .. words .. '" | ALSA_CARD=' .. device .. ' ' .. speaker | 215 | -- s = '#!/bin/bash\necho "' .. words .. '" | ALSA_CARD=' .. device .. ' ' .. speaker |
| 216 | -- s = '#!/bin/bash\necho "' .. words .. '" | ' .. speaker .. ' -d hw:' .. device .. ',' .. subdevice | 216 | -- s = '#!/bin/bash\necho "' .. words .. '" | ' .. speaker .. ' -d hw:' .. device .. subdevice |
| 217 | s = '#!/bin/bash\n' .. speaker .. ' -d hw:' .. device .. ',' .. subdevice .. ' "' .. words .. '"' | 217 | s = '#!/bin/bash\n' .. speaker .. ' -d hw:' .. device .. subdevice .. ' "' .. words .. '"' |
| 218 | -- s = '#!/bin/bash\necho "' .. words .. '" | ' .. speaker .. ' -w ' .. file .. ' ; aplay --device=hw:' .. device .. ',' .. subdevice .. ' ' .. file | 218 | -- s = '#!/bin/bash\necho "' .. words .. '" | ' .. speaker .. ' -w ' .. file .. ' ; aplay --device=hw:' .. device .. subdevice .. ' ' .. file |
| 219 | -- s = '#!/bin/bash\n' .. speaker .. ' -w ' .. file .. ' "' .. words .. '" ; aplay --device=hw:' .. device .. ',' .. subdevice .. ' ' .. file | 219 | -- s = '#!/bin/bash\n' .. speaker .. ' -w ' .. file .. ' "' .. words .. '" ; aplay --device=hw:' .. device .. subdevice .. ' ' .. file |
| 220 | else | 220 | else |
| 221 | s = 'aplay --device=hw:' .. device .. ',' .. subdevice | 221 | s = 'aplay -q --device=hw:' .. device .. subdevice |
| 222 | for i, v in ipairs(files) do s = s .. ' ' .. v .. '.wav' end | 222 | for i, v in ipairs(files) do s = s .. ' /usr/local/share/doc/aataaj/' .. v .. '.wav' end |
| 223 | end | 223 | end |
| 224 | print(s) | 224 | print(s) |
| 225 | if printIt then print(words) end | 225 | if printIt then print(words) end |
| @@ -236,6 +236,7 @@ if 'start' == cmd then | |||
| 236 | print('Your ' .. cnt .. ' audio devices are - ') | 236 | print('Your ' .. cnt .. ' audio devices are - ') |
| 237 | for k,C in pairs(Cards) do | 237 | for k,C in pairs(Cards) do |
| 238 | for j,c in ipairs(C['playbackDevs']) do | 238 | for j,c in ipairs(C['playbackDevs']) do |
| 239 | speak(C.name, nil, C.card - 1, 'Your ' .. cnt .. ' audio devices are - ', false, true, 'your', numbers[cnt], 'devices') | ||
| 239 | speak(C.name, C['playbackDevs'][j], C.card - 1, 'Your ' .. cnt .. ' audio devices are - ', false, true, 'your', numbers[cnt], 'devices') | 240 | speak(C.name, C['playbackDevs'][j], C.card - 1, 'Your ' .. cnt .. ' audio devices are - ', false, true, 'your', numbers[cnt], 'devices') |
| 240 | end | 241 | end |
| 241 | end | 242 | end |
| @@ -243,6 +244,7 @@ if 'start' == cmd then | |||
| 243 | __'sleep 6':Do() | 244 | __'sleep 6':Do() |
| 244 | for k,C in pairs(Cards) do | 245 | for k,C in pairs(Cards) do |
| 245 | for j,c in ipairs(C['playbackDevs']) do | 246 | for j,c in ipairs(C['playbackDevs']) do |
| 247 | 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])]) | ||
| 246 | 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])]) | 248 | 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])]) |
| 247 | end | 249 | end |
| 248 | __'sleep 1':Do() | 250 | __'sleep 1':Do() |
| @@ -252,6 +254,7 @@ if 'start' == cmd then | |||
| 252 | print('Please type the device number you heard best - ') | 254 | print('Please type the device number you heard best - ') |
| 253 | for k,C in pairs(Cards) do | 255 | for k,C in pairs(Cards) do |
| 254 | for j,c in ipairs(C['playbackDevs']) do | 256 | for j,c in ipairs(C['playbackDevs']) do |
| 257 | speak(C.name, nil, C.card - 1, 'Please type the device number you heard best - ', false, true, 'best') | ||
| 255 | speak(C.name, C['playbackDevs'][j], C.card - 1, 'Please type the device number you heard best - ', false, true, 'best') | 258 | speak(C.name, C['playbackDevs'][j], C.card - 1, 'Please type the device number you heard best - ', false, true, 'best') |
| 256 | end | 259 | end |
| 257 | end | 260 | end |
