How to control the volume of speaker using MATLAB?

29 ビュー (過去 30 日間)
goutham gumm
goutham gumm 2018 年 4 月 18 日
コメント済み: goutham gumm 2018 年 4 月 19 日
I am working on a project related to audio signal processing and want to map the rms value of a signal to control the volume of a speaker. The louder the signal, the more the rms value and hence the output of the speaker should be loud and vice versa. So, I would like to know if there is a way to do this?

採用された回答

Walter Roberson
Walter Roberson 2018 年 4 月 19 日

Typical method:

  1. set speakers to maximum volume
  2. multiply signal in range -1 to +1 by fraction of maximum volume that is desired.
  1 件のコメント
goutham gumm
goutham gumm 2018 年 4 月 19 日
cool..it works..you're a savior :)

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

その他の回答 (1 件)

Jan
Jan 2018 年 4 月 18 日

If you want to control the volume of the speakers use FEX: Control speaker volume.

 The louder the signal, the more the rms value and hence the output of the speaker
 should be loud

If the signal is loud, the output is loud already without the need to control anything. Maybe you meant the opposite: For a loud signal reduce the volume level?

Another idea is to scale the signal to get the wanted RMS value.

  1 件のコメント
goutham gumm
goutham gumm 2018 年 4 月 19 日
Okay,let me make it clear. What I want to do is just to be able to play a WAV file at a volume which is under my control. I'm actually simulating a musical instrument where I use a piezoelectric sensor to generate electrical signals and based on the force applied, it generates stronger signals.I want to take the rms value of this signal and play a WAV file stored in my computer at a volume corresponding to the rms value.

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

カテゴリ

Help Center および File ExchangeSimulation, Tuning, and Visualization についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by