diff --git a/README.md b/README.md index 68f9def..20f57ee 100644 --- a/README.md +++ b/README.md @@ -10,11 +10,7 @@ It supports multiple languages thanks to [Coqui's library of models](https://git ## Installation -On Debian-based x86 Linux systems like Ubuntu you should be able to install [the latest .deb package](https://github.com/petewarden/spchcat/releases/download/v0.0.2-alpha/spchcat_0.0-2_amd64.deb) by downloading and double-clicking it. Other platforms are currently unsupported. You may need to install the `sox` audio tool library, by running something like: - -```bash -sudo apt-get install sox -``` +On Debian-based x86 Linux systems like Ubuntu you should be able to install [the latest .deb package](https://github.com/petewarden/spchcat/releases/download/v0.0.2-alpha/spchcat_0.0-2_amd64.deb) by downloading and double-clicking it. Other platforms are currently unsupported. There's a notebook you can run in Colab at [notebooks/install.ipynb](https://github.com/petewarden/spchcat/blob/main/notebooks/install.ipynb) that shows all installation steps. diff --git a/notebooks/install.ipynb b/notebooks/install.ipynb index cd6970f..300fe06 100644 --- a/notebooks/install.ipynb +++ b/notebooks/install.ipynb @@ -1 +1 @@ -{"nbformat":4,"nbformat_minor":0,"metadata":{"colab":{"name":"Installing spchat","provenance":[],"authorship_tag":"ABX9TyOUEFnuIlWvgI2yToO63QAv"},"kernelspec":{"name":"python3","display_name":"Python 3"},"language_info":{"name":"python"}},"cells":[{"cell_type":"markdown","source":["# Installing `spchcat`\n","\n","Example script showing how to install the `spchcat` tool from a .deb package installer.\n","\n","\n"," \n"," \n","
\n"," Run in Google Colab\n"," \n"," View source on GitHub\n","
"],"metadata":{"id":"v_SgamvYQ1ML"}},{"cell_type":"markdown","source":["## Fetch the Package\n","\n","We'll install the `spchcat` speech recognition tool from a `.deb` package, downloaded from [github.com/petewarden/spchcat/releases](https://github.com/petewarden/spchcat/releases), so use `wget` to fetch the latest version."],"metadata":{"id":"2iPaesXqRGL4"}},{"cell_type":"code","source":["!wget -q https://github.com/petewarden/spchcat/releases/download/v0.0.2-alpha/spchcat_0.0-2_amd64.deb"],"metadata":{"colab":{"base_uri":"https://localhost:8080/"},"id":"xbUFTBZwRwji","executionInfo":{"status":"ok","timestamp":1641235885457,"user_tz":480,"elapsed":36614,"user":{"displayName":"Pete Warden","photoUrl":"https://lh3.googleusercontent.com/a-/AOh14GiRDB9VwLsxruonSf2xY25P4vvEWzDmpmsfjNLf=s64","userId":"03508279103930495710"}},"outputId":"e0f57b0b-78fd-4610-bfd1-d624a061e301"},"execution_count":1,"outputs":[{"output_type":"stream","name":"stdout","text":["--2022-01-03 18:50:48-- https://github.com/petewarden/spchcat/releases/download/v0.0.1-alpha/spchcat_0.0-1_amd64.deb\n","Resolving github.com (github.com)... 140.82.114.3\n","Connecting to github.com (github.com)|140.82.114.3|:443... connected.\n","HTTP request sent, awaiting response... 302 Found\n","Location: https://objects.githubusercontent.com/github-production-release-asset-2e65be/442925287/51c57b3e-b498-41e5-80e7-2edc8de94c07?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAIWNJYAX4CSVEH53A%2F20220103%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20220103T185048Z&X-Amz-Expires=300&X-Amz-Signature=ff064e98c09215948b4ca1958adef26eeffe03aa0a47218e3b5f8c03706ec3c6&X-Amz-SignedHeaders=host&actor_id=0&key_id=0&repo_id=442925287&response-content-disposition=attachment%3B%20filename%3Dspchcat_0.0-1_amd64.deb&response-content-type=application%2Foctet-stream [following]\n","--2022-01-03 18:50:48-- https://objects.githubusercontent.com/github-production-release-asset-2e65be/442925287/51c57b3e-b498-41e5-80e7-2edc8de94c07?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAIWNJYAX4CSVEH53A%2F20220103%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20220103T185048Z&X-Amz-Expires=300&X-Amz-Signature=ff064e98c09215948b4ca1958adef26eeffe03aa0a47218e3b5f8c03706ec3c6&X-Amz-SignedHeaders=host&actor_id=0&key_id=0&repo_id=442925287&response-content-disposition=attachment%3B%20filename%3Dspchcat_0.0-1_amd64.deb&response-content-type=application%2Foctet-stream\n","Resolving objects.githubusercontent.com (objects.githubusercontent.com)... 185.199.110.133, 185.199.108.133, 185.199.111.133, ...\n","Connecting to objects.githubusercontent.com (objects.githubusercontent.com)|185.199.110.133|:443... connected.\n","HTTP request sent, awaiting response... 200 OK\n","Length: 1084496196 (1.0G) [application/octet-stream]\n","Saving to: ‘spchcat_0.0-1_amd64.deb’\n","\n","spchcat_0.0-1_amd64 100%[===================>] 1.01G 35.8MB/s in 36s \n","\n","2022-01-03 18:51:25 (28.7 MB/s) - ‘spchcat_0.0-1_amd64.deb’ saved [1084496196/1084496196]\n","\n"]}]},{"cell_type":"markdown","source":["## Install Dependencies\n","\n","We do need the `sox` library, so make sure it's installed."],"metadata":{"id":"FpePpcFmRxbB"}},{"cell_type":"code","source":["!apt-get -q install -y sox"],"metadata":{"colab":{"base_uri":"https://localhost:8080/"},"id":"GIcQ7uC0T8T7","executionInfo":{"status":"ok","timestamp":1641236409678,"user_tz":480,"elapsed":12552,"user":{"displayName":"Pete Warden","photoUrl":"https://lh3.googleusercontent.com/a-/AOh14GiRDB9VwLsxruonSf2xY25P4vvEWzDmpmsfjNLf=s64","userId":"03508279103930495710"}},"outputId":"9a5d750a-aa83-478d-b9f2-5e618d2d8444"},"execution_count":6,"outputs":[{"output_type":"stream","name":"stdout","text":["Reading package lists... Done\n","Building dependency tree \n","Reading state information... Done\n","The following additional packages will be installed:\n"," libmagic-mgc libmagic1 libopencore-amrnb0 libopencore-amrwb0 libsox-fmt-alsa\n"," libsox-fmt-base libsox3\n","Suggested packages:\n"," file libsox-fmt-all\n","The following NEW packages will be installed:\n"," libmagic-mgc libmagic1 libopencore-amrnb0 libopencore-amrwb0 libsox-fmt-alsa\n"," libsox-fmt-base libsox3 sox\n","0 upgraded, 8 newly installed, 0 to remove and 37 not upgraded.\n","Need to get 760 kB of archives.\n","After this operation, 6,717 kB of additional disk space will be used.\n","Get:1 http://archive.ubuntu.com/ubuntu bionic/universe amd64 libopencore-amrnb0 amd64 0.1.3-2.1 [92.0 kB]\n","Get:2 http://archive.ubuntu.com/ubuntu bionic/universe amd64 libopencore-amrwb0 amd64 0.1.3-2.1 [45.8 kB]\n","Get:3 http://archive.ubuntu.com/ubuntu bionic-updates/main amd64 libmagic-mgc amd64 1:5.32-2ubuntu0.4 [184 kB]\n","Get:4 http://archive.ubuntu.com/ubuntu bionic-updates/main amd64 libmagic1 amd64 1:5.32-2ubuntu0.4 [68.6 kB]\n","Get:5 http://archive.ubuntu.com/ubuntu bionic-updates/universe amd64 libsox3 amd64 14.4.2-3ubuntu0.18.04.1 [226 kB]\n","Get:6 http://archive.ubuntu.com/ubuntu bionic-updates/universe amd64 libsox-fmt-alsa amd64 14.4.2-3ubuntu0.18.04.1 [10.6 kB]\n","Get:7 http://archive.ubuntu.com/ubuntu bionic-updates/universe amd64 libsox-fmt-base amd64 14.4.2-3ubuntu0.18.04.1 [32.1 kB]\n","Get:8 http://archive.ubuntu.com/ubuntu bionic-updates/universe amd64 sox amd64 14.4.2-3ubuntu0.18.04.1 [101 kB]\n","Fetched 760 kB in 1s (757 kB/s)\n","Selecting previously unselected package libopencore-amrnb0:amd64.\n","(Reading database ... 155495 files and directories currently installed.)\n","Preparing to unpack .../0-libopencore-amrnb0_0.1.3-2.1_amd64.deb ...\n","Unpacking libopencore-amrnb0:amd64 (0.1.3-2.1) ...\n","Selecting previously unselected package libopencore-amrwb0:amd64.\n","Preparing to unpack .../1-libopencore-amrwb0_0.1.3-2.1_amd64.deb ...\n","Unpacking libopencore-amrwb0:amd64 (0.1.3-2.1) ...\n","Selecting previously unselected package libmagic-mgc.\n","Preparing to unpack .../2-libmagic-mgc_1%3a5.32-2ubuntu0.4_amd64.deb ...\n","Unpacking libmagic-mgc (1:5.32-2ubuntu0.4) ...\n","Selecting previously unselected package libmagic1:amd64.\n","Preparing to unpack .../3-libmagic1_1%3a5.32-2ubuntu0.4_amd64.deb ...\n","Unpacking libmagic1:amd64 (1:5.32-2ubuntu0.4) ...\n","Selecting previously unselected package libsox3:amd64.\n","Preparing to unpack .../4-libsox3_14.4.2-3ubuntu0.18.04.1_amd64.deb ...\n","Unpacking libsox3:amd64 (14.4.2-3ubuntu0.18.04.1) ...\n","Selecting previously unselected package libsox-fmt-alsa:amd64.\n","Preparing to unpack .../5-libsox-fmt-alsa_14.4.2-3ubuntu0.18.04.1_amd64.deb ...\n","Unpacking libsox-fmt-alsa:amd64 (14.4.2-3ubuntu0.18.04.1) ...\n","Selecting previously unselected package libsox-fmt-base:amd64.\n","Preparing to unpack .../6-libsox-fmt-base_14.4.2-3ubuntu0.18.04.1_amd64.deb ...\n","Unpacking libsox-fmt-base:amd64 (14.4.2-3ubuntu0.18.04.1) ...\n","Selecting previously unselected package sox.\n","Preparing to unpack .../7-sox_14.4.2-3ubuntu0.18.04.1_amd64.deb ...\n","Unpacking sox (14.4.2-3ubuntu0.18.04.1) ...\n","Setting up libmagic-mgc (1:5.32-2ubuntu0.4) ...\n","Setting up libmagic1:amd64 (1:5.32-2ubuntu0.4) ...\n","Setting up libopencore-amrnb0:amd64 (0.1.3-2.1) ...\n","Setting up libopencore-amrwb0:amd64 (0.1.3-2.1) ...\n","Setting up libsox3:amd64 (14.4.2-3ubuntu0.18.04.1) ...\n","Setting up libsox-fmt-base:amd64 (14.4.2-3ubuntu0.18.04.1) ...\n","Setting up libsox-fmt-alsa:amd64 (14.4.2-3ubuntu0.18.04.1) ...\n","Setting up sox (14.4.2-3ubuntu0.18.04.1) ...\n","Processing triggers for libc-bin (2.27-3ubuntu1.3) ...\n","/sbin/ldconfig.real: /usr/local/lib/python3.7/dist-packages/ideep4py/lib/libmkldnn.so.0 is not a symbolic link\n","\n","Processing triggers for man-db (2.8.3-2ubuntu0.1) ...\n","Processing triggers for mime-support (3.60ubuntu1) ...\n"]}]},{"cell_type":"markdown","source":["## Install the Package\n","\n","On a desktop machine we could just double-click on the package to open and install it, but because we're in a notebook we'll use the `dpkg` tool instead."],"metadata":{"id":"oBDTBC57R8uy"}},{"cell_type":"code","execution_count":3,"metadata":{"colab":{"base_uri":"https://localhost:8080/"},"id":"WPIGB-qPRhNA","executionInfo":{"status":"ok","timestamp":1641236030493,"user_tz":480,"elapsed":116483,"user":{"displayName":"Pete Warden","photoUrl":"https://lh3.googleusercontent.com/a-/AOh14GiRDB9VwLsxruonSf2xY25P4vvEWzDmpmsfjNLf=s64","userId":"03508279103930495710"}},"outputId":"8b1b8226-b8c7-4056-d7cf-17729fcd4856"},"outputs":[{"output_type":"stream","name":"stdout","text":["Selecting previously unselected package spchcat.\n","(Reading database ... 155222 files and directories currently installed.)\n","Preparing to unpack spchcat_0.0-1_amd64.deb ...\n","Unpacking spchcat (0.0-1) ...\n","Setting up spchcat (0.0-1) ...\n"]}],"source":["!dpkg -i spchcat_0.0-1_amd64.deb"]},{"cell_type":"markdown","source":["## Test `spchcat`\n","\n","The tool needs an audio input to run on, and since this may be running in Colab or another environment without a microphone attached, we'll download some test audio and run it on that."],"metadata":{"id":"hQ6FCiUDSLHK"}},{"cell_type":"code","source":["!wget --quiet https://github.com/coqui-ai/STT/releases/download/v1.1.0/audio-1.1.0.tar.gz\n","!tar -xzf audio-1.1.0.tar.gz"],"metadata":{"id":"yVLUfQp_Seh5"},"execution_count":null,"outputs":[]},{"cell_type":"code","source":["!spchcat audio/4507-16021-0012.wav"],"metadata":{"colab":{"base_uri":"https://localhost:8080/"},"id":"p3hTA19dSJvN","executionInfo":{"status":"ok","timestamp":1641236415781,"user_tz":480,"elapsed":377,"user":{"displayName":"Pete Warden","photoUrl":"https://lh3.googleusercontent.com/a-/AOh14GiRDB9VwLsxruonSf2xY25P4vvEWzDmpmsfjNLf=s64","userId":"03508279103930495710"}},"outputId":"ac151cd6-d339-458e-f1a5-0c9c99942824"},"execution_count":7,"outputs":[{"output_type":"stream","name":"stdout","text":["spchcat: /usr/lib/x86_64-linux-gnu/libstdc++.so.6: version `GLIBCXX_3.4.26' not found (required by spchcat)\n","spchcat: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.34' not found (required by spchcat)\n","spchcat: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.33' not found (required by spchcat)\n"]}]}]} \ No newline at end of file +{"cells":[{"cell_type":"markdown","metadata":{"id":"v_SgamvYQ1ML"},"source":["# Installing `spchcat`\n","\n","Example script showing how to install the `spchcat` tool from a .deb package installer.\n","\n","\n"," \n"," \n","
\n"," Run in Google Colab\n"," \n"," View source on GitHub\n","
"]},{"cell_type":"markdown","metadata":{"id":"2iPaesXqRGL4"},"source":["## Fetch the Package\n","\n","We'll install the `spchcat` speech recognition tool from a `.deb` package, downloaded from [github.com/petewarden/spchcat/releases](https://github.com/petewarden/spchcat/releases), so use `wget` to fetch the latest version."]},{"cell_type":"code","execution_count":1,"metadata":{"colab":{"base_uri":"https://localhost:8080/"},"executionInfo":{"elapsed":36614,"status":"ok","timestamp":1641235885457,"user":{"displayName":"Pete Warden","photoUrl":"https://lh3.googleusercontent.com/a-/AOh14GiRDB9VwLsxruonSf2xY25P4vvEWzDmpmsfjNLf=s64","userId":"03508279103930495710"},"user_tz":480},"id":"xbUFTBZwRwji","outputId":"e0f57b0b-78fd-4610-bfd1-d624a061e301"},"outputs":[{"name":"stdout","output_type":"stream","text":["--2022-01-03 18:50:48-- https://github.com/petewarden/spchcat/releases/download/v0.0.1-alpha/spchcat_0.0-1_amd64.deb\n","Resolving github.com (github.com)... 140.82.114.3\n","Connecting to github.com (github.com)|140.82.114.3|:443... connected.\n","HTTP request sent, awaiting response... 302 Found\n","Location: https://objects.githubusercontent.com/github-production-release-asset-2e65be/442925287/51c57b3e-b498-41e5-80e7-2edc8de94c07?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAIWNJYAX4CSVEH53A%2F20220103%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20220103T185048Z&X-Amz-Expires=300&X-Amz-Signature=ff064e98c09215948b4ca1958adef26eeffe03aa0a47218e3b5f8c03706ec3c6&X-Amz-SignedHeaders=host&actor_id=0&key_id=0&repo_id=442925287&response-content-disposition=attachment%3B%20filename%3Dspchcat_0.0-1_amd64.deb&response-content-type=application%2Foctet-stream [following]\n","--2022-01-03 18:50:48-- https://objects.githubusercontent.com/github-production-release-asset-2e65be/442925287/51c57b3e-b498-41e5-80e7-2edc8de94c07?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAIWNJYAX4CSVEH53A%2F20220103%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20220103T185048Z&X-Amz-Expires=300&X-Amz-Signature=ff064e98c09215948b4ca1958adef26eeffe03aa0a47218e3b5f8c03706ec3c6&X-Amz-SignedHeaders=host&actor_id=0&key_id=0&repo_id=442925287&response-content-disposition=attachment%3B%20filename%3Dspchcat_0.0-1_amd64.deb&response-content-type=application%2Foctet-stream\n","Resolving objects.githubusercontent.com (objects.githubusercontent.com)... 185.199.110.133, 185.199.108.133, 185.199.111.133, ...\n","Connecting to objects.githubusercontent.com (objects.githubusercontent.com)|185.199.110.133|:443... connected.\n","HTTP request sent, awaiting response... 200 OK\n","Length: 1084496196 (1.0G) [application/octet-stream]\n","Saving to: ‘spchcat_0.0-1_amd64.deb’\n","\n","spchcat_0.0-1_amd64 100%[===================>] 1.01G 35.8MB/s in 36s \n","\n","2022-01-03 18:51:25 (28.7 MB/s) - ‘spchcat_0.0-1_amd64.deb’ saved [1084496196/1084496196]\n","\n"]}],"source":["!wget -q https://github.com/petewarden/spchcat/releases/download/v0.0.2-alpha/spchcat_0.0-2_amd64.deb"]},{"cell_type":"markdown","metadata":{"id":"oBDTBC57R8uy"},"source":["## Install the Package\n","\n","On a desktop machine we could just double-click on the package to open and install it, but because we're in a notebook we'll use the `dpkg` tool instead."]},{"cell_type":"code","execution_count":3,"metadata":{"colab":{"base_uri":"https://localhost:8080/"},"executionInfo":{"elapsed":116483,"status":"ok","timestamp":1641236030493,"user":{"displayName":"Pete Warden","photoUrl":"https://lh3.googleusercontent.com/a-/AOh14GiRDB9VwLsxruonSf2xY25P4vvEWzDmpmsfjNLf=s64","userId":"03508279103930495710"},"user_tz":480},"id":"WPIGB-qPRhNA","outputId":"8b1b8226-b8c7-4056-d7cf-17729fcd4856"},"outputs":[{"name":"stdout","output_type":"stream","text":["Selecting previously unselected package spchcat.\n","(Reading database ... 155222 files and directories currently installed.)\n","Preparing to unpack spchcat_0.0-1_amd64.deb ...\n","Unpacking spchcat (0.0-1) ...\n","Setting up spchcat (0.0-1) ...\n"]}],"source":["!dpkg -i spchcat_0.0-1_amd64.deb"]},{"cell_type":"markdown","metadata":{"id":"hQ6FCiUDSLHK"},"source":["## Test `spchcat`\n","\n","The tool needs an audio input to run on, and since this may be running in Colab or another environment without a microphone attached, we'll download some test audio and run it on that."]},{"cell_type":"code","execution_count":null,"metadata":{"id":"yVLUfQp_Seh5"},"outputs":[],"source":["!wget --quiet https://github.com/coqui-ai/STT/releases/download/v1.1.0/audio-1.1.0.tar.gz\n","!tar -xzf audio-1.1.0.tar.gz"]},{"cell_type":"code","execution_count":7,"metadata":{"colab":{"base_uri":"https://localhost:8080/"},"executionInfo":{"elapsed":377,"status":"ok","timestamp":1641236415781,"user":{"displayName":"Pete Warden","photoUrl":"https://lh3.googleusercontent.com/a-/AOh14GiRDB9VwLsxruonSf2xY25P4vvEWzDmpmsfjNLf=s64","userId":"03508279103930495710"},"user_tz":480},"id":"p3hTA19dSJvN","outputId":"ac151cd6-d339-458e-f1a5-0c9c99942824"},"outputs":[{"name":"stdout","output_type":"stream","text":["spchcat: /usr/lib/x86_64-linux-gnu/libstdc++.so.6: version `GLIBCXX_3.4.26' not found (required by spchcat)\n","spchcat: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.34' not found (required by spchcat)\n","spchcat: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.33' not found (required by spchcat)\n"]}],"source":["!spchcat audio/4507-16021-0012.wav"]}],"metadata":{"colab":{"authorship_tag":"ABX9TyOUEFnuIlWvgI2yToO63QAv","name":"Installing spchat","provenance":[]},"kernelspec":{"display_name":"Python 3","name":"python3"},"language_info":{"name":"python"}},"nbformat":4,"nbformat_minor":0} diff --git a/scripts/create_deb_package.sh b/scripts/create_deb_package.sh index fa319bb..360f44e 100755 --- a/scripts/create_deb_package.sh +++ b/scripts/create_deb_package.sh @@ -33,7 +33,7 @@ find ${DEB_MODELS_DIR} -iname "*.scorer" -size +150M -delete # Fetch the binary library release. scripts/download_libs.sh mkdir -p ${DEB_LIB_DIR} -cp -r --verbose ${LIB_DIR}*.so ${DEB_LIB_DIR} +cp -r --verbose ${LIB_DIR}*.so* ${DEB_LIB_DIR} # Copy over the binary executable. mkdir -p ${DEB_BIN_DIR} diff --git a/scripts/generate_release.sh b/scripts/generate_release.sh new file mode 100755 index 0000000..b731073 --- /dev/null +++ b/scripts/generate_release.sh @@ -0,0 +1,11 @@ +#!/bin/bash -xe + +# Needs to happen outside Docker image, so we can reuse GitHub +# authentication. You can move this into the script if needed, +# but you'll have to figure out how to pass the right tokens. +#rm -rf build/models +#scripts/download_models.sh + +# Run the rest of the script inside an Ubuntu 18.04 container, +# so that we get a glibc that's widely compatible. +sudo docker run -it -v`pwd`:/spchcat ubuntu:bionic /spchcat/scripts/generate_release_docker.sh \ No newline at end of file diff --git a/scripts/generate_release_docker.sh b/scripts/generate_release_docker.sh new file mode 100755 index 0000000..88f66f7 --- /dev/null +++ b/scripts/generate_release_docker.sh @@ -0,0 +1,16 @@ +#!/bin/bash + +cd /spchcat/ + +# Install system dependencies. +apt-get -qq update +apt-get -qq install -y sox libsox-dev libpulse-dev make gcc g++ wget curl sudo + +# Fetch the binary libraries distributed by Coqui. +scripts/download_libs.sh + +# Build the tool from source. +make clean && make spchcat LINK_PATH_STT=-Lbuild/lib EXTRA_CFLAGS_STT=-Ibuild/lib + +# Package into a Debian/Ubuntu installer. +scripts/create_deb_package.sh \ No newline at end of file