[comp.sys.ibm.pc] Can a Soundblaster use Sun .au format files?

cwebster@rodan.acs.syr.edu (Chris Webster) (06/24/91)

   The subject line says it all-- I'm wondering if it's possible to
   use Sun .au format file sounds on a soundblaster.  If it is, where
   can I get the necessary software?


-- 
_______________________________________________________________________________
-Chris Webster                       |  Internet:cwebster@rodan.acs.syr.edu
Dept of Civil & Enviro. Engineering  |  Bitnet:cwebster@rodan
 L.C. Smith College of Engineering   |  C-86 Net:"Chris Webster"@UCC

mnrausch@immd4.informatik.uni-erlangen.de (Martin Rausche) (06/24/91)

cwebster@rodan.acs.syr.edu (Chris Webster) writes:


>   The subject line says it all-- I'm wondering if it's possible to
>   use Sun .au format file sounds on a soundblaster.  If it is, where
>   can I get the necessary software?

That's not very difficult. You have to convert the .au files to .snd files
with the appended program. Then use the program VOC-HDR.EXE from your
SB distribution disk to add the right header to the .snd file. Now you
get a .voc file, which can be played by VOUT.EXE (also on your SB disk).

Here is the program to convert .au files to .snd files (I hope that helps):

Date:  Tue, 28 May 91 09:30:11 PDT
From: bill%solaria@hac2arpa.hac.com (Bill Neisius)
Subject: Program to Convert Sun uLAW

OK, here it is.... Converts Sun uLAW files (8khz sample rate) to
8 bit sound samples (.SND).
        
Bill Neisius
bill@solaria.hac.com
        
        
        
---------------------------------- Cut Here --------------------------------
/************************************************************************/
/* sun2snd.c - Convert uLAW format into sampled audio files             */
/************************************************************************/
        
#include <stdio.h>
        
/* convert uLAW format character into sound sample character  */
int cvt(ch)
int ch;
{
        int range, value, sign;
        
        range = (ch & 0xF0) | 0x80;
        value = ch & 0x0F;
        sign  = ch & 0x80;
        
        if (range == 0xF0)
                ch = (15 - value) * 2;
        else if (range == 0xE0)
                ch = (15 - value) * 4 + 32;
        else if (range == 0xD0)
                ch = (15 - value) * 8 + 96;
        else if (range == 0xC0)
                ch = (15 - value) * 16 + 224;
        else if (range == 0xB0)
                ch = (15 - value) * 32 + 480;
        else if (range == 0xA0)
                ch = (15 - value) * 64 + 992;
        else if (range == 0x90)
                ch = (15 - value) * 128 + 2016;
        else if (range == 0x80)
                ch = (15 - value) * 256 + 4064;
        else
                ch = 0;
        
        if (sign)
        	return (0x80 + (ch / 16));
        else
        	return (0x80 - (ch / 16));
        
}
        
main(argc, argv)
int argc;
char *argv[];
{
        FILE *infile, *outfile;
        int ch;
        
        if (argc != 3) 
                {
                fprintf(stderr,"Usage: sun2snd infile outfile\n");
                exit(1);
                }
        
        if ((infile = fopen(argv[argc-2], "rb")) == NULL) 
                {
                perror("Error opening infile");
                exit(0);
                }
        
        if ((outfile = fopen(argv[argc-1], "wb")) == NULL) 
                {
                perror("Error opening outfile");
                exit(0);
                }
        
        ch = fgetc(infile);
        
        while (!feof(infile)) 
                {
                fputc(cvt(ch), outfile);
        
                ch = fgetc(infile);
                }
        
        fclose(infile);
        fclose(outfile);
        
}


>-- 
>_______________________________________________________________________________
>-Chris Webster                       |  Internet:cwebster@rodan.acs.syr.edu
>Dept of Civil & Enviro. Engineering  |  Bitnet:cwebster@rodan
> L.C. Smith College of Engineering   |  C-86 Net:"Chris Webster"@UCC

---
------------------------------------------------------------------------------
| Martin Rausche                                                              |
| EMail: mnrausch@immd4.informatik.uni-erlangen.de                            |
| Trust me, I know what I'm doing -- Sledge Hammer                            |
------------------------------------------------------------------------------