Skip to content

Commit

Permalink
Updated documentation, added TODO.md, 0.2 release
Browse files Browse the repository at this point in the history
  • Loading branch information
sveinbjornt committed Oct 27, 2022
1 parent 175f931 commit 5be91bb
Show file tree
Hide file tree
Showing 8 changed files with 31 additions and 22 deletions.
2 changes: 1 addition & 1 deletion Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@
<key>NSMicrophoneUsageDescription</key>
<string>This command line tool converts spoken audio to text.</string>
<key>NSSpeechRecognitionUsageDescription</key>
<string>This command line too converts spoken audio to text.</string>
<string>This command line tool converts spoken audio to text.</string>
</dict>
</plist>
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,14 @@

### macOS speech recognition via the command line

**hear** is a command line interface for the built-in speech recognition capabilities in macOS.
`hear` is a command line interface for the built-in speech recognition capabilities in macOS.
This makes it possible to transcribe spoken audio input.

Apple's macOS has long shipped with the `say` tool, a command line interface
for the operating system's venerable speech synthesis capabilities. As of
10.15 "Catalina", it also ships with highly capable speech recognition for a variety
of languages. This project is an attempt to provide a robust CLI for this functionality
since no such tool is provided by Apple. **hear** supports speech recognition and
since no such tool is provided by Apple. `hear` supports speech recognition and
transcription of both microphone input and audio files in a variety of formats.

See the [man page](https://sveinbjorn.org/files/manpages/hear.1.html) for further details.
Expand All @@ -25,11 +25,11 @@ See the [man page](https://sveinbjorn.org/files/manpages/hear.1.html) for furthe

<a href="https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=BDT58J7HYKAEE"><img align="right" src="https://www.paypalobjects.com/WEBSCR-640-20110306-1/en_US/i/btn/btn_donate_LG.gif" ></a>

**hear** is free, open source software written in Objective-C. The source code is freely
`hear` is free, open source software written in Objective-C. The source code is freely
[available](https://github.com/sveinbjornt/hear) under a [BSD license](#bsd-license).
**If you find this program useful, please [make a donation](https://sveinbjorn.org/donations).**

* **[⇩ Download hear 0.1](https://sveinbjorn.org/files/software/hear.zip)**
* **[⇩ Download hear 0.2](https://sveinbjorn.org/files/software/hear.zip)**
(Intel/ARM 64-bit, macOS 10.15 or later, ~50 KB)

## Installation
Expand Down Expand Up @@ -70,7 +70,7 @@ writing have a hard limit of something like 500 characters before quitting.
To build `hear` from source, run the following command from the repository root (requires Xcode command line build tools):

```
make
make build_unsigned
```

The resulting binary is created in `products/`.
Expand Down
4 changes: 4 additions & 0 deletions TODO.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
TODO for hear command line tool:

* Timeout option

4 changes: 2 additions & 2 deletions hear.1
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
.Dd March 7, 2022
.Dd October 27, 2022
.Dt HEAR 1
.Os Darwin
.Sh NAME
Expand Down Expand Up @@ -26,7 +26,7 @@ Print list of supported languages (locales) for speech recognition.
Specify speech recognition language (locale). Default is 'en-US'.
.It Fl i -input Ar audio_file
Input audio file. All formats supported by CoreAudio should work (e.g. WAV, MP3,
AAC, CAF, AIFF, etc.). If the argument is '-', the audio data is read
AAC, CAF, AIFF, ALAC, etc.). If the argument is '-', the audio data is read
from standard input, in which case you need to specify the format.
.It Fl f -format Ar format_name
Specify the format of the audio file (e.g. wav, mp3, aac, etc.). This flag
Expand Down
24 changes: 11 additions & 13 deletions hear.1.html
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
<html><head></head><body bgcolor="black" text="white"><pre><font face="Courier">
<b>HEAR(1) BSD General Commands Manual HEAR(1)</b>
<html><head></head><body><pre><font face="Courier"><b>HEAR(1) General Commands Manual HEAR(1)</b>

<b>NAME</b>

<b>hear</b> -- macOS speech recognition via the command line
<b>hear</b> &#x2013; macOS speech recognition via the command line

<b>SYNOPSIS</b>

Expand All @@ -19,17 +18,16 @@
The following flags are supported:

<b>-s</b> <b>--supported</b>
Print list of supported languages (locales) for speech recogni-
tion.
Print list of supported languages (locales) for speech
recognition.

<b>-l</b> <b>--language</b> <u>lang</u>
Specify speech recognition language (locale). Default is 'en-
US'.
Specify speech recognition language (locale). Default is 'en-US'.

<b>-i</b> <b>--input</b> <u>audio</u><b>_<u></b>file</u>
Input audio file. All formats supported by CoreAudio should work
(e.g. WAV, MP3, AAC, CAF, AIFF, etc.). If the argument is '-',
the audio data is read from standard input, in which case you
(e.g. WAV, MP3, AAC, CAF, AIFF, ALAC, etc.). If the argument is
'-', the audio data is read from standard input, in which case you
need to specify the format.

<b>-f</b> <b>--format</b> <u>format</u><b>_<u></b>name</u>
Expand All @@ -40,9 +38,9 @@
<b>-d</b> <b>--device</b>
Only use on-device offline speech recognition. The default is to
use whatever the macOS Speech Recognition API thinks is best,
which may include sending data to Apple servers. When on-device
is not enabled, there may be a hard limit to the length of audio
that can be transcribed in a single session.
which may include sending data to Apple servers. When on-device is
not enabled, there may be a hard limit to the length of audio that
can be transcribed in a single session.

<b>-m</b> <b>--mode</b>
Enable single-line output mode (only applies when the input is
Expand All @@ -64,6 +62,6 @@

Sveinbjorn Thordarson &lt;[email protected]&gt;

Darwin March 7, 2022 Darwin
Darwin October 27, 2022 Darwin
</font></pre>
</body></html>
4 changes: 4 additions & 0 deletions hear.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@
F45C87A327C0457A00EF9845 /* Common.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = Common.m; sourceTree = "<group>"; };
F45C87A427C0457A00EF9845 /* Hear.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = Hear.m; sourceTree = "<group>"; };
F45C87A527C0457A00EF9845 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
F47FA1B7290B31C500914395 /* TODO.md */ = {isa = PBXFileReference; lastKnownFileType = net.daringfireball.markdown; path = TODO.md; sourceTree = "<group>"; };
F47FA1B8290B38EF00914395 /* test.mp3 */ = {isa = PBXFileReference; lastKnownFileType = audio.mp3; path = test.mp3; sourceTree = "<group>"; };
F4ACB73928DB41DA00E9E778 /* hear.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = hear.entitlements; sourceTree = "<group>"; };
/* End PBXFileReference section */

Expand All @@ -58,6 +60,7 @@
children = (
F439F2C427D51D7F00626667 /* test.sh */,
F439F2C327D51D7F00626667 /* test.wav */,
F47FA1B8290B38EF00914395 /* test.mp3 */,
);
path = test;
sourceTree = "<group>";
Expand All @@ -68,6 +71,7 @@
F4ACB73928DB41DA00E9E778 /* hear.entitlements */,
F439F2C527D55BFF00626667 /* macos.yml */,
F45C87A127C0457A00EF9845 /* README.md */,
F47FA1B7290B31C500914395 /* TODO.md */,
F45C87A027C0457900EF9845 /* Makefile */,
F439F2C027D5157A00626667 /* install.sh */,
F45C879D27C0457900EF9845 /* hear.1 */,
Expand Down
3 changes: 3 additions & 0 deletions man2html.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/usr/bin/env bash

/usr/bin/man ./hear.1 | ../platypus/CLT/man/cat2html/cat2html > hear.1.html
2 changes: 1 addition & 1 deletion test/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ test_transcribe_file() {
OUTPUT=$("$BIN_PATH" -i "$1" -d)

if [ "$OUTPUT" != "$EXPECTED_OUTPUT" ]; then
echo "Unexpected output"
echo "Unexpected output: ${OUTPUT}"
exit 1
fi
}
Expand Down

0 comments on commit 5be91bb

Please sign in to comment.