How can i play audio from a bluetooth speaker and record the audio using my laptops microphone ?

7 ビュー (過去 30 日間)
I’ve used the MATLAB code from the webpage “Play and record simultaneously”, i’m having issues with the channel for recording from my laptop, the audio plays fine from my loudspeaker using ASIO Driver.
  2 件のコメント
Geoff Hayes
Geoff Hayes 2020 年 8 月 10 日
Victor - please attach the link to the page “Play and record simultaneously” and/or show the code that you are using to record the audio. By the way, how are you playing the audio - from your laptop or another device?
Victor Dunira
Victor Dunira 2020 年 8 月 10 日
編集済み: Geoff Hayes 2020 年 8 月 11 日
clear all
close all
clc;
% Create a signal to play and record
fs =44100; % sampling frequency
fs2 =44100; % sampling frequency
time = 10; % signal duration
N = time * fs; % number of samples
x = randn(1,N); % Gaussian white noise
filename = 'Whitenoise.wav';
audiowrite(filename,x,fs2); %%writes audio and saves as wav file
% [x,fs] = audioread('Whitenoise.wav');
% sound(x,fs);
fileReader = dsp.AudioFileReader('Whitenoise.wav', ...
'SamplesPerFrame',2048); %%Reads the audio samples
fileWriter = dsp.AudioFileWriter('WhitenoisePlaybackRecorded.wav', ...
'SampleRate',fs2); %%Writes audio samples to audio file
aPR = audioPlayerRecorder('SampleRate',fs2);
while ~isDone(fileReader) %% while reads the audio samples
audioToPlay = fileReader();
[audioRecorded,nUnderruns,nOverruns] = aPR(audioToPlay);
fileWriter(audioRecorded)
if nUnderruns > 0
fprintf('Audio player queue was underrun by %d samples.\n',nUnderruns);
end
if nOverruns > 0
fprintf('Audio recorder queue was overrun by %d samples.\n',nOverruns);
end
end
[D2,fs2] = audioread('WhitenoisePlaybackRecorded.wav');
h = ifft(fft(D2)./fft(x'));
figure;
plot(abs(h));
Code was taken from MATLAB :
I downloaded ASIO driver from online in order for this code to work, as the code only works for a Full-Duplex device. The audio is being played and recorded through my laptop.

サインインしてコメントする。

回答 (1 件)

Urmila Rajpurohith
Urmila Rajpurohith 2020 年 10 月 22 日

カテゴリ

Help Center および File ExchangeAudio I/O and Waveform Generation についてさらに検索

タグ

製品

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by