Tutorial 0 - Audio programming with gtkIOStream

Moderator: flatmax

Post Reply
flatmax
Posts: 602
Joined: Sat Jul 23, 2016 11:39 pm

Tutorial 0 - Audio programming with gtkIOStream

Post by flatmax » Fri Jul 21, 2017 11:59 pm

This tutorial is the first in a series of audio programming tutorials using gtkIOStream. gktIOStream is a C++ development package which allows simple interfacing to audio subsystems in Linux. The two main systems it uses is jackd and ALSA.

The contents of tutorials is available here. In this tutorial we will install gtkIOStream and test that it is setup correctly.

Firstly, we will install the requirements:

Code: Select all

sudo apt-get install libsox-dev libeigen3-dev libfftw3-dev libasound2-dev libjack-jackd2-dev
If you want sox and GTK GUI development the also install them :

Code: Select all

sudo apt install libsox-dev libeigen3-dev libfftw3-dev libasound2-dev libjack-jackd2-dev sox libgtk2.0-dev
libsox-dev is regarded as the swiss army knife of audio. It allows you to manipulate convert audio formats and do many other things, kind of similar to avconv (ffmpeg) but specifically for audio. It handles all audio in 32 bit samples.
eigen is a set of headers which allow array/vector/matrix math processing. They are setup to take advantage of CPU hardware acceleration and they also do fantastically complex math with very simple commands.
fftw3 is regarded as the fastest fft (fast Fourier Transform) library. It can convert time domain data to the frequency domain.
libasound2 is the Linux official sound system, which is built into the kernel. libasound2 is the library which allows you to interface ALSA in a fantastically low level manner.
libjack-jackd2 is great for low latency audio routing - it even lets you route audio over the web!

We also need the necessary development tools :

Code: Select all

sudo apt-get install git g++ autoconf libtool
Next we will install gtkIOStream. We need to clone its git repository :

Code: Select all

git clone https://github.com/flatmax/gtkiostream.git
Great - now lets compile gtkIOStream. To do that we have to change to its directory, reconfigure autotools, configure the make system and make it, then make install it ! ... don't worry, here is how to do that :

Code: Select all

cd gtkiostream
./tools/autotools.sh 
If you have problems at this point, one or other development tool is not installed. Drop a note below and we will fix that.

Now we are ready to configure the make system using autotools :

Code: Select all

./configure --disable-octave
Here we have called configure and told gtkiostream that we don't want to compile in the octave functionality. Octave is a fantastic numerical processing system which is mostly backwards compatible with Matlab.

Now if configure succeeded, then you are ready to compile :

Code: Select all

make -j2
Here we have told the GNU make system to compile gtkIOStream using 2 (-j2) threads.

At this point, after quite some time (on my Pi, around 30 minutes) gtkIOStream should have compiled.

Finally we install it :
sudo make install

We can test the installation by going to our home directory and running a command :

Code: Select all

cd
WSOLA -h
You should see the following output :

Code: Select all

pi@raspberrypi:~ $ WSOLA -h
Usage: WSOLA -h or --help
Usage: WSOLA fileName.wav rate
	 the fileName can be any readable audio file format.
	 the rate can be any number within a reasonable range where 0 < rate < 5 or some reasonable speed.

 Outputs to the file fileName.wav.rate.wav
Checkout the next kickstarter campaign - the Ultra 2 : https://kck.st/2xwM3DL
Please review the Zero sound card on Amazon USA : https://www.amazon.com/dp/B075V1VNDD
---
Check out our new forum on github : https://github.com/Audio-Injector

Franshej
Posts: 8
Joined: Mon Jan 22, 2018 4:13 am

Re: Tutorial 0 - Audio programming with gtkIOStream

Post by Franshej » Tue Jan 23, 2018 12:22 am

Hi!

When i run the ./tools/autotools.sh i've got the error message:

configure.ac 29: installing './missing'
applications/Makefile.am installing './depcomp'
applications/Makefile.am 82: warning: variable 'JackFullDuplex_SOURCES' is defined but no program or
applications/Makefile.am 82: library has 'JackFullDuplex' as canonical name (possible typo)
applications/Makefile.am 84: warning: variable 'JackFullDuplex_LDADD' is defined but no program or
applications/Makefile.am 84: library has 'JackFullDuplex' as canonical name (possible typo)
test/Makefile.am 172: warning: '%'-style pattern rules are a GNU make extension
test/Makefile.am 136: warning: 'INCLUDES' is the old name for 'AM_CPPFLAGS' (or '*_CPPFLAGS')
test/Makefile.am 299: warning: variable 'DeBoorTest_SOURCES' is defined but no program or
test/Makefile.am 299: library has 'DeBoorTest' as canonical name (possible typo)
test/Makefile.am 224: warning: variable 'DecompositionTest_SOURCES' is defined but no program or
test/Makefile.am 224: library has 'DecompositionTest' as canonical name (possible typo)
test/Makefile.am 155: warning: variable 'JackOverRailTest_SOURCES' is defined but no program or
test/Makefile.am 155: library has 'JackOverRailTest' as canonical name (possible typo)
test/Makefile.am 39: warning: variable 'PlotTest3_SOURCES' is defined but no program or
test/Makefile.am 39: library has 'PlotTest3' as canonical name (possible typo)
test/Makefile.am 302: warning: variable 'DeBoorTest_LDADD' is defined but no program or
test/Makefile.am 302: library has 'DeBoorTest' as canonical name (possible typo)
test/Makefile.am 226: warning: variable 'DecompositionTest_LDADD' is defined but no program or
test/Makefile.am 226: library has 'DecompositionTest' as canonical name (possible typo)
test/Makefile.am 157: warning: variable 'JackOverRailTest_LDADD' is defined but no program or
test/Makefile.am 157: library has 'JackOverRailTest' as canonical name (possible typo)

Peter DU
Posts: 2
Joined: Thu Jan 25, 2018 12:28 pm

Re: Tutorial 0 - Audio programming with gtkIOStream

Post by Peter DU » Thu Jan 25, 2018 12:49 pm

HI Matt,

Thank you for the information. I am now trying to use the octo sound card for sound recording and processing in real time. I saw your tutorial and start trying to follow it. However, I got some error at the first stage.

1. The github repo seems moved to another repo.

2. make -j2:

g++ -DHAVE_CONFIG_H -I. -I.. -I../include -g -O2 -MT I2SEndianTest-I2SEndianTest.o -MD -MP -MF .deps/I2SEndianTest-I2SEndianTest.Tpo -c -o I2SEndianTest-I2SEndianTest.o `test -f 'I2SEndianTest.C' || echo './'`I2SEndianTest.C
In file included from ../include/IIO/IIODevice.H:21:0,
from ../include/IIO/IIO.H:21,
from ../include/IIO/IIOMMap.H:20,
from IIOSox.C:23:
../include/DirectoryScanner.H: In static member function ‘static int DirectoryScanner::mkDir(const string&, mode_t)’:
../include/DirectoryScanner.H:187:31: error: ‘system’ was not declared in this scope
int ret=system(cmd.c_str());
^
In file included from ../include/IIO/IIOMMap.H:20:0,
from IIOSox.C:23:
../include/IIO/IIO.H: At global scope:
../include/IIO/IIO.H:23:32: warning: unknown option after ‘#pragma GCC diagnostic’ kind [-Wpragmas]
#pragma GCC diagnostic ignored "-Wignored-attributes"
^
In file included from IIOSox.C:27:0:
../include/Sox.H:27:32: warning: unknown option after ‘#pragma GCC diagnostic’ kind [-Wpragmas]
#pragma GCC diagnostic ignored "-Wignored-attributes"
^
Makefile:669: recipe for target 'IIOSox-IIOSox.o' failed
make[2]: *** [IIOSox-IIOSox.o] Error 1
make[2]: *** Waiting for unfinished jobs....
mv -f .deps/I2SEndianTest-I2SEndianTest.Tpo .deps/I2SEndianTest-I2SEndianTest.Po
make[2]: Leaving directory '/home/pi/gtkiostream/applications'
Makefile:502: recipe for target 'all-recursive' failed
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory '/home/pi/gtkiostream'
Makefile:408: recipe for target 'all' failed
make: *** [all] Error 2

Could you give me some hints about how to solve it? Thank you.

Best,

Peter

flatmax
Posts: 602
Joined: Sat Jul 23, 2016 11:39 pm

Re: Tutorial 0 - Audio programming with gtkIOStream

Post by flatmax » Thu Mar 29, 2018 8:36 pm

Franshej wrote:
Tue Jan 23, 2018 12:22 am
Hi!

When i run the ./tools/autotools.sh i've got the error message:

configure.ac 29: installing './missing'
applications/Makefile.am installing './depcomp'
applications/Makefile.am 82: warning: variable 'JackFullDuplex_SOURCES' is defined but no program or
applications/Makefile.am 82: library has 'JackFullDuplex' as canonical name (possible typo)
applications/Makefile.am 84: warning: variable 'JackFullDuplex_LDADD' is defined but no program or
applications/Makefile.am 84: library has 'JackFullDuplex' as canonical name (possible typo)
test/Makefile.am 172: warning: '%'-style pattern rules are a GNU make extension
test/Makefile.am 136: warning: 'INCLUDES' is the old name for 'AM_CPPFLAGS' (or '*_CPPFLAGS')
test/Makefile.am 299: warning: variable 'DeBoorTest_SOURCES' is defined but no program or
test/Makefile.am 299: library has 'DeBoorTest' as canonical name (possible typo)
test/Makefile.am 224: warning: variable 'DecompositionTest_SOURCES' is defined but no program or
test/Makefile.am 224: library has 'DecompositionTest' as canonical name (possible typo)
test/Makefile.am 155: warning: variable 'JackOverRailTest_SOURCES' is defined but no program or
test/Makefile.am 155: library has 'JackOverRailTest' as canonical name (possible typo)
test/Makefile.am 39: warning: variable 'PlotTest3_SOURCES' is defined but no program or
test/Makefile.am 39: library has 'PlotTest3' as canonical name (possible typo)
test/Makefile.am 302: warning: variable 'DeBoorTest_LDADD' is defined but no program or
test/Makefile.am 302: library has 'DeBoorTest' as canonical name (possible typo)
test/Makefile.am 226: warning: variable 'DecompositionTest_LDADD' is defined but no program or
test/Makefile.am 226: library has 'DecompositionTest' as canonical name (possible typo)
test/Makefile.am 157: warning: variable 'JackOverRailTest_LDADD' is defined but no program or
test/Makefile.am 157: library has 'JackOverRailTest' as canonical name (possible typo)
These are warnings - latest version from github has far less warnings !
Looks like it is ok.

Matt
Checkout the next kickstarter campaign - the Ultra 2 : https://kck.st/2xwM3DL
Please review the Zero sound card on Amazon USA : https://www.amazon.com/dp/B075V1VNDD
---
Check out our new forum on github : https://github.com/Audio-Injector

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest