Skip to main content

Denoiser

RNNoise

Sox

docker \
container \
run \
--rm \
-it \
--volume $PWD/mfa/Librispeech:/libri:ro \
--volume $PWD/denoiser/test:/output \
common-voice_denoiser \
rnnoise \
/libri/19/19-198-0023.wav \
/output/19-198-0023.wav

aws-lambda-cpp

aws iam create-role --role-name lambda-denoiser --assume-role-policy-document file://trust-policy.json
aws iam attach-role-policy --role-name lambda-denoiser --policy-arn arn:aws:iam::aws:policy/service-role/AWSLambdaBasicExecutionRole
aws \
lambda \
create-function \
--function-name denoiser-runtime \
--zip-file fileb://runtime.zip \
--handler function.handler \
--runtime provided \
--role arn:aws:iam::123456789012:role/lambda-role
zip runtime.zip bootstrap
aws lambda publish-layer-version --layer-name bash-runtime --zip-file fileb://runtime.zip
aws lambda update-function-configuration --function-name denoiser-runtime --layers arn:aws:lambda:ca-central-1:194183794986:layer:bash-runtime:1
zip function.zip function.sh sox
aws lambda update-function-code --function-name denoiser-runtime --zip-file fileb://function.zip

From the Docker image, extract

mkdir tools
cd tools
docker container cp denoise:/usr/local/lib .
docker container cp denoise:/usr/local/bin/.libs/rnnoise_demo .
docker container cp sox:/usr/sox-14.4.2/bin/sox .
mv rnnoise_demo rnnoise
zip -r ../tools.zip .
aws lambda publish-layer-version --layer-name bash-denoise-tools --zip-file fileb://tools.zip

Sox

mkdir tools
cd tools
mkdir lib bin
cd lib
docker container cp sox:/opt/lib/libsox.la .
docker container cp sox:/opt/lib/libsox.a .
docker container cp sox:/usr/lib64/libgsm.so.1.0.12 libgsm.so.1
cd ..
cd bin
docker container cp sox:/opt/bin/sox .
zip -r ../tools.zip .
aws lambda publish-layer-version --layer-name sox --zip-file fileb://tools.zip