How to control the volume of speaker using MATLAB?

21 次查看(过去 30 天)
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 个)

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 CenterFile Exchange 中查找有关 Simulation, Tuning, and Visualization 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by