You are on page 1of 20

Prototyping DSP algorithms

on real-world signals using


MATLAB

www.dsponlineconference.com Gabriele Bunkheila


The Speaker
Gabriele Bunkheila Product Manager, DSP and Audio

Gabriele is a senior product manager at


MathWorks, where he coordinates the strategy of
MATLAB toolboxes for audio and DSP. After
joining MathWorks in 2008, he worked as a
signal processing application engineer for
several years, supporting MATLAB and Simulink
users across industries from algorithm design to
real-time implementations. Before MathWorks,
he held a number of research and development
positions related to signal processing. He has a
ast ’s d g phys s a d a h
communications engineering.

2
From algorithm to prototype – How?

3
Things have changed since

▪ Importance of prototypes has grown

▪ Technologies and tools have evolved

▪ More researchers and engineers can afford to create demos

▪ Still time-consuming and labor-intensive for many

8
Intro Demo

9
10
Agenda – Real-Time DSP Prototyping + MATLAB

▪ Streaming signals from and to hardware interfaces

▪ Writing your own code

▪ Selecting the correct existing functions

▪ Beyond MATLAB – VST audio plugins,


standalone .exe, Raspberry Pi, and more

11
Anatomy of basic real-time audio streaming

▪ Simple while or for loop


(N samples per frame)

▪ Enabled by:
– Audio I/O wrappers designed for streaming
(optimized code with object interface)

– Efficient DSP code executed in the loop

12
Beyond audio and sound cards
Software Defined Radio (SDR) TX/RX

13
Agenda – Real-Time DSP Prototyping + MATLAB

▪ Streaming signals from and to hardware interfaces

▪ Writing your own code

▪ Selecting the correct existing functions

▪ Beyond MATLAB – VST audio plugins,


standalone .exe, Raspberry Pi, and more

14
Packaging audio DSP algorithms for real-time

Objects provide solutions


▪ Accessible parameters exposed as properties
▪ Parameter-led computations only triggered
when parameters changed or initialized
▪ Pre-computed internal values and states
are remembered
▪ Extra-lean runtime code
▪ Consistent signature for in and out

15
Agenda – Real-Time DSP Prototyping + MATLAB

▪ Streaming signals from and to hardware interfaces

▪ Writing your own code

▪ Selecting the correct existing functions

▪ Beyond MATLAB – VST audio plugins,


standalone .exe, Raspberry Pi, and more

16
What can make a function or object more efficient than others?

▪ Separation between one-time and run-time computations


(e.g. using a recommended object structure)

▪ Better implementation algorithm for the task in hand


(e.g. time vs. frequency domain)

▪ Efficient implementation under the Hood


e.g. using a mix of:
– Hand-optimized C++
– High-performance threaded technologies (e.g. SIMD, IPP, TBB)
– High-performance libraries (e.g. BLAS, FFTW)
– ...
17
Agenda – Real-Time DSP Prototyping + MATLAB

▪ Streaming signals from and to hardware interfaces

▪ Writing your own code

▪ Selecting the correct existing functions

▪ Beyond MATLAB – VST audio plugins,


standalone .exe, Raspberry Pi, and more

18
Real-Time Prototyping Beyond MATLAB

C/C++ 19
Generating VST and AU audio plugins from MATLAB code

>> generateAudioPlugin HighPass


20
AES Student Competition: MATLAB Plugin

▪ What is it?
– A competition co-organized by MathWorks
and the Audio Engineering Society
– Showcase and awards at the
Conventions of the AES
– Prizes of up to $1500 (in 2020)

▪ How to enter
– Write MATLAB code that generates a VST audio plugin
and put in on MATLAB Central
– Create a short video that describes your project and upload it to YouTube

21
Deploying DSP algorithm or whole program?

while(1)
% Read from HW
x = inReader();

% Your DSP algorithm


C/C++ y = myDSPalgo(x);

% Write to HW
outWriter(y);
end

22
Conclusions

▪ Real-time prototyping has become much


easier than you may expect

▪ Choosing the right programming techniques


and resources can make a big difference

24
THANK YOU

w w w . d s p o n l i n e c o n f e r e n c e . c o m

You might also like