J. Michael Ashley <jashley@greatwhite.cs.indiana.edu> (03/25/91)
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? Thanks! Mike
izumi@mindseye.berkeley.edu (Izumi Ohzawa) (03/25/91)
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 <stdio.h> #include <sound/sound.h> #include <sys/stat.h> 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
eps@toaster.SFSU.EDU (Eric P. Scott) (03/30/91)
While I'm sure you had fun (and probably learned something) while writing that, it doesn't do anything that the standard NeXT (or Sun) tools don't, and doesn't qualify as an archive submission. For those of you who haven't read the FAQ postings because you thought they only had information for novices: + In SunOS 4.0.3c, audio files consisted simply of "raw" mu-law data. No extension was used. THIS FORMAT IS OBSOLETE. To convert this _on a NeXT_ to NeXT .snd format: (I copied this from a March 1990 comp.sys.next posting) sndconvert -o nextified.snd -f 1 -s 8012.8210513 -c 1 -r sun-sound + In SunOS 4.1 and later, audio files (with the .au extension) are binary-compatible with the NeXT .snd formats, as described on Sun's audio_intro(3) manual page: Audio files contain a header that has a magic number (iden- tifying the file as an audio file) and fields that describe the encoding format used to store the audio data. Immedi- ately following the header is a variable-length information field in which, for instance, ASCII annotation may be stored. The format of the audio file header is compatible with a subset of the NeXT sound file header. Sun has adopted NeXT's sound file header ideas to facilitate the transparent sharing of audio files in a networked environment. [The NeXT Nested and Indirect sound file types are not currently supported.] Sun also provides a program called raw2audio (in man section 6) to convert "raw" sound files to the new Sun/NeXT format. -=EPS=-
cortesi@informix.com (David Cortesi) (04/02/91)
In article <1443@toaster.SFSU.EDU> eps@cs.SFSU.EDU (Eric P. Scott) writes: > >+ In SunOS 4.1 and later, audio files (with the .au extension) are > binary-compatible with the NeXT .snd formats, as described on > Sun's audio_intro(3) manual page: > > The format of the audio file header is compatible with a > subset of the NeXT sound file header. Sun has adopted > NeXT's sound file header ideas to facilitate the transparent > sharing of audio files in a networked environment. [The > NeXT Nested and Indirect sound file types are not currently > supported.] If you are quoting Sun correctly, Sun is lying. The following was executed under NextStep 2.0: [crickhollow 106] mv vulcan_mind.au vulcan_mind.snd [crickhollow 107] sndplay vulcan_mind.snd sndplay : Cannot read soundfile : vulcan_mind.snd In future before you make snide remarks about other people's contributions, you really should test your assertions on the actual software.
eps@toaster.SFSU.EDU (Eric P. Scott) (04/02/91)
In article <1991Apr1.214220.28587@informix.com> cortesi@informix.com (David Cortesi) writes: >If you are quoting Sun correctly, Sun is lying. I quoted verbatim--cut-and-paste from the nroff'ed man page. >[crickhollow 106] mv vulcan_mind.au vulcan_mind.snd >[crickhollow 107] sndplay vulcan_mind.snd >sndplay : Cannot read soundfile : vulcan_mind.snd Do you have read access to the file? (Sorry if I'm asking something obvious, but you'd be amazed at the stupidity behind most of the "it doesn't work the way you said" mail I get.) What does sndinfo report? Where did you get the sound file, and under which version of SunOS does it work under? Why don't you mail me the file instead of just complaining that it doesn't work? I'll be happy to look at it. >you really should test your assertions on the actual software. I tested every one of Sun's demo sounds, and I assure you that they were 100% compatible. -=EPS=-