Skip to content

Instantly share code, notes, and snippets.

@kala13x
Created November 2, 2024 21:27
Show Gist options
  • Save kala13x/30f769d7b1083d4f4550e3a0c1f627ef to your computer and use it in GitHub Desktop.
Save kala13x/30f769d7b1083d4f4550e3a0c1f627ef to your computer and use it in GitHub Desktop.
DSD (Digital speech decoder) setup script for DNF-based systems
#!/bin/bash
# Digital speech decoder setup script for DNF-based systems
# Sandro Kalatozishvili (c) 2024 (For scientific purposes only)
# socat udp4-listen:7355,reuseaddr,fork - | padsp -- dsd -i - -o /dev/dsp
BASE_PATH=$(pwd -P)/$(dirname "$0")
WORK_PATH="$BASE_PATH/dsd_setup"
WORK_OS=$(uname)
ITPP_SOURCE="http://sourceforge.net/projects/itpp/files/latest/download?source=files"
MBELIB_REPO="https://github.com/szechyjs/mbelib"
DSD_REPO="https://github.com/szechyjs/dsd"
DSD_VER="master"
MBELIB_VER="v1.3.0"
install_deps() {
sudo dnf install -y git gcc gcc-c++ make cmake ccache \
libsndfile1-dev fftw3-dev liblapack-dev portaudio19-dev
}
git_clone() {
cd $WORK_PATH
local DST_DIR=${3:-$(basename $1 .git)}
git clone --recursive $1 $DST_DIR || exit 1
cd $DST_DIR && git checkout $2 || exit 1
git submodule update --init --recursive
cd $WORK_PATH
}
build_itpp() {
cd $WORK_PATH
wget -O itpp.tar.bz2 $ITPP_SOURCE
tar -xjvf itpp.tar.bz2 && rm -f itpp.tar.bz2
cd itpp* && mkdir build && cd build || exit 1
cmake .. && make -j $(nproc)
sudo make install && sudo ldconfig
}
build_project() {
cd "$WORK_PATH/$@" || exit 1
[ -d ./build ] && rm -rf ./build
mkdir build && cd build || exit 1
cmake .. || exit 1
make -j $(nproc) || exit 1
sudo make install && sudo ldconfig
}
[ -d $WORK_PATH ] && rm -rf $WORK_PATH
mkdir -p $WORK_PATH
# Configure PKG_CONFIG path (might be required for some dependency resolving)
export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig:$PKG_CONFIG_PATH
git_clone $DSD_REPO $DSD_VER
git_clone $MBELIB_REPO $MBELIB_VER
install_deps
build_itpp
build_project mbelib
build_project dsd
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment