ftp.nice.ch/peanuts/GeneralData/Usenet/news/1991/CSN-91.tar.gz#/comp-sys-next/1991/Mar/converting-sound-files-from-sparc-next

This is converting-sound-files-from-sparc-next in view mode; [Up]


Date: Sun 24-Mar-1991 21:06:26 From: jashley@greatwhite.cs.indiana.edu (J. Michael Ashley) Subject: converting sound files from sparc -> next 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
Date: Sun 24-Mar-1991 22:46:38 From: izumi@mindseye.berkeley.edu (Izumi Ohzawa) Subject: Re: converting sound files from sparc -> next 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 ]
Date: Sun 30-Mar-1991 05:30:28 From: eps@toaster.SFSU.EDU (Eric P. Scott) Subject: Re: converting sound files from sparc -> next 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=-
Date: Sun 01-Apr-1991 21:42:20 From: cortesi@informix.com (David Cortesi) Subject: Re: converting sound files from sparc -> next 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.
Date: Sun 02-Apr-1991 03:19:24 From: eps@toaster.SFSU.EDU (Eric P. Scott) Subject: Re: converting sound files from sparc -> next 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=-

These are the contents of the former NiCE NeXT User Group NeXTSTEP/OpenStep software archive, currently hosted by Marcel Waldvogel and Netfuture.ch.