Modifying the example "Read from Microphone and Write to Audio File". Help!
Hi everyone!
I'm trying to modify the example "Read from Microphone and Write to Audio File" (https://kr.mathworks.com/help/audio/ref/audiodevicereader-system-object.html#mw_016e7620-9db6-4214-b22e-683336f53aba)
Firstly, I succeeded to identify what my devices are with :
deviceReader = audioDeviceReader; devices_reader = getAudioDevices(deviceReader)
deviceWriter = audioDeviceWriter; devices_writer = getAudioDevices(audioDeviceWriter)
playRec = audioPlayerRecorder; devices_player = getAudioDevices(playRec)
and then,
devices_reader =
1×3 cell array
{'Default'} {'주 사운드 캡처 드라이버'} {'Analog in 01-12(AudioFire 12)'}
devices_writer =
1×5 cell array
{'Default'} {'주 사운드 드라이버'} {'Analog out 01-08…'} {'Analog out 09-12…'} {'스피커(Realtek Hi…'}
devices_player =
1×2 cell array
{'Default'} {'ASIO Echo FireWire'}
I connected my smartphone which are playing music with an AUX cable to Analog input #2.
And I expect 'myRecording.wav' should have 5 seconds part of the music playing by my phone.
But I don't know which value is the corresponding one.
So I modified the example "Read from Microphone and Write to Audio File" with 3 cases like below :
% deviceReader = audioDeviceReader; % case 1 % deviceReader = audioDeviceReader('Device','Analog in 01-12(AudioFire 12)');% case 2 % deviceReader = audioDeviceReader('Driver','ASIO'); % case 3 setup(deviceReader); info(deviceReader);
fileWriter = dsp.AudioFileWriter('myRecording.wav'); disp('Recording...') tic; while toc < 5 acquiredAudio = deviceReader(); fileWriter(acquiredAudio); end disp('Recording complete.') release(deviceReader); release(fileWriter);
but I can't hear anything with the result 'myRecording.wav' in all 3 cases! I attach the returned messages by
info(deviceReader);
case 1.
ans =
struct with fields:
Driver: 'DirectSound' DeviceName: '주 사운드 캡처 드라이버' MaximumInputChannels: 2
>> Ex6_Read_from_Mic_and_wirte_Audio_file Recording... Recording complete.
case 2.
ans =
struct with fields:
Driver: 'DirectSound' DeviceName: 'Analog in 01-12(AudioFire 12)' MaximumInputChannels: 12
case 3.
ans =
struct with fields:
Driver: 'ASIO' DeviceName: 'ASIO Echo FireWire' MaximumInputChannels: 12
what should I change ?
0 Comments
Accepted Answer
More Answers (1)
See Also
Categories
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!