Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

New to MATLAB?

How can a Multi Channel Audio be played by an Audio Device with ASIO using MATLAB

Asked by Lillian Wang

Lillian Wang (view profile)

on 14 Nov 2013
Latest activity Edited by Lillian Wang

Lillian Wang (view profile)

on 14 Nov 2013

The Multi Channel Audio is written in a matrics, with 4 column representing 4 audio channels.

The Audio Device has more than 4 channels.

In Matlab, both dsp.AudioPlayer and To Audio Device Block in Simulink can be used, but only two channels are activated.

How can all 4 channel audio files be played in MATLAB?

The codes by using dsp.AudioPlayer are as follows:

clear;clc;

H = dsp.AudioPlayer;%creating the To Audio Device

H.DeviceName='扬声器 (RME Hammerfall DSP MADI)';% this is the multi channel audio device.

H.SampleRate=44100;

H.DeviceDataType='32-bit float';

H.BufferSizeSource='Auto';

H.QueueDuration=2;

H.ChannelMappingSource='Property';

H.ChannelMapping=1:4;

load test4Channel.mat %this is the audio matrix with sampling rate 44100, time length 45s, 4 columns.

for i=1:45;

step(H,Data((i-1)*44100+1:i*44100,:));%try to play 4 channel audio, but only 2 channels worked.

end

Many Thanks!!

0 Comments

Lillian Wang

Lillian Wang (view profile)

Products

No products are associated with this question.

0 Answers

Contact us