plotを使用して音声ファイルの波形を表示した際、音源によって1色のグラフと2色のグラフが描かれるのですが、それぞれ何が違うのか、また1色のグラフに直すにはどうしたらよいのか教えていただきたいです。
22 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Tsuduri
am 23 Jul. 2022
Kommentiert: Tsuduri
am 24 Jul. 2022
[y,Fs] = audioread(['filename'])
info = audioinfo('filename')
t = 0:seconds(1/Fs):seconds(info.Duration)
t = t(1:end-1)
plot(t,y)
xlabel('Time')
ylabel('Audio Signal')
0 Kommentare
Akzeptierte Antwort
Atsushi Ueno
am 23 Jul. 2022
> それぞれ何が違うのか ⇒ おそらく、モノラル(1ch) / ステレオ(2ch)の違いです
> 1色のグラフに直すにはどうしたらよいのか ⇒ グラフの描画色を変更すれば良いです
2色のグラフが描かれるステレオ(2ch)の場合を下記に再現しました。
x1 = sin(0:0.01:8*pi)'; % 1chのサンプルデータ(正弦波) 注:音声として聞き取れません
x2 = cos(0:0.01:8*pi)'; % 2chのサンプルデータ(余弦波) 注:音声として聞き取れません
audiowrite('sample.wav', [x1 x2], 8192); % サンプル音声ファイルの作成
[y,Fs] = audioread('sample.wav');
y' % ステレオ音声なので音声データyが2列ある
info = audioinfo('sample.wav');
t = 0:seconds(1/Fs):seconds(info.Duration);
t = t(1:end-1);
plot(t,y,'b'); % ライン色を一律青に設定
xlabel('Time')
ylabel('Audio Signal')
Weitere Antworten (1)
Siehe auch
Kategorien
Mehr zu Measurements and Spatial Audio finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!