From: Alessandro on
Dear Jan,

I'd have a more basic question, if you or anyone could help. I have a script that creates sine tones determining freq, duration, ramp, mode and sampling frequency.

however, i would like to control for the intensity of the created/saved sound, and I do not know how to do it: 1) shall i specify this as a further parameter?; 2) what kind of contorl over intesity does Matlab allow?; 3) is the sound intensity level determined instead by which sound card one has, and if so, which way?

Thanks in advance for the answer, as I am fully naive to Matlab. But not for long I hope!

Aless

"Jan Simon" <matlab.THIS_YEAR(a)nMINUSsimon.de> wrote in message <hgjoe7$a70$1(a)fred.mathworks.com>...
> Dear Sanjay!
>
> > I have about 100 wav files of ~500ms in length. All of them have different volume levels. How do I find the average volume of all the files and make the average volume of a particular sample equal to the overall average?
>
> Open the files with WAVREAD. You get the data as matrix. Calculate the volume level depending on the definition, e.g. MAX of ABS values, root mean square, MEAN of ABS, ... Then calculate the mean of all these levels. Finally open all files again, modify the replied matrices (this depends on the definition of "volume level" again) and write them with WAVWRITE.
>
> I think, a lot of the readers did not answer this, because this answer obviously equals your question (except for the ~500ms)!
>
> So perhaps you should be more specific and write, what you have done so far.
>
> Kind regards, Jan
From: Jan Simon on
Dear Alessandro!

> however, i would like to control for the intensity of the created/saved sound, and I do not know how to do it: 1) shall i specify this as a further parameter?; 2) what kind of contorl over intesity does Matlab allow?; 3) is the sound intensity level determined instead by which sound card one has, and if so, which way?

The intensity of the saved WAV files is controlled by mutliplying the data matrix with a scalar, e.g. M*0.5 has the half volume - if you define volume by the maximal peak value.

If you store the sound in MP3 files, there is a specific property to determine the volume.

Yair's Java function controls the amplifier of the sound card, but this does not concern saved WAV files, of course:
http://www.mathworks.com/matlabcentral/fileexchange/25584

Good luck, Jan