Skip to content

Commit f72c0d1

Browse files
committed
readme: move information on using sox into it's own file
Also minor cleanup to ydotool readme.
1 parent 67eec6c commit f72c0d1

File tree

4 files changed

+59
-43
lines changed

4 files changed

+59
-43
lines changed

nerd-dictation

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1313,19 +1313,7 @@ This creates the directory used to store internal data, so other commands such a
13131313
"- ``PAREC`` (external command, default)\n"
13141314
" See --pulse-device-name option to use a specific pulse-audio device.\n"
13151315
"- ``SOX`` (external command)\n"
1316-
" Set environment variable AUDIODEV to use a specific input device.\n"
1317-
" Other sox options can be set (such as gain) by setting environment variable SOX_OPTS.\n"
1318-
" You can test various devices by::\n"
1319-
"\n"
1320-
" # List audio devices.\n"
1321-
" arecord -l || cat /proc/asound/cards || cat /dev/sndstat \n"
1322-
"\n"
1323-
" # Example, use card 2, subdevice 0.\n"
1324-
" # Record 10 seconds and playback to default output.\n"
1325-
" AUDIODEV='hw:2,0' \\\n"
1326-
" sox -d --buffer 1000 -r 16000 -b 16 -e signed-integer \\\n"
1327-
" -c 1 -t wav -L test.wav trim 0 10\n"
1328-
" sox test.wav -d\n"
1316+
" For help on setting up ydotool, see ``readme-sox.rst`` in the nerd-dictation repository.\n"
13291317
),
13301318
required=False,
13311319
)
@@ -1357,7 +1345,7 @@ This creates the directory used to store internal data, so other commands such a
13571345
"\n"
13581346
"- ``XDOTOOL`` Compatible with the X server only (default).\n"
13591347
"- ``YDOTOOL`` Compatible with all Linux distributions and Wayland but requires some setup.\n"
1360-
" For help on setting up ydotool, see our guide readme-ydotool.rst in the nerd-dictation repository.\n"
1348+
" For help on setting up ydotool, see ``readme-ydotool.rst`` in the nerd-dictation repository.\n"
13611349
),
13621350
required=False,
13631351
)

readme-sox.rst

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
#################################
2+
Using ``sox`` with nerd-dictation
3+
#################################
4+
5+
This guide explains how to configure ``sox`` for recording audio with ``nerd-dictation``.
6+
7+
8+
When should I use ``sox``?
9+
==========================
10+
11+
You may wish to configure ``sox`` if you are using a system without pulse-audio support (such as FreeBSD).
12+
13+
14+
Configuring ``sox``
15+
===================
16+
17+
Set environment variable ``AUDIODEV`` to use a specific input device.
18+
Other sox options can be set (such as gain) by setting environment variable ``SOX_OPTS``.
19+
20+
You can test various devices by
21+
22+
.. code-block:: sh
23+
24+
# List audio devices.
25+
arecord -l || cat /proc/asound/cards || cat /dev/sndstat
26+
27+
# Example, use card 2, subdevice 0.
28+
# Record 10 seconds and playback to default output.
29+
AUDIODEV='hw:2,0' sox -d --buffer 1000 -r 16000 -b 16 -e signed-integer -c 1 -t wav -L test.wav trim 0 10
30+
sox test.wav -d
31+
32+
33+
Running nerd dictation with ``sox``
34+
===================================
35+
36+
To run ``nerd-dictation`` with ``sox``, use the ``--input`` argument.
37+
38+
.. code-block:: sh
39+
40+
nerd-dictation begin --input=SOX

readme-ydotool.rst

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,21 @@
1-
#################################
2-
Using ydotool with nerd-dictation
3-
#################################
1+
#####################################
2+
Using ``ydotool`` with nerd-dictation
3+
#####################################
44

55
This guide explains how to get and configure ``ydotool`` to simulate typing with ``nerd-dictation``,
66
which brings support for typing on Wayland and languages other than English.
77

8-
When should I use ydotool
9-
=========================
8+
When should I use ``ydotool``?
9+
==============================
1010

1111
By default, ``nerd-dictation`` uses the ``xdotool`` program to simulate writing with the keyboard.
1212

1313
This program has two major limitations:
1414

15-
# It is only compatible with Xorg, not with Wayland.
16-
If you want to use Wayland, the program will not type anything.
17-
# It suffers from considerable slowdowns when writing characters not found in the English language,
18-
temporarily freezing your computer's display.
15+
#. It is only compatible with Xorg, not with Wayland.
16+
If you want to use Wayland, the program will not type anything.
17+
#. It suffers from considerable slowdowns when writing characters not found in the English language,
18+
temporarily freezing your computer's display.
1919

2020
There is a program named ``ydotool`` that you can use as an alternative to ``xdotool``.
2121
``ydotool`` does not rely on the X server, so it is compatible with Wayland.
@@ -25,8 +25,8 @@ It also offers better performance in languages other than English.
2525
The flip side is that it requires some system configuration to use conveniently.
2626
Also, it lacks accessible documentation, which is why it is not the default.
2727

28-
Installing ydotool
29-
==================
28+
Installing ``ydotool``
29+
======================
3030

3131
You will need to download the latest version of the program found on its git repository:
3232
https://github.com/ReimuNotMoe/ydotool/releases/
@@ -37,8 +37,8 @@ You should then place them in a place that's available on your ``$PATH`` environ
3737
**Warning:** While ``ydotool`` is available on the ``apt`` package manager on Ubuntu 22.04 LTS,
3838
the Debian package is outdated.
3939

40-
Configuring ydotool
41-
===================
40+
Configuring ``ydotool``
41+
=======================
4242

4343
To simulate typing, the program needs access to your ``/dev/uinput`` device.
4444
By default, this requires root privileges every time you run ``ydotool``,
@@ -82,8 +82,8 @@ for performance reasons. You needs to run ``ydotoold`` before you start using ``
8282
To avoid running it every time you start the computer, you can add it to your startup programs.
8383
The steps depend on your distribution, so we'll let you look this up.
8484

85-
Running nerd dictation with ydotool
86-
===================================
85+
Running nerd dictation with ``ydotool``
86+
=======================================
8787

8888
To run ``nerd-dictation`` with ``ydotool``, use the ``--simulate-input-tool`` argument.
8989

readme.rst

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -227,19 +227,7 @@ options:
227227
- ``PAREC`` (external command, default)
228228
See --pulse-device-name option to use a specific pulse-audio device.
229229
- ``SOX`` (external command)
230-
Set environment variable AUDIODEV to use a specific input device.
231-
Other sox options can be set (such as gain) by setting environment variable SOX_OPTS.
232-
You can test various devices by::
233-
234-
# List audio devices.
235-
arecord -l || cat /proc/asound/cards || cat /dev/sndstat
236-
237-
# Example, use card 2, subdevice 0.
238-
# Record 10 seconds and playback to default output.
239-
AUDIODEV='hw:2,0' \
240-
sox -d --buffer 1000 -r 16000 -b 16 -e signed-integer \
241-
-c 1 -t wav -L test.wav trim 0 10
242-
sox test.wav -d
230+
For help on setting up ydotool, see ``readme-sox.rst`` in the nerd-dictation repository.
243231
--output OUTPUT_METHOD
244232
Method used to at put the result of speech to text.
245233

@@ -252,7 +240,7 @@ options:
252240

253241
- ``XDOTOOL`` Compatible with the X server only (default).
254242
- ``YDOTOOL`` Compatible with all Linux distributions and Wayland but requires some setup.
255-
For help on setting up ydotool, see our guide readme-ydotool.rst in the nerd-dictation repository.
243+
For help on setting up ydotool, see ``readme-ydotool.rst`` in the nerd-dictation repository.
256244
``-`` ... End argument parsing.
257245
This can be used for user defined arguments which configuration scripts may read from the ``sys.argv``.
258246

0 commit comments

Comments
 (0)