Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!swrinde!zaphod.mps.ohio-state.edu!pacific.mps.ohio-state.edu!linac!att!ucbvax!agate!mindseye!izumi From: izumi@mindseye.berkeley.edu (Izumi Ohzawa) Newsgroups: comp.sys.next Subject: Re: converting sound files from sparc -> next Message-ID: <1991Mar24.224638.24597@agate.berkeley.edu> Date: 24 Mar 91 22:46:38 GMT References: <1991Mar24.160634.20050@news.cs.indiana.edu> Sender: usenet@agate.berkeley.edu (USENET Administrator) Organization: Univ. of California, Berkeley Lines: 81 In article <1991Mar24.160634.20050@news.cs.indiana.edu> jashley@greatwhite.cs.indiana.edu (J. Michael Ashley) writes: > >Hi. I'm wondering if there is an easy way to convert sound files from the >format used by Sun Sparcstations to the format used by the NeXT. Someone >posted a few weeks ago that all you had to do was change the file suffix >to .snd, but that didn't work for me. Does anyone have another suggestion? You have to prepend a sound header to the Sparc files. Here's a hack which does that. Izumi Ohzawa, izumi@pinoko.berkeley.edu (NeXTmail) ------ au2snd.c ------- /* Program to convert Sun Sparc sound file (*.au) to NeXT sound file (*.snd) */ /* Izumi Ohzawa, 8-14-90 */ /* cc -O -o au2snd au2snd.c -lsys_s */ #include #include #include main(argc, argv) int argc; char *argv[]; { int filesize, bcnt; char buff[1024]; SNDSoundStruct sh; struct stat filestat; FILE *fpin, *fpout; if(argc != 3) { printf("Usage: au2snd Sparcfile.au NeXTfile.snd\n"); exit(1); } if(stat(argv[1], &filestat)) { printf("Can't get stat for file: %s\n", argv[1]); exit(2); } else filesize = filestat.st_size; fpin = fopen(argv[1], "r"); if(fpin == NULL) { printf("Can't open %s\n", argv[1]); exit(1); } fpout = fopen(argv[2], "w"); if(fpout == NULL) { printf("Can't open %s\n", argv[2]); exit(1); } sh.magic = SND_MAGIC; sh.dataLocation = sizeof(SNDSoundStruct); sh.dataSize = filesize; sh.dataFormat = SND_FORMAT_MULAW_8; sh.samplingRate = SND_RATE_CODEC; sh.channelCount = 1; bzero(sh.info, 4); fwrite((void *)&sh, sizeof(SNDSoundStruct), 1, fpout); while((bcnt = fread((void *)buff, 1, sizeof(buff), fpin)) > 0) fwrite((void *)buff, 1, (size_t)bcnt, fpout); fclose(fpin); fclose(fpout); exit(0); } ------ end of au2snd.c ------ Izumi Ohzawa [ $@Bg_78^=;(J ] USMail: University of California, 360 Minor Hall, Berkeley, CA 94720 Telephone: (415) 642-6440 Fax: (415) 642-3323 Internet: izumi@violet.berkeley.edu NeXTmail: izumi@pinoko.berkeley.edu