How to control the volume of speaker using MATLAB?

조회 수: 24 (최근 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개)

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