From: eye@lesti.hut.fi (Petri M Kuittinen)
Subject: Re: Sound Chip:  What are the volume levels?
Organization: Helsinki University of Technology, Finland
Date: 23 Jul 92 12:22:40

   According to the Abacus Internals book, the volume levels on the Yamaha sound
   chip in the ST uses "logarithmically raised" volume levels.

   I'd like to know exactly what the volume levels are, in order to calculate a
   better "magic table" for my sampled sound player.  I've looked at the tables
   used in some programs, and they don't seem too accurate according to some of
   the calculations I've done - but I don't know how they came up with them.

I have also noticed the same problem, I looked through many sample tables I
got. After several weeks, I finally came up with a solution, which
seems right (please don't flame me if I am wrong!). The accurate volume levels
seem to be:

Sound chip Volume	Real Volume (down from max.)

15			-0 dB
14			-3 dB
13			-6 dB
12			-9 dB
11			-12 dB
10			-15 dB
9			-18 dB
8			-21 dB
7			-24 dB
6			-27 dB
5			-30 dB
4			-33 dB
3			-36 dB
2			-39 dB
1			-42 dB
0			-45 dB

So a change of 1 in sound chip volume value will change the real volume by
3 desibels. And desibels of course are calculated like this:

		dB=10*lg(I/10^-12 W/m^2)

where lg is 10-based logarithm and I is intensity of sound.

With one sound channel you can achieve maximum of 45dB dynamics, but sound
quality will be poor. With combined 3 channels you will get max. 49.8 dB
dynamics (10*lg(3*10^4.5=49.7712...). Most sample players use all the sound
channels to get more accurate simulation of the 256 8bit-sample values. I
don't know how the freq. values (in sound chip register 0-5) affect the volume,
but I guess with the use of them one could achieve even better dynamics.
(Normally sample players on ST, set the frequency-registers to zero and set
all sound channel off -> mixer register).

   If someone can find out what the "logarithmically raised volume levels" are,
   I can post the be-all-and-end-all set of "magic tables", so we can all
   benefit.

Yes, post the table! It would be nice if you would also calculate a table for
1 sound channel samples (eg. many ST-musicians use only one channel to produce
digi-drum sounds).

   I tried a guess of sqrt(2)^V, and it seems pretty good - maybe even better
   than the tables I was using before.

   With the program I've written, I can produce "magic tables" of varying
   characteristics - eg. one to play softer-recorded sounds at increased
   volume without first doing an information-losing scale-up.  The Sun Sparc
   "ulaw" format could be trivially supported by this program too - it should
   give quite EXCELLENT reproduction of those sampled sounds - probably even
   better than is possible with the STe/TT DMA sound hardware.

   All I need is the coefficient of the "logarithmically raised" volume levels.

When you calculate the "magic" table, try to get the the most silent sample
values correct, human ear becomes more inaccurate with louder values and it's
not so important to get them correct.


			The <(O)> Eye
--
| The Eye of Brainwash Company	|	LEA	POINT(PC),A3	;Don't try  |
| E-mail:eye@niksula.hut.fi	| 	ADD.L 	#$465707B7,(A3)	;this M68000|
| S-mail:Timpurinkuja 1 C 39	| 	LEA	$8000,A4	;assembler  |
|	 02600 Espoo, Finland	|POINT:	ORI.W	#$5945,D5	;program!!  |
Newsgroups: comp.sys.atari.st.tech