Sound File: creating left and right channels

14 ビュー (過去 30 日間)
Cyrus
Cyrus 2013 年 4 月 16 日
I am new to matlab and was wondering if this is the correct way to specific left and right channels for a simple sound file I created and am trying to play (or if there is a better/simpler way):
x = [0:.1:1000*pi];
u = [0:.1:500*pi];
v = [501*pi:.1:1000*pi];
sinseg1 = sin(u);
sinseg2 = sin(v);
sinseg1_stereo = [sinseg1 * .2, sinseg1 * .8];
sinseg2_stereo = [sinseg2 * .8, sinseg2 * .2];
sound(sinseg1,1000);
sound(sinseg2,1000);

回答 (2 件)

Walter Roberson
Walter Roberson 2013 年 4 月 16 日
編集済み: Walter Roberson 2013 年 4 月 16 日
dual_channel = [sinseg1_stereo(:), sinseg2_stereo(:)];
sound(dual_channel, 1000);
But I have to ask you what your intention was for
[sinseg1 * .2, sinseg1 * .8]
If I were to guess, I suspect what you wanted was
sinseg1_stereo = sinseg1 .* 0.2 + sinseg2 .* 0.8;
  1 件のコメント
Walter Roberson
Walter Roberson 2013 年 4 月 16 日
Okay, I will take another guess then:
sinseg1_stereo = [sinseg1(:) * .2, sinseg1(:) * .8];
sinseg2_stereo = [sinseg2(:) * .8, sinseg2(:) * .2];
sound(sinseg1_stereo,1000);
sound(sinseg2_stereo,1000);

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


Cyrus
Cyrus 2013 年 4 月 16 日
編集済み: Walter Roberson 2013 年 4 月 16 日
This is based on a tutorial I watched ( http://www.youtube.com/watch?v=ie7iREcYBPU, 18th minute approx.). I think sinseg1_stereo = sinseg1 .* 0.2 sinseg .* 0.8; is closer but I don't think addition is needed should I use a comma?

カテゴリ

Help Center および File ExchangeAudio and Video Data についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by