How to control the volume of speaker using MATLAB?

21 visualizaciones (últimos 30 días)
goutham gumm
goutham gumm el 18 de Abr. de 2018
Comentada: goutham gumm el 19 de Abr. de 2018
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?

Respuesta aceptada

Walter Roberson
Walter Roberson el 19 de Abr. de 2018

Typical method:

  1. set speakers to maximum volume
  2. multiply signal in range -1 to +1 by fraction of maximum volume that is desired.

Más respuestas (1)

Jan
Jan el 18 de Abr. de 2018

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 comentario
goutham gumm
goutham gumm el 19 de Abr. de 2018
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.

Iniciar sesión para comentar.

Categorías

Más información sobre Simulation, Tuning, and Visualization en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by