Return to home page

(encryption key)

Official webpage


Fredrik Sandin,
Luleå tekniska universitet,
971 87 Luleå,

Publications with Bibtex

Profile at Google Scholar

Sound I/O in MATLAB (2010)


ASOUND is a program written in C that samples and plays sound asynchronously from within MATLAB. It uses the cross-platform and open-source PortAudio library for sound I/O and POSIX threads for background processing. With ASOUND you can do real-time sound processing and playback in MATLAB. No toolbox is needed.

It is easy to initialize and use:

	>> % Start sampling of microphone in background
	>> sample('start', sampleRate, bufferLength);
	>> % Receive some samples
	>> [samples, sampleCount, skipCount, bufferCount]
	   = sample('receive', numberOfSamples);
	>> % Stop sampling
	>> sample('stop');	

Three working MATLAB examples are included in the package, e.g., a simple real-time spectrum analyzer:

Example 3

Download and installation

You can download the source code here and the GPL license here. You also need to download and compile the PortAudio library, which should be linked with ASOUND. PortAudio can be downloaded here.

There is presently no makefile available for ASOUND. You need to figure out how to compile (mex) it yourself. Here is a hint for how to do that on OS X:

	gcc -framework CoreAudio -framework AudioToolbox -framework AudioUnit
	    -framework CoreServices -I./ -I/Applications/
	    -DMATLAB_MEX_FILE -fno-common -no-cpp-precomp -arch i386 -undefined dynamic_lookup
	    -bundle -isysroot /Developer/SDKs/MacOSX10.5.sdk -mmacosx-version-min=10.5
	    -fexceptions -DMX_COMPAT_32 -O2 -DNDEBUG -L/Applications/
	    -lmx -lmex -lmat -lstdc++ -lpthread libportaudio.a -o sample.mexmaci sample.c

License and terms of use

This is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

This is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.


Etherpad Latex scripts (github)
Femtolensing calculator
Random indexing
SSH-distributed calculations

Technical reports

TDP derivatives (extends Appendix E/F)
Fault detection in district energy systems
Intelligent Industrial Processes

Bulletin board

Mutex locked... :-)

Mon Sep 14, 2015
Dr. Vasaki Ponnusamy from Quest International University in Malaysia is visiting us for one month with support from STINT.

Mon Aug 31, 2015
Sergio visits EUSIPCO 2015 and presents our paper.

Wed May 27, 2015
Sergio Martin del Campo Barraza presents his licentiate thesis on autonomous sensor systems. Congratulations! Thanks to the opponent, Karl Skretting, for his helpful questions at the seminar.

Mon Apr 27, 2015
Participated at CapoCaccia, great event! Implemented a realtime Matlab / Mex interface (screenshot) for the DAVIS device and learned more about criticality and the ROLLS.

Fri Dec 12, 2014
Gunnar Öquist Fellow ceremony. A memorable day and a great and timely opportunity. More info here.

Thu Nov 13, 2014
Received an encouraging letter from the student union. Thank you for nominating me!

Fri Nov 7, 2014
Presenting our work on interoperability by learning at BICA 2014 in Boston.

Wed Oct 1, 2014
Blerim defends his Ph.D. thesis. Congrats! See also the news article.

Thu Jun 5, 2014
Workshop on bio-inspired computation, organized at UTP, Malaysia. Thanks to STINT, UTP and MMU for support.

Fri Apr 25, 2014
Ph.D. student Sergio Martin del Campo attends MLSS2014 and presents a poster.

News archive.

Valid XHTML 1.0 Transitional