Audio and Speech Application Development

Web Dev

There are serveral frameworks that are in my suggestion lists, such as:

BeaqleJS

BeaqleJS: HTML5 and JavaScript based
Framework for the Subjective Evaluation of
Audio Quality: https://github.com/HSU-ANT/beaqlejs

wavesurfer.js

https://wavesurfer-js.org/

Audio Swiss Knife – Sox

Install SOX

We can download the SOX by wget

1
wget https://sourceforge.net/projects/sox/files/sox/14.4.2/sox-14.4.2.tar.gz/

After we unizip the file, we can just run by:

1
2
3
4
5
6
7
8
9
# unzip the file
tar -xzvf sox-14.4.2.tar.gz

# we can get a sox-14.4.2 and get into that folder
cd sox-14.4.2
# we need to compile the downloaded files
./config
make
make install

Or we can just use this cmd in Ubuntu Linux :

1
sudo apt install sox

SOX Commands

Check the audio info

1
soxi ...wav

image-20220821052902080

Cheatsheet here: https://gist.github.com/ideoforms/d64143e2bad16b18de6e97b91de494fd

Change the audio type

We will use the example like from raw file into the wav file.

image-20220901155527822

Or just convert the wav file into FLAC:

1
sox input.wav output.flac

Remix

We can use remix to convert the audio left and right channel.

1
2
3
4
5
sox input.wav output.wav remix 2 1
# 2 means the 2th channel, or right channel
# 1 means the 1th channel, or left channel
# now we exchange the left and right channel

Re-sample

We can just downsample an audio to 8KHz to simulate:

1
sox input.wav -r 8000 output.wav

Help

We can recall the help function by simply type:

1
2
man sox
sox -help

FFmpeg

If there had some audio formats that did not supported on the sox, like mp4.

We can just use the FFmpeg, we need to download it by sudo apt install ffmpeg on ubuntu linux.

Convert the mp4 file to wav

1
ffmpeg -i input.mp4 output.wav

Play the PCM audio file

1
ffplay -f s16le -sample_rate 44100 -channels 2 -i xxx.pcm

Flac

Visualization

Install the latex

1
2
sudo apt install texlive-latex-extra
sudo apt install texlive-fonts-recommended texlive-fonts-extra dvipng texlive-latex-extra cm-super

pydub

1
2
pip install pydub
sudo apt install ffmpeg

Audio and Speech Application Development
http://xiaos.site/2022/03/30/Audio-and-Speech-Application-Development/
Author
Xiao Zhang
Posted on
March 30, 2022
Licensed under