Audio Signal Processing in MATLAB Youssef Abdelilah Senior Product Manager

Similar documents
Experiment 3. Getting Start with Simulink

2015 The MathWorks, Inc. 1

Introduction to System Objects and System Toolboxes Tabrez Khan Application Engineer

Optimization and Implementation of Embedded Signal Processing Algorithms Jonas Rutström Senior Application Engineer

2015 The MathWorks, Inc. 1

Signal Processing and Computer Vision Using MATLAB and Simulink

Embarquez votre Intelligence Artificielle (IA) sur CPU, GPU et FPGA

Model-Based Design for effective HW/SW Co-Design Alexander Schreiber Senior Application Engineer MathWorks, Germany

Designing and Prototyping Digital Systems on SoC FPGA The MathWorks, Inc. 1

Accelerating System Simulations

Moving MATLAB Algorithms into Complete Designs with Fixed-Point Simulation and Code Generation

Introduction to C and HDL Code Generation from MATLAB

Hardware-Software Co-Design and Prototyping on SoC FPGAs Puneet Kumar Prateek Sikka Application Engineering Team

Introducing Audio Signal Processing & Audio Coding. Dr Michael Mason Senior Manager, CE Technology Dolby Australia Pty Ltd

Design and Verify Embedded Signal Processing Systems Using MATLAB and Simulink

Audio-coding standards

Rapid Development Platform for C-Programmable DSP using MATLAB and Simulink

M-570 USB 4-CH Wireless. Sound Box

UM1641 User manual. Sampling rate conversion SRC236 library software expansion for STM32Cube. Introduction

Audio-coding standards

Integrated Workflow to Implement Embedded Software and FPGA Designs on the Xilinx Zynq Platform Puneet Kumar Senior Team Lead - SPC

Modeling HDL components for FPGAs in control applications

Parallel and Distributed Computing with MATLAB The MathWorks, Inc. 1

Extending Model-Based Design for HW/SW Design and Verification in MPSoCs Jim Tung MathWorks Fellow

Design and Verify Embedded Signal Processing Systems Using MATLAB and Simulink

Implementing MATLAB Algorithms in FPGAs and ASICs By Alexander Schreiber Senior Application Engineer MathWorks

Model-Based Design for Video/Image Processing Applications

Modeling a 4G LTE System in MATLAB

Motor Control: Model-Based Design from Concept to Implementation on heterogeneous SoC FPGAs Alexander Schreiber, MathWorks

Hardware and Software Co-Design for Motor Control Applications

Introducing Audio Signal Processing & Audio Coding. Dr Michael Mason Snr Staff Eng., Team Lead (Applied Research) Dolby Australia Pty Ltd

Optimizing and Accelerating Your MATLAB Code

Accelerating Simulink Optimization, Code Generation & Test Automation Through Parallelization

Principles of Audio Coding

Designing and Targeting Video Processing Subsystems for Hardware

컴퓨터비전의최신기술 : Deep Learning, 3D Vision and Embedded Vision

Intro to System Generator. Objectives. After completing this module, you will be able to:

MATLAB/Simulink 기반의프로그래머블 SoC 설계및검증

118th AES Convention Barcelona, Spain - May 28-31, 2005

Lyrebird APP User Manual

Sharing and Deploying MATLAB Programs Sundar Umamaheshwaran Amit Doshi Application Engineer-Technical Computing

High-Level and Model-Based Design Targeting FPGAs and SoCs

ECE4703 B Term Laboratory Assignment 2 Floating Point Filters Using the TMS320C6713 DSK Project Code and Report Due at 3 pm 9-Nov-2017

2015 The MathWorks, Inc. 1

professional measurements by

Parallel and Distributed Computing with MATLAB Gerardo Hernández Manager, Application Engineer

Hardware and Software Co-Design for Motor Control Applications

Accelerating FPGA/ASIC Design and Verification

Super UA Q&A 2015/03/16

Design and Verification of FPGA and ASIC Applications Graham Reith MathWorks

USER GUIDE FOR PREDICTION ERROR METHOD OF ADAPTIVE FEEDBACK CANCELLER ON ios PLATFORM FOR HEARING AID APPLICATIONS

What's New in MATLAB for Engineering Data Analytics?

Sound Blaster X-Fi TM Titanium HD Testing Methodology & Results For RMAA v6.2.3

Accelerate FPGA Prototyping with

[Sub Track 1-3] FPGA/ASIC 을타겟으로한알고리즘의효율적인생성방법및신기능소개

Objectives. Simulink Basics

Digital Media. Daniel Fuller ITEC 2110

VT XLR-to-USB Pre Test Report using Multi-Instrument

How Real-Time Testing Improves the Design of a PMSM Controller

Mit MATLAB auf der Überholspur Methoden zur Beschleunigung von MATLAB Anwendungen

Digital Audio Systems Desktop Sampling Systems

2015 The MathWorks, Inc. 1

Making the Most of your MATLAB Models to Improve Verification

User s Guide: How to Use Two External Microphones in Smartphone Apps for Hearing Improvement Studies

Speeding up MATLAB Applications Sean de Wolski Application Engineer

Model-Based Design Using Simulink, HDL Coder, and DSP Builder for Intel FPGAs By Kiran Kintali, Yongfeng Gu, and Eric Cigan

개발과정에서의 MATLAB 과 C 의연동 ( 영상처리분야 )

Modelling and Simulation Made Easy with Simulink Tiffany Liang Application Engineer MathWorks

Computer Aided Design (CAD) Lecture 10. Introduction to Simulink (3) Dr.Eng. Basem ElHalawany

Design and Verification of FPGA Applications

CENTER STAGE QUICKSTART GUIDE ENGLISH ( 2 4 ) MANUAL DE INICIO RÁPIDO ESPAÑOL ( 5 7 ) GUIDE D'UTILISATION SIMPLIFIÉ FRANÇAIS ( 8 10 )

Integration of Active Noise Control in future IVI system designs

Control System Design and Rapid Prototyping Using Simulink Chirag Patel Sr. Application Engineer Modeling and Simulink MathWorks India

Simulation, prototyping and verification of standards-based wireless communications

Avnet Speedway Design Workshop

EE482: Digital Signal Processing Applications

Quick-Start Guide...3. Operation...5. Volume Control...4. Sound Quality...4. Dial tones and speaker mute note...5. Connection...5. Dial...

Turning an Automated System into an Autonomous system using Model-Based Design Autonomous Tech Conference 2018

Prototyping and Deployment of Real- Time Signal Processing Algorithms for Engine Control and Diagnosis

ECE 5655/4655 Laboratory Problems

Model-Based Design for Altera FPGAs Using HDL Code Generation The MathWorks, Inc. 1

ENHANCEMENT IMPLEMENTATION ON

LMS Pimento The Multichannel Analyzer with Portable Power

Ein Modell - viele Zielsysteme

Streamware Workbench Quickstart Release

Audio Studio Guide Version: 3.5 Author: Ton Valkenburgh Date: January 8,

What s New for MATLAB David Willingham

Hardware and Software Co-Design for Motor Control Applications

VIBbox 64-Channel Sound & Vibration Solution

Rapid Prototyping System for Teaching Real-Time Digital Signal Processing

Chapter 14 MPEG Audio Compression

VIBBOX. 32, 48, or 64-Channel Sound & Vibration Solution Expansion to 256 Channels. Key Feature of Each VIBbox: Table 1. Key Features of VIBbox Models

Chapter 7. Hardware Implementation Tools

Hardware Implementation and Verification by Model-Based Design Workflow - Communication Models to FPGA-based Radio

Better than Hand Generating Highly Optimized Code using Simulink and Embedded Coder

SONAR LE Quick Start Guide

Preferred Computer Settings for a PC using Windows 7 or 8 with JRiver Media Engine 20.xx

DESIGN AND DEVELOPMENT OF A MULTIRATE FILTERS IN SOFTWARE DEFINED RADIO ENVIRONMENT

White Paper. The advantages of using a combination of DSP s and FPGA s. Version: 1.0. Author: Louis N. Bélanger. Date: May, 2004.

Advanced AC Motor Control S/W Development Sang-Ho Yoon Senior Application Engineer The MathWorks

Transcription:

Audio Signal Processing in MATLAB Youssef Abdelilah Senior Product Manager 2014 The MathWorks, Inc. 1

Agenda Tunable parametric equalizer example Audio tone removal example 1 2 3 How to create a streaming test bench for audio processing in MATLAB How to develop algorithms and incorporate them into the test bench How to accelerate simulation for real-time performance 2

Stream processing of audio is everywhere! Tablet/MP3 Player & Smart Phone Gaming System Automotive Infotainment Professional Audio & Music Medical Devices-Hearing Aids 3

Tunable parameter equalizer example MIDI Control Tune parameters in real-time See it Tune it Audio Input Array Plot Guitar10min.ogg a 44.1Khz stereo audio Play it Parameter Equalizer Filters Custom Audio Algorithm Audio Output Visualize audio waveforms in real-time Create it Speaker Hear it 4

Challenges in audio system design Framework for real-time simulations I have to process large data and test my simulations with streaming signals. I need a simulation testbench that can keep up with real-time data. Quick Innovation & modeling I need to find innovative algorithms and create and model a working system very quickly. Rapid prototyping & simulation acceleration I need to optimize my high-level MATLAB algorithm for speed. I then need to verify that the optimized code works the same way as the original MATLAB code. 5

What DSP System Toolbox offers in MATLAB Framework for real-time simulations Stream processing techniques and hardware peripheral access that speed up simulation and reduce memory footprint I have to process large data and test my simulations with streaming signals. I need a simulation testbench that can keep up with real-time data. Quick Innovation & modeling Pre-defined algorithms as functions and System objects for I need to find innovative algorithms and create and model a working system very quickly. prototyping Rapid prototyping & simulation acceleration Support for C/C++ code generation that enables design continuity and faster simulation I need to optimize my high-level MATLAB algorithm for speed. I then need to verify that the optimized code works the same way as the original MATLAB code. 6

Part 1: Test bench and peripheral access 1 2 3 How to create a streaming test bench for audio processing in MATLAB How to develop algorithms and incorporate them into the test bench How to accelerate simulation for real-time performance 7

Stream processing in MATLAB Streaming techniques* process continuous data from a captured signal or large file by dividing it into frames and fully processes each frame before the next one arrives Memory efficient Streaming algorithms in DSP System Toolbox provide Implicit data buffering, state management and indexing Simulation speed-up by reducing overhead MATLAB Memory Stream Source Stream Processing *http://www.mathworks.com/discovery/stream-processing.html 8

How to create a streaming test bench Sources Sinks Spectrum Analyzer Microphone Audio Input Algorithm under test Spectrum Analyzer Audio Output Visualize sound in real-time Speaker 9

How to create test bench in MATLAB %% Create and Initialize SamplesPerFrame = 1024; Fs = 44100; Initialize Microphone=dsp.AudioRecorder('SamplesPerFrame',SamplesPerFrame); Spectra=dsp.SpectrumAnalyzer ('SampleRate',Fs); %% Stream processing loop tic; while toc < 20 % Read frame from microphone audioin = step(microphone); Process in-the-loop End % View audio spectrum step(spectra,audioin); %% Terminate release(microphone) release(spectra) Terminate 10

How to automatically create test benches from Generate DSP Testbench App >>HelperGenDSPTestbenchUI 11

Part 2: Algorithms 1 2 3 How to create a streaming test bench for audio processing in MATLAB How to develop algorithms and incorporate them into the test bench How to accelerate simulation for real-time performance 12

Example 1: Audio Tone Removal MIDI Control Tune parameter equalizer in real-time Tune it View it Guitar file @ 44.1Khz stereo audio Play it + X Notch-Peak Filter Y Y Spectrum Analyzer Hear it Audio Input 250Hz Tone Custom Audio Algorithm Y Speaker Audio Output Visualize audio waveform spectra in real-time Noise Create it 13

How to incorporate algorithm into test bench %% Create & Initialize Fs = 44.1e3; SamplesPerFrame = 1024; h = dsp.audiofilereader('guitar10min.ogg'); hp = dsp.audioplayer; % Interfering tone ftone = 250; hw = dsp.sinewave('amplitude',0.8,'samplerate',fs, Frequency',[ftone ftone],'samplesperframe',samplesperframe); hs = dsp.spectrumanalyzer('samplerate',fs,'spectralaverages',5,'showlegend',true, Title',titlestr); initialize %% Stream processing loop while ~isdone(h) % Read one frame from audio file and add a tone to input audio x = step(h) + step(hw); end %% Terminate release(h) release(hs) release(hp) % Audio Tone Removal algorithm [y,pausesim,stopsim]helperaudiotoneremovalprocessing(x,args,param); % View audio waveform step(hs,[x(:,1),y(:,1),y(:,3)]); % Start playing audio step(hp, y(:,1:2)); Process in-the-loop Terminate 14

Example 2: Tunable audio parametric equalizer Tune parameter equalizer in real-time Tune it MIDI Control See it X H=Y/X H Play it Guitar file @ 44.1Khz stereo audio X Parameter Equalizer Filters Y Y Transfer Function Estimator Y Array Plot Hear it Audio Input Custom Audio Algorithm Create it Speaker Audio Output Visualize audio waveform in real-time 15

DSP System Toolbox audio related components (supported on Apple/Windows/Linux) Multichannel audio I/O (Number of channels depends on hardware) Audio Player/Recorder (Supports multiple devices, one sound driver per MATLAB session) Audio File Reader/Writer ASIO low latency driver support on Windows (R) Custom channel mapping Audio signal analysis Scopes: time, spectrum analyzer, Array plot Transfer function estimator Measurements: SNR, THD, Average power, PeaktoRMS ratio, mean, variance,... Signal processing algorithms FIR, Biquad, Multirate FIR, FFT, LMS,... Connectivity UDP, MIDI (simultaneous support for multiple controls on multiple devices) 16

Part 3: Acceleration of simulation 1 2 3 How to create a streaming test bench for audio processing in MATLAB How to develop algorithms and incorporate them into the test bench How to accelerate simulation for real-time performance 17

Stream processing in real-time Data acquisition & algorithm times Frame 1 Frame 2 Frame 3 Frame n As long as Data acquisition Algorithm processing time Data acquisition + Algorithm processing <= Frame time We have Real-time signal processing 18

Stream processing in real-time Data acquisition & algorithm times Frame 1 Frame 2 Frame 3 Frame n As long as Data acquisition Algorithm processing time Data acquisition + Algorithm processing <= Frame time We have Real-time signal processing 19

Accelerating algorithm execution* Optimize MATLAB Code Pre-allocation and vectorization User s Code System Objects Pre-defined efficient implementations of algorithms MATLAB to C Generate MEX files automatically with MATLAB Coder Parallel Computing Parallel computations on multicore computers, GPUs, and clusters *Webinar: Accelerating Simulation for Communications Applications https://www.mathworks.com/company/events/webinars/wbnr78473.html 20

MATLAB to C code generation* MATLAB Coder function y = audio_algorithm_peqso(u,tunedparams) % Copyright 2014 The MathWorks, Inc. persistent PE1 PE2 if isempty(pe1) PE1 = parametriceqfilter('bandwidth',2000, 'CenterFrequency',3000,'PeakGaindB',6.02); PE2 = ParametricEQFilter('Bandwidth',2000, 'CenterFrequency',1000,'PeakGaindB',-6.02); end [PE1,PE2] = processtunedparams(tunedparams,pe1,pe2); v = step(pe1,u); y = step(pe2,v); %------------------------------------- function [PE1,PE2] = processtunedparams(tunedparams,pe1,pe2) if ~isnan(tunedparams.centerfrequency) PE1.CenterFrequency = tunedparams.centerfrequency; end if ~isnan(tunedparams.bandwidth) PE1.Bandwidth = tunedparams.bandwidth; end if ~isnan(tunedparams.gain) PE1.PeakGaindB = tunedparams.gain; end if ~isnan(tunedparams.centerfrequency2) PE2.CenterFrequency = tunedparams.centerfrequency2; end if ~isnan(tunedparams.bandwidth2) PE2.Bandwidth = tunedparams.bandwidth2; end if ~isnan(tunedparams.gain2) PE2.PeakGaindB = tunedparams.gain2; end (*) Design and Prototype Real-Time DSP Systems with MATLAB (Conference Presentation): http://www.mathworks.com/company/events/conferences/matlab-virtual-conference/2013/proceedings/design-and-prototype-real-time-dsp-systems-with-matlab.html 21

Simulation acceleration benchmarks 2-band parametric equalizer algorithm Processing time MATLAB code MEX code 23.37 seconds 2.84 seconds 22

DSP System Toolbox * Over 300 algorithms for modeling, designing, implementing and deploying dynamic system applications Advanced Filter Design, Adaptive, Multistage and Multi-rate Filters Visualization in Time and Frequency-domain FFT, DCT & other Transforms Signal processing blocks for Simulink Support for Fixed-Point, C/C++ code generation and HDL Algorithm libraries in MATLAB System objects and functions in MATLAB Stream signal Processing ARM Cortex-M support for hardware prototype Algorithm libraries in Simulink *http://www.mathworks.com/ products/dsp-system/index.html 23

Summary Create a test bench for audio algorithms with various sources/sinks AudioRecorder, AudioPlayer, AudioFileReader, Sine wave, white noise, Spectrum analyzer, time scope, transfer function estimator, Use DSP System Toolbox components (System objects) for algorithms FIR, FIR Decimation/Interpolation/Rate Conversion, Biquad, Allpass, Allpole, FFT, DCT, Auto/Cross Correlation, Mean, variance, RMS, PeaktoRMS, Perform real-time audio signal processing Accelerate critical components by code-generation (Generating MEX files using MATLAB Coder) 24

THANK YOU! 2014The MathWorks, Inc. MATLAB and Simulink are registered trademarks of The MathWorks, Inc. See ww.mathworks.com/trademarks for a list of additional trademarks. Other product or brand names may be trademarks or registered trademarks of their respective holders. 25