What is the _REAL_ SunSparc1 sound-format?!?

Leif Andrew Rump andrew at ambra.dk
Tue Jun 12 21:54:56 AEST 1990


The reason I ask is that none of the documentation that I have access to
conform to the actual content of the files I found in
/usr/demo/SOUND/sounds neither that in /usr/demo/SOUND/man or SunOS 4.1
manuals!

The sample.au under 4.0.3 contained only data (about debug!) but under 4.1
a header which looks something like this

	unsigned	'.snd'		; magic number
	unsigned	offset		; header length
	unsigned	length		; data lengtgh
	unsigned	channels	; or encoding (1)
	unsigned	samples		; per second
	unsigned	encoding	; or channels (1)
	4 * char	title		; zterminated padded with 0's
	char		data		; sound

The title isn't mentioned anywhere in any of the documents and parts like
bytes per unit is missing completely!

BTW: Could somebody please explain to me - down to earth (I think that is
a Danish expression said in English!) - what signed/unsigned is (on a
SunSparc)! Or at least tell me why I have to write my programs like below:

#include <stdio.h>

main()
{
  char	tmp;

  while ((tmp = getchar()) != EOF)
    printf("%c", (tmp < 0) ? tmp : 128 - tmp);
}

I don't understand the: (tmp < 0) ? 128 - tmp : tmp; part. If I don't do
it my sound get mangled and looks very funny in the sound-tool
application. The lines below is from a program that generates sinus:

    tmp = (128 + volume * sin((Hz * 2 * PI * nr) / SAMPLE / 10));
    buffer[nr] = (tmp < 0) ? 128 - tmp : tmp;

Leif Andrew Rump, AmbraSoft AS, Stroedamvej 50, DK-2100 Copenhagen OE, Denmark
UUCP: andrew at ambra.dk, phone: +45 39 27 11 77                /
Currently at Scandinavian Airline Systems                =======/
UUCP: andrew at resam.dk, phone: +45 32 32 22 79                \
SAS, RESAM Project Office, CPHML-V, P.O.BOX 150, DK-2770 Kastrup, Denmark



More information about the Comp.sys.sun mailing list