plotを使用して音声ファイルの波形を表示した際、音源によって1色のグラフと2色のグラフが描かれるのですが、それぞれ何が違うのか、また1色のグラフに直すにはどうしたらよいのか教えていただきたいです。
19 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
[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 commentaires
Réponse acceptée
Atsushi Ueno
le 23 Juil 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')
Plus de réponses (1)
Voir également
Catégories
En savoir plus sur Measurements and Spatial Audio dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!