Audio Recording on Matlab Issue

Hi,
I am trying to record myself saying "hello" and "good evening" on my laptop but when I plot the signals, I am obtaining disrupted square signals instead of one consistent signal. Is there something wrong with my code?
clear all;
close all;
recording = audiorecorder;
disp('Initiate Recording')
recordblocking( recording, 2.0 );
disp('End')
play(recording)
recordingD = getaudiodata(recording);
recording = audiorecorder;
disp('Initiate Second Recording')
recordblocking( recording, 2.0 );
disp('End')
play(recording)
recordingD_1 = getaudiodata(recording);
N = length(recordingD)
N_1 = length(recordingD_1)
fs = 8000;
figure(1)
t = (0:N-1) / fs;
plot(t, recordingD)
title("Hello Recording")
figure(2)
plot(t, recordingD_1)
title("Good Evening Recording")
Hello.jpg
good evening.jpg

回答 (1 件)

Thiago Henrique Gomes Lobato
Thiago Henrique Gomes Lobato 2019 年 11 月 10 日

0 投票

Your code is fine, those square signals are just because the low amount of bits in the default audiorecorder which is very low (8). Just start your record object as follows and you will see a better result
recording = audiorecorder(8000,16,1); %(Fs,nBits,NumChannels)

カテゴリ

ヘルプ センター および File ExchangeLarge Files and Big Data についてさらに検索

質問済み:

2019 年 11 月 10 日

Community Treasure Hunt

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

Start Hunting!

Translated by