Error in 'untitled/Audio Device Writer': A given audio device may only be opened once.
조회 수: 62 (최근 30일)
why do i get this error >>> Error in 'untitled/Audio Device Writer': A given audio device may only be opened once<<< while rinning my simlunk block that play a sound?
note that i run it before with no problems. however, now i got this error although i didn't put any changes!!!
Gabriele Bunkheila 2018년 11월 29일
You may have multiple block instances pointing to the same device in your model, another Simulink model running, or you may similarly have run or created instances of audioDeviceWriter in your MATLAB session. Checking other models open, other blocks in your model, or clearing (or even releasing) existing competing object instances in MATLAB should solve this.
추가 답변 (1개)
Gabriele Bunkheila 2018년 12월 3일
편집: Gabriele Bunkheila 님. 2018년 12월 3일
Please refer to the code in the example "Audio Stream from Device to Device" under " Quick Start Examples" in the page Real-Time Audio in MATLAB. In particular, the few lines of code below should do what you need:
% In the two lines of code below, provide any additional property value necessary to point the object to your sound card(s)
deviceReader = audioDeviceReader;
deviceWriter = audioDeviceWriter('SampleRate',deviceReader.SampleRate);
disp('Begin Signal Input...')
while toc < 5
mySignal = deviceReader();
% Process mySignal as needed
disp('End Signal Input')