From 7c7a621f4a535945f66ab670d3f2db6640423ca3 Mon Sep 17 00:00:00 2001 From: Chidi Williams Date: Thu, 29 Sep 2022 21:05:03 +0100 Subject: [PATCH 01/15] Add build command for Windows --- .github/workflows/ci.yml | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index a593966a..27d73061 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -3,8 +3,17 @@ name: CI 'on': push jobs: - ci: - runs-on: ubuntu-latest + build: + runs-on: ${{ matrix.os }} + strategy: + matrix: + include: + - os: macos-latest + CMD_BUILD: > + poetry run make bundle_mac version=rc + - os: windows-latest + CMD_BUILD: > + poetry run make buzz steps: - uses: actions/checkout@v3 - uses: actions/setup-python@v4 @@ -22,12 +31,9 @@ jobs: uses: actions/cache@v3 with: path: .venv - key: venv-${{ runner.os }}-${{ hashFiles('**/poetry.lock') }}-${{ hashFiles('**/package-lock.json') }}-2 + key: venv-${{ runner.os }}-${{ hashFiles('**/poetry.lock') }}-2 - run: pip install poetry - run: poetry install - - run: poetry run make buzz - - uses: actions/upload-artifact@v3 - with: - name: pyinstaller - path: dist/* + - run: ${{ matrix.CMD_BUILD }} + - run: ls dist/ From 7ab295f3cffdddb969216375d1d3a663576b2cf8 Mon Sep 17 00:00:00 2001 From: Chidi Williams Date: Thu, 29 Sep 2022 21:19:33 +0100 Subject: [PATCH 02/15] Add build command for Windows --- .github/workflows/ci.yml | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 27d73061..c8a9afc0 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -10,10 +10,16 @@ jobs: include: - os: macos-latest CMD_BUILD: > + brew install create-dmg poetry run make bundle_mac version=rc + PATH: | + dist/buzz*.dmg + dist/buzz*.zip - os: windows-latest CMD_BUILD: > poetry run make buzz + PATH: | + dist/Buzz.exe steps: - uses: actions/checkout@v3 - uses: actions/setup-python@v4 @@ -33,7 +39,6 @@ jobs: path: .venv key: venv-${{ runner.os }}-${{ hashFiles('**/poetry.lock') }}-2 - - run: pip install poetry - run: poetry install - run: ${{ matrix.CMD_BUILD }} - run: ls dist/ From e98b627314a464163da98085a78f3b4e50a000f6 Mon Sep 17 00:00:00 2001 From: Chidi Williams Date: Thu, 29 Sep 2022 21:20:27 +0100 Subject: [PATCH 03/15] Add build command for Windows --- .github/workflows/ci.yml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index c8a9afc0..823eccab 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -41,4 +41,8 @@ jobs: - run: poetry install - run: ${{ matrix.CMD_BUILD }} - - run: ls dist/ + - uses: actions/upload-artifact@v3 + with: + name: Buzz + path: | + ${{ matrix.PATH }} From 06b2e1cd94463d66b05af25ee349319ed803de26 Mon Sep 17 00:00:00 2001 From: Chidi Williams Date: Thu, 29 Sep 2022 21:25:25 +0100 Subject: [PATCH 04/15] Add build command for Windows --- .github/workflows/ci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 823eccab..8ad0c4d4 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -9,14 +9,14 @@ jobs: matrix: include: - os: macos-latest - CMD_BUILD: > + CMD_BUILD: | brew install create-dmg poetry run make bundle_mac version=rc PATH: | dist/buzz*.dmg dist/buzz*.zip - os: windows-latest - CMD_BUILD: > + CMD_BUILD: | poetry run make buzz PATH: | dist/Buzz.exe From c5226301dd1e69380fc79d08bec54c20cc15dd63 Mon Sep 17 00:00:00 2001 From: Chidi Williams Date: Thu, 29 Sep 2022 21:35:56 +0100 Subject: [PATCH 05/15] Add build command for Windows --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 8ad0c4d4..bc0c171d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -19,7 +19,7 @@ jobs: CMD_BUILD: | poetry run make buzz PATH: | - dist/Buzz.exe + dist/* steps: - uses: actions/checkout@v3 - uses: actions/setup-python@v4 From 969554b5f1ed7be9f5a8217721caa308d22c3840 Mon Sep 17 00:00:00 2001 From: Chidi Williams Date: Fri, 30 Sep 2022 09:38:12 +0100 Subject: [PATCH 06/15] Add build command for Windows --- .github/workflows/ci.yml | 4 ++-- Makefile | 4 ++++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index bc0c171d..146f4bae 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -17,9 +17,9 @@ jobs: dist/buzz*.zip - os: windows-latest CMD_BUILD: | - poetry run make buzz + poetry run make bundle_windows version=rc PATH: | - dist/* + dist/buzz*.zip steps: - uses: actions/checkout@v3 - uses: actions/setup-python@v4 diff --git a/Makefile b/Makefile index b27c1d44..9a1f62cf 100644 --- a/Makefile +++ b/Makefile @@ -4,6 +4,10 @@ buzz: clean: rm -r dist/* || true +bundle_windows: + make buzz + tar -czf dist/buzz-${version}-windows.zip dist/Buzz + bundle_mac: make buzz tar -czf dist/buzz-${version}-unix.zip dist/Buzz From 86d2f4af43fc6aa8cd3179cac4ae7258f4703b6c Mon Sep 17 00:00:00 2001 From: Chidi Williams Date: Sat, 1 Oct 2022 07:29:36 +0100 Subject: [PATCH 07/15] Change archive file extension type to .tar.gz --- Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 9a1f62cf..f663a2aa 100644 --- a/Makefile +++ b/Makefile @@ -6,11 +6,11 @@ clean: bundle_windows: make buzz - tar -czf dist/buzz-${version}-windows.zip dist/Buzz + tar -czf dist/buzz-${version}-windows.tar.gz dist/Buzz bundle_mac: make buzz - tar -czf dist/buzz-${version}-unix.zip dist/Buzz + tar -czf dist/buzz-${version}-unix.tar.gz dist/Buzz mkdir -p dist/dmg && cp -r dist/Buzz.app dist/dmg create-dmg \ --volname "Buzz" \ From 9effe34fba179ccedb65e2d242125dfe9eb0c14d Mon Sep 17 00:00:00 2001 From: Chidi Williams Date: Sat, 1 Oct 2022 07:34:24 +0100 Subject: [PATCH 08/15] Add installation instructions --- README.md | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/README.md b/README.md index 1439c509..4cc3be85 100644 --- a/README.md +++ b/README.md @@ -4,6 +4,7 @@ ![MIT License](https://img.shields.io/badge/license-MIT-green) [![CI](https://github.com/chidiwilliams/buzz/actions/workflows/ci.yml/badge.svg)](https://github.com/chidiwilliams/buzz/actions/workflows/ci.yml) +![GitHub release (latest by date)](https://img.shields.io/github/v/release/chidiwilliams/buzz) Buzz transcribes audio from your computer's microphones to text in real-time using OpenAI's [Whisper](https://github.com/openai/whisper). @@ -30,6 +31,25 @@ choco install ffmpeg scoop install ffmpeg ``` +## Installation + +To install Buzz, download the [latest version](https://github.com/chidiwilliams/buzz/releases/latest) for your Operating System. + +## Mac + +- Download and open the `*-mac.dmg` file. +- After the installation window opens, drag the Buzz icon into the folder to add Buzz to your Applications directory. + +## Windows + +- Download and unzip the `*-windows.zip` file. +- Open the Buzz.exe file + +## Linux + +- Download and unzip the `*-unix.zip` file. +- Open the Buzz binary file. + ## How to use To record from a system microphone, select a model, language, task, microphone, and delay, then click Record. From e2f266da768ebc771b984ce6eb360337d5de5e8c Mon Sep 17 00:00:00 2001 From: Chidi Williams Date: Sat, 1 Oct 2022 07:35:09 +0100 Subject: [PATCH 09/15] Change archive file extension type to .tar.gz --- .github/workflows/ci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 146f4bae..6e0eb911 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -14,12 +14,12 @@ jobs: poetry run make bundle_mac version=rc PATH: | dist/buzz*.dmg - dist/buzz*.zip + dist/buzz*.tar.gz - os: windows-latest CMD_BUILD: | poetry run make bundle_windows version=rc PATH: | - dist/buzz*.zip + dist/buzz*.tar.gz steps: - uses: actions/checkout@v3 - uses: actions/setup-python@v4 From 3acff81d94d20f89010c1162c7e0ccec50964ae1 Mon Sep 17 00:00:00 2001 From: Chidi Williams Date: Sat, 1 Oct 2022 07:51:30 +0100 Subject: [PATCH 10/15] Add platform specific styling --- gui.py | 28 ++++++++++++++++++++++------ 1 file changed, 22 insertions(+), 6 deletions(-) diff --git a/gui.py b/gui.py index 4df9cd33..716567c5 100644 --- a/gui.py +++ b/gui.py @@ -1,5 +1,6 @@ import enum -from typing import List, Optional, Tuple +import platform +from typing import Dict, List, Optional, Tuple import sounddevice import whisper @@ -11,10 +12,19 @@ from whisper import tokenizer from transcriber import Transcriber +def get_platform_styles(all_platform_styles: Dict[str, str]): + return all_platform_styles.get(platform.system(), '') + + class Label(QLabel): + os_styles = { + 'Darwin': 'QLabel { color: #ddd; }' + } + def __init__(self, name: str, *args) -> None: super().__init__(name, *args) - self.setStyleSheet('QLabel { color: #ddd; text-align: right; }') + self.setStyleSheet('QLabel { text-align: right; } %s' % + get_platform_styles(self.os_styles)) self.setAlignment(Qt.AlignmentFlag( Qt.AlignmentFlag.AlignVCenter | Qt.AlignmentFlag.AlignRight)) @@ -115,6 +125,15 @@ class DelaysComboBox(QComboBox): class TextDisplayBox(QTextEdit): """TextDisplayBox is a read-only textbox""" + os_styles = { + 'Darwin': '''QTextEdit { + border-radius: 6; + background-color: #252525; + color: #dfdfdf; + }''', + 'Windows': 'QTextEdit { background-color: #ffffff; }' + } + def __init__(self, *args) -> None: super().__init__(*args) self.setReadOnly(True) @@ -125,10 +144,7 @@ class TextDisplayBox(QTextEdit): padding-top: 5; padding-bottom: 5; padding-right: 5; - border-radius: 6; - background-color: #252525; - color: #dfdfdf; - }''') + } %s''' % get_platform_styles(self.os_styles)) class RecordButton(QPushButton): From 50a869ba7691baa6da16746570fcda567e8e4729 Mon Sep 17 00:00:00 2001 From: Chidi Williams Date: Sat, 1 Oct 2022 08:04:55 +0100 Subject: [PATCH 11/15] Fix build and run instructions --- README.md | 35 ++++++++++++++++++++--------------- 1 file changed, 20 insertions(+), 15 deletions(-) diff --git a/README.md b/README.md index 4cc3be85..bce14cd1 100644 --- a/README.md +++ b/README.md @@ -72,40 +72,45 @@ To record audio playing out from your computer, you'll need to install an audio 1. Install [BlackHole via Homebrew](https://github.com/ExistentialAudio/BlackHole#option-2-install-via-homebrew) -```shell -brew install blackhole-2ch -``` + ```shell + brew install blackhole-2ch + ``` 2. Open Audio MIDI Setup from Spotlight or from `/Applications/Utilities/Audio Midi Setup.app`. -![](https://existential.audio/howto/img/spotlight.png) + ![Open Audio MIDI Setup from Spotlight](https://existential.audio/howto/img/spotlight.png) 3. Click the '+' icon at the lower left corner and select 'Create Multi-Output Device'. -![](https://existential.audio/howto/img/createmulti-output.png) + ![Create multi-output device](https://existential.audio/howto/img/createmulti-output.png) 4. Add your default speaker and BlackHole to the multi-output device. -![Screenshot of multi-output device](https://existential.audio/howto/img/multi-output.png) + ![Screenshot of multi-output device](https://existential.audio/howto/img/multi-output.png) 5. Select this multi-output device as your speaker (application or system-wide) to play audio into BlackHole. 6. Open Buzz, select BlackHole as your microphone, and record as before to see transcriptions from the audio playing through BlackHole. -## Build +## Build/run locally -To build Buzz, install the dependencies: +To build/run Buzz locally from source, first install the dependencies: + +1. Install [Poetry](https://python-poetry.org/docs/#installing-with-the-official-installer). +2. Install the project dependencies. + + ```shell + poetry install + ``` + +Then, to run: ```shell -# using pip -pip install . - -# using poetry -poetry install +poetry run python main.py ``` -Then run: +To build: ```shell -make buzz +poetry run pyinstaller --noconfirm Buzz.spec ``` From 671d395c93e1837675c746af63a6a26b96185ff5 Mon Sep 17 00:00:00 2001 From: Chidi Williams Date: Sat, 1 Oct 2022 08:40:12 +0100 Subject: [PATCH 12/15] Add release job --- .github/workflows/ci.yml | 31 +++++++++++++++++++++++-------- 1 file changed, 23 insertions(+), 8 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 6e0eb911..0c341db1 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -8,16 +8,16 @@ jobs: strategy: matrix: include: - - os: macos-latest - CMD_BUILD: | - brew install create-dmg - poetry run make bundle_mac version=rc - PATH: | - dist/buzz*.dmg - dist/buzz*.tar.gz + # - os: macos-latest + # CMD_BUILD: | + # brew install create-dmg + # poetry run make bundle_mac version=$GITHUB_REF_NAME + # PATH: | + # dist/buzz*.dmg + # dist/buzz*.tar.gz - os: windows-latest CMD_BUILD: | - poetry run make bundle_windows version=rc + poetry run make bundle_windows version=$env:GITHUB_REF_NAME PATH: | dist/buzz*.tar.gz steps: @@ -46,3 +46,18 @@ jobs: name: Buzz path: | ${{ matrix.PATH }} + release: + runs-on: ubuntu-latest + needs: build + # if: startsWith(github.ref, 'refs/tags/') + steps: + - uses: actions/download-artifact@v3 + with: + name: Buzz + - name: Release + uses: softprops/action-gh-release@v1 + if: startsWith(github.ref, 'refs/tags/') + with: + files: | + buzz*.tar.gz + buzz*.dmg From 988a1953027904e5ae800738205551a9598dd778 Mon Sep 17 00:00:00 2001 From: Chidi Williams Date: Sat, 1 Oct 2022 08:41:42 +0100 Subject: [PATCH 13/15] Add release job --- .github/workflows/ci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 0c341db1..37474624 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -59,5 +59,5 @@ jobs: if: startsWith(github.ref, 'refs/tags/') with: files: | - buzz*.tar.gz - buzz*.dmg + buzz*.tar.gz + buzz*.dmg From 1e62ae700584bfc4b2b980c699cae43a8019e8b5 Mon Sep 17 00:00:00 2001 From: Chidi Williams Date: Sat, 1 Oct 2022 08:49:39 +0100 Subject: [PATCH 14/15] Add release job --- .github/workflows/ci.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 37474624..058ee66b 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -54,6 +54,7 @@ jobs: - uses: actions/download-artifact@v3 with: name: Buzz + - run: ls && ls buzz - name: Release uses: softprops/action-gh-release@v1 if: startsWith(github.ref, 'refs/tags/') From 91b1da7cd0cf4e23db7e1789875b81e58513496d Mon Sep 17 00:00:00 2001 From: Chidi Williams Date: Sat, 1 Oct 2022 09:13:59 +0100 Subject: [PATCH 15/15] Add release job --- .github/workflows/ci.yml | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 058ee66b..507264f8 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -8,13 +8,13 @@ jobs: strategy: matrix: include: - # - os: macos-latest - # CMD_BUILD: | - # brew install create-dmg - # poetry run make bundle_mac version=$GITHUB_REF_NAME - # PATH: | - # dist/buzz*.dmg - # dist/buzz*.tar.gz + - os: macos-latest + CMD_BUILD: | + brew install create-dmg + poetry run make bundle_mac version=$GITHUB_REF_NAME + PATH: | + dist/buzz*.dmg + dist/buzz*.tar.gz - os: windows-latest CMD_BUILD: | poetry run make bundle_windows version=$env:GITHUB_REF_NAME @@ -49,15 +49,13 @@ jobs: release: runs-on: ubuntu-latest needs: build - # if: startsWith(github.ref, 'refs/tags/') + if: startsWith(github.ref, 'refs/tags/') steps: - uses: actions/download-artifact@v3 with: name: Buzz - - run: ls && ls buzz - name: Release uses: softprops/action-gh-release@v1 - if: startsWith(github.ref, 'refs/tags/') with: files: | buzz*.tar.gz