From 3166e221d1a3e0878cce6267b1e1a1a8c1c7251f Mon Sep 17 00:00:00 2001 From: Sveinbjorn Thordarson Date: Fri, 3 Nov 2023 19:06:01 +0000 Subject: [PATCH] Added timeout flag, man page HTML generation + more, bumped version to 0.5 --- Makefile | 7 ++++-- cat2html | Bin 0 -> 167960 bytes hear.1 | 6 +++-- hear.1.html | 11 +++++---- hear.rb | 4 ++-- hear.xcodeproj/project.pbxproj | 16 ++++++++----- src/Common.h | 2 +- src/Hear.h | 3 ++- src/Hear.m | 40 +++++++++++++++++++++++++++++++-- src/main.m | 17 ++++++++++---- upload_manpage.sh | 5 +++++ 11 files changed, 88 insertions(+), 23 deletions(-) create mode 100755 cat2html create mode 100755 upload_manpage.sh diff --git a/Makefile b/Makefile index 6af7517..6816112 100644 --- a/Makefile +++ b/Makefile @@ -3,11 +3,11 @@ XCODE_PROJ := "hear.xcodeproj" PROGRAM_NAME := "hear" BUILD_DIR := "products" -VERSION := "0.4" +VERSION := "0.5" all: clean build_unsigned -release: clean build_signed archive size +release: clean build_signed archive man size test: clean build_unsigned runtests @@ -47,6 +47,9 @@ size: @echo "Archive size:" @cd "$(BUILD_DIR)"; du -hs "$(PROGRAM_NAME)-$(VERSION).zip" +man: + /usr/bin/man ./hear.1 | ./cat2html > hear.1.html + runtests: # The tests don't work in CI env due to missing permissions from macOS # @echo "Running tests" diff --git a/cat2html b/cat2html new file mode 100755 index 0000000000000000000000000000000000000000..f0762fac450f6595807a1f4e20bb4e8da48c9c2f GIT binary patch literal 167960 zcmeFa33yaRx<6c}m(U#&IzR$pO|t|O_F%w766l5mx*-Tc)QDoINjjvnLejyoNo(NR zO`91|beuc)f5lk=(b17%WUg0&CiEehD{&eokOZeiyf-n9v4Xy-Swiw2?GBYT~hTyW{ayXV)=jSia zU%Hr5dmi|mfdBF!IcaFX;V8^6D(qRD*Z1~JV=AvlGF?!K9}b7d)#y_goI2$@6Y z>hw4x3BC1eZ4vrqszr#8mKUihDA-4Bb#-k`D808lc38+u3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jh@EBv1$>=0=r2=0DuxX5tn% z({IgAfBMbY>Gy|{*ITMH6IMN*?M5&#`otNfgmuZ@V->XSa>Y(WZLa5G;u4-bJBug@e%5Q&aILM)&JV9(V=yQ2CA zon*T7VzxRFpd~&LviqyI_N^ZG&fB@$CJgM>bIb=Dy045am_ILn!0@DJ$`R+Ot0*b&n)lA zoVo1o`fm^1)H>`%?}*Qfj`Tg$dt6(aZF{;uKp*Y3XGJD~E`gZ)nv*xg$UaXvQWA9os z_qvCAESQzuBT#wEnm#}G{OGCIx;*^k;T^H^`R9LhrqW(xi{Bp}-Mpkeqv)PRRo+Y8 z-^Kb*pD??wcJlAX7eBc5eA~nWXAaF-R(Va{Ws}Z5kvp}mV{Y-q`d@1Mke5z<*5{cA iA1mBD(V0GcUt`yG#f!+Q<;5>Qx1lY2(8xLXV*UmW$z}Qg literal 0 HcmV?d00001 diff --git a/hear.1 b/hear.1 index 29b67d8..239701b 100644 --- a/hear.1 +++ b/hear.1 @@ -39,8 +39,10 @@ input device, e.g. microphone). .It Fl p -punctuation Add punctuation to speech recognition results. .It Fl x -exit Ar exit_word -Set exit word. This causes hear to exit when a speech recognition result ends -with the word in question. +Set exit word. This causes the program to exit when a speech recognition result +ends with the specified word. +.It Fl t -timeout Ar seconds +Exit if no recognition results are received within the specified number of seconds. .It Fl h -help Print help and exit. .It Fl v -version diff --git a/hear.1.html b/hear.1.html index 597d4a6..a76ebf6 100644 --- a/hear.1.html +++ b/hear.1.html @@ -6,7 +6,7 @@ SYNOPSIS - hear [-hvdmps] [-i audio_file] [-l language] [-x exit_word] + hear [-hvdmps] [-i audio_file] [-l locale] [-x exit_word] DESCRIPTION @@ -19,10 +19,9 @@ The following flags are supported: -s --supported - Print list of supported languages (locales) for speech - recognition. + Print list of supported locales for speech recognition and exit. - -l --language lang + -l --locale loc Specify speech recognition language (locale). Default is 'en- US'. @@ -49,6 +48,10 @@ Set exit word. This causes hear to exit when a speech recognition result ends with the word in question. + -t --timeout seconds + Exit if no recognition results are received within the specified + number of seconds. + -h --help Print help and exit. diff --git a/hear.rb b/hear.rb index c1ee97a..f65f54a 100644 --- a/hear.rb +++ b/hear.rb @@ -1,11 +1,11 @@ class Hear < Formula desc "Command-line speech recognition and transcription for macOS" homepage "https://sveinbjorn.org/hear" - url "https://github.com/sveinbjornt/hear/archive/refs/tags/0.3.tar.gz" + url "https://github.com/sveinbjornt/hear/archive/refs/tags/0.5.tar.gz" sha256 "671982c2361e636c79c5118684f73df2d0f282461e128ea0dc6034165819c520" license "BSD-3-Clause" - depends_on xcode: ["9.3", :build] + depends_on xcode: ["10.0", :build] depends_on macos: :catalina def install diff --git a/hear.xcodeproj/project.pbxproj b/hear.xcodeproj/project.pbxproj index 7bc2fa7..bacdd2a 100644 --- a/hear.xcodeproj/project.pbxproj +++ b/hear.xcodeproj/project.pbxproj @@ -42,6 +42,8 @@ F45C87A527C0457A00EF9845 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; F47FA1B7290B31C500914395 /* TODO.md */ = {isa = PBXFileReference; lastKnownFileType = net.daringfireball.markdown; path = TODO.md; sourceTree = ""; }; F47FA1B8290B38EF00914395 /* test.mp3 */ = {isa = PBXFileReference; lastKnownFileType = audio.mp3; path = test.mp3; sourceTree = ""; }; + F4A4D9472AF544D20036590C /* hear.1.html */ = {isa = PBXFileReference; lastKnownFileType = text.html; path = hear.1.html; sourceTree = ""; }; + F4A4D9482AF5455F0036590C /* upload_manpage.sh */ = {isa = PBXFileReference; lastKnownFileType = text.script.sh; path = upload_manpage.sh; sourceTree = ""; }; F4A6209E29EEC7BB00DD9BE1 /* Speech.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Speech.framework; path = System/Library/Frameworks/Speech.framework; sourceTree = SDKROOT; }; F4A620A029F2D79800DD9BE1 /* hear.rb */ = {isa = PBXFileReference; lastKnownFileType = text.script.ruby; path = hear.rb; sourceTree = ""; }; F4ACB73928DB41DA00E9E778 /* hear.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = hear.entitlements; sourceTree = ""; }; @@ -82,11 +84,13 @@ F45C87A027C0457900EF9845 /* Makefile */, F439F2C027D5157A00626667 /* install.sh */, F45C879D27C0457900EF9845 /* hear.1 */, + F4A4D9472AF544D20036590C /* hear.1.html */, + F4A4D9482AF5455F0036590C /* upload_manpage.sh */, F45C87A527C0457A00EF9845 /* Info.plist */, F45C87AA27C0458300EF9845 /* src */, F439F2C227D51D7F00626667 /* test */, - F43A461C27C010B2000469BC /* Products */, F4A6209D29EEC7BB00DD9BE1 /* Frameworks */, + F43A461C27C010B2000469BC /* Products */, ); sourceTree = ""; }; @@ -146,7 +150,7 @@ isa = PBXProject; attributes = { BuildIndependentTargetsInParallel = 1; - LastUpgradeCheck = 1400; + LastUpgradeCheck = 1500; TargetAttributes = { F43A461A27C010B2000469BC = { CreatedOnToolsVersion = 13.2.1; @@ -244,7 +248,8 @@ DEBUG_INFORMATION_FORMAT = dwarf; DEPLOYMENT_POSTPROCESSING = YES; ENABLE_STRICT_OBJC_MSGSEND = YES; - ENABLE_TESTABILITY = NO; + ENABLE_TESTABILITY = YES; + ENABLE_USER_SCRIPT_SANDBOXING = YES; GCC_C_LANGUAGE_STANDARD = gnu11; GCC_DYNAMIC_NO_PIC = NO; GCC_NO_COMMON_BLOCKS = YES; @@ -306,6 +311,7 @@ DEPLOYMENT_POSTPROCESSING = YES; ENABLE_NS_ASSERTIONS = NO; ENABLE_STRICT_OBJC_MSGSEND = YES; + ENABLE_USER_SCRIPT_SANDBOXING = YES; GCC_C_LANGUAGE_STANDARD = gnu11; GCC_NO_COMMON_BLOCKS = YES; GCC_WARN_64_TO_32_BIT_CONVERSION = YES; @@ -335,7 +341,7 @@ ENABLE_HARDENED_RUNTIME = YES; INFOPLIST_FILE = Info.plist; MACOSX_DEPLOYMENT_TARGET = 10.15; - MARKETING_VERSION = 0.4; + MARKETING_VERSION = 0.5; PRODUCT_BUNDLE_IDENTIFIER = org.sveinbjorn.hear; PRODUCT_NAME = "$(TARGET_NAME)"; SKIP_INSTALL = YES; @@ -356,7 +362,7 @@ ENABLE_HARDENED_RUNTIME = YES; INFOPLIST_FILE = Info.plist; MACOSX_DEPLOYMENT_TARGET = 10.15; - MARKETING_VERSION = 0.4; + MARKETING_VERSION = 0.5; PRODUCT_BUNDLE_IDENTIFIER = org.sveinbjorn.hear; PRODUCT_NAME = "$(TARGET_NAME)"; SKIP_INSTALL = YES; diff --git a/src/Common.h b/src/Common.h index ecc108b..a706273 100644 --- a/src/Common.h +++ b/src/Common.h @@ -33,7 +33,7 @@ #import #define PROGRAM_NAME @"hear" -#define PROGRAM_VERSION @"0.4" +#define PROGRAM_VERSION @"0.5" #define PROGRAM_AUTHOR @"Sveinbjorn Thordarson" #define PROGRAM_AUTHOR_EMAIL @"sveinbjorn@sveinbjorn.org" diff --git a/src/Hear.h b/src/Hear.h index 8977776..6e23ad4 100644 --- a/src/Hear.h +++ b/src/Hear.h @@ -43,6 +43,7 @@ onDevice:(BOOL)useOnDeviceRecognition singleLineMode:(BOOL)singleLine addPunctuation:(BOOL)addPunctuation - exitWord:(NSString *)exitWord; + exitWord:(NSString *)exitWord + timeout:(CGFloat)timeout; @end diff --git a/src/Hear.m b/src/Hear.m index 8631242..95479b9 100644 --- a/src/Hear.m +++ b/src/Hear.m @@ -41,6 +41,8 @@ @interface Hear() @property (nonatomic, retain) AVAudioEngine *engine; +@property (nonatomic, retain) NSTimer *timeoutTimer; + @property (nonatomic, retain) NSString *locale; @property (nonatomic, retain) NSString *inputFile; @property (nonatomic) BOOL useDeviceInput; @@ -48,6 +50,7 @@ @interface Hear() @property (nonatomic) BOOL singleLineMode; @property (nonatomic) BOOL addPunctuation; @property (nonatomic, retain) NSString *exitWord; +@property (nonatomic) CGFloat timeout; @end @@ -58,7 +61,8 @@ - (instancetype)initWithLocale:(NSString *)loc onDevice:(BOOL)onDevice singleLineMode:(BOOL)singleLine addPunctuation:(BOOL)punctuation - exitWord:(NSString *)exitWord { + exitWord:(NSString *)exitWord + timeout:(CGFloat)timeout { self = [super init]; if (self) { @@ -74,6 +78,7 @@ - (instancetype)initWithLocale:(NSString *)loc self.useDeviceInput = (input == nil); self.addPunctuation = punctuation; self.exitWord = exitWord; + self.timeout = timeout; } return self; } @@ -235,6 +240,10 @@ - (void)startListening { return; } + if (self.timeout > 0) { + [self startTimer:self]; + } + // Print to stdout NSString *transcript = result.bestTranscription.formattedString; if (self.singleLineMode) { @@ -278,13 +287,40 @@ - (void)startListening { ^(AVAudioPCMBuffer * _Nonnull buffer, AVAudioTime * _Nonnull when) { [(SFSpeechAudioBufferRecognitionRequest *)self.request appendAudioPCMBuffer:buffer]; }]; - + // Start engine NSError *err; [self.engine startAndReturnError:&err]; if (err != nil) { [self die:[NSString stringWithFormat:@"Failed to start audio engine: %@", [err localizedDescription]]]; } + + if (self.timeout > 0) { + [self startTimer:self]; + } +} + +- (void)startTimer:(id)sender { + [self performSelectorOnMainThread:@selector(_startTimer:) + withObject:self + waitUntilDone:NO]; +} + +- (void)_startTimer:(id)sender { + if (self.timeoutTimer != nil) { + [self.timeoutTimer invalidate]; + } + self.timeoutTimer = [NSTimer timerWithTimeInterval:self.timeout + target:self + selector:@selector(timedOut:) + userInfo:self + repeats:NO]; + [[NSRunLoop currentRunLoop] addTimer:self.timeoutTimer + forMode:NSDefaultRunLoopMode]; +} + +- (void)timedOut:(id)sender { + exit(EXIT_SUCCESS); } #pragma mark - Class methods diff --git a/src/main.m b/src/main.m index 514adaf..f60e813 100644 --- a/src/main.m +++ b/src/main.m @@ -43,7 +43,7 @@ static inline void PrintHelp(void); // Command line options -static const char optstring[] = "sl:i:dpmx:hv"; +static const char optstring[] = "sl:i:dpmx:t:hv"; static struct option long_options[] = { // List supported locales for speech to text @@ -60,6 +60,8 @@ {"mode", no_argument, 0, 'm'}, // Exit word {"exit-word", required_argument, 0, 'x'}, + // Timeout (in seconds) + {"timeout", required_argument, 0, 'x'}, // Print help {"help", no_argument, 0, 'h'}, // Print version @@ -82,6 +84,7 @@ int main(int argc, const char * argv[]) { @autoreleasepool { BOOL useOnDeviceRecognition = NO; BOOL singleLineMode = NO; BOOL addsPunctuation = NO; + CGFloat timeout = 0.0f; // Parse arguments int optch; @@ -127,6 +130,10 @@ int main(int argc, const char * argv[]) { @autoreleasepool { exitWord = @(optarg); break; + case 't': + timeout = [@(optarg) floatValue]; + break; + // Print version case 'v': PrintVersion(); @@ -148,9 +155,10 @@ int main(int argc, const char * argv[]) { @autoreleasepool { onDevice:useOnDeviceRecognition singleLineMode:singleLineMode addPunctuation:addsPunctuation - exitWord:exitWord]; + exitWord:exitWord + timeout:timeout]; [[NSApplication sharedApplication] setDelegate:hear]; - [[NSApplication sharedApplication] run]; + [NSApp run]; return EXIT_SUCCESS; }} @@ -173,7 +181,7 @@ static inline void PrintVersion(void) { static inline void PrintHelp(void) { PrintVersion(); NSPrint(@"\n\ -%@ [-vhmsdp] [-l lang] [-i file] [-x word]\n\ +%@ [-vhmsdp] [-l lang] [-i file] [-x word] [-t seconds]\n\ \n\ Options:\n\ \n\ @@ -185,6 +193,7 @@ static inline void PrintHelp(void) { -m --mode Enable single-line output mode (mic only)\n\ -p --punctuation Add punctuation to speech recognition results (macOS 13+)\n\ -x --exit-word Set exit word that causes program to quit\n\ + -t --timeout Set silence timeout (in seconds)\n\ \n\ -h --help Prints help\n\ -v --version Prints program name and version\n\ diff --git a/upload_manpage.sh b/upload_manpage.sh new file mode 100755 index 0000000..f46ed4b --- /dev/null +++ b/upload_manpage.sh @@ -0,0 +1,5 @@ +#!/bin/sh + +USER=$1 + +scp hear.1.html $USER@sveinbjorn.org:/www/sveinbjorn/html/files/manpages/hear.1.html