Subject: RE: [stella] sample of Atari sounds From: "Andy Mucho" <m00@xxxxxxxxxxxxxxxxxxx> Date: Mon, 23 May 2005 11:49:01 -0400 |
If you rename the output file .pcm or .raw you should be able to load it into any regular sound package, but failing that the wav header is just 44 bytes in it's most minimal form.. Here's a little snipper you could use.. Just remember to fill in the Data Chunks size after you finish writing the data out otherwise most packages won't load bugger all.. So kind of roughly.. CreateOutputFile.. Write WaveHeader.. FinishWavHeader.. typedef struct { char FMT_string[4]; int chunk_size; short format_tag; short channels; int sample_rate; int average_data_rate; short alignment; short bits_per_sample; short extra; short samples_per_block; }FMT; void OpenWAVHeader(FILE* stream,int channels,int samplerate,int bitspersample) { static char* riff="RIFF"; static char* wave="WAVE"; static char* fmt="fmt "; static char* data="data"; int tmp=0; FMT formatchunk; memcpy(&formatchunk.FMT_string,fmt,4); formatchunk.chunk_size=sizeof(FMT)-8; formatchunk.format_tag=1; formatchunk.channels=channels; formatchunk.sample_rate=samplerate; formatchunk.average_data_rate=(samplerate*bitspersample*channels)/8; formatchunk.alignment=(channels*bitspersample)/8; formatchunk.bits_per_sample=bitspersample; formatchunk.extra=2; formatchunk.samples_per_block=(channels*bitspersample)/8; fwrite(riff,4,1,stream); fwrite(&tmp,4,1,stream); fwrite(wave,4,1,stream); fwrite(&formatchunk,sizeof(FMT),1,stream); fwrite(data,4,1,stream); ChunkDataPosition=ftell(stream); fwrite(&tmp,4,1,stream); } void CloseWAVHeader(FILE* stream) { int size=ftell(stream)-(ChunkDataPosition+4); fseek(stream,ChunkDataPosition,SEEK_SET); fwrite(&size,4,1,stream); fseek(stream,0,SEEK_END); } > -----Original Message----- > From: Kirk Israel [mailto:kirkjerk@xxxxxxxxx] > Sent: 23 May 2005 16:29 > To: stella@xxxxxxxxxxxxxxxxxx > Subject: Re: [stella] sample of Atari sounds > > Sorry, no, I meant the comments imply the output just needs a > header to be a proper wav file, how to get THAT header. > > It's actually been a while since I've compiled C on > Windows...I guess gcc is the easiest/cheapest/most standard > these days? > > On 5/23/05, Fabrizio Zavagli <fabrizio.zavagli@xxxxxxxxx> wrote: > > Kirk, > > > > On 5/23/05, Kirk Israel <kirkjerk@xxxxxxxxx> wrote: > > > So that's a C-based TIA sound simulator? > > > > > > Any suggestions on how to get the needed header? > > > > If it's stdio.h you're referring to, it should come with > your standard > > C compiler installation! > > > > Regards, > > Fabrizio.- > > Archives (includes files) at > > http://www.biglist.com/lists/stella/archives/ > > Unsub & more at http://stella.biglist.com > > > > > Archives (includes files) at > http://www.biglist.com/lists/stella/archives/ > Unsub & more at http://stella.biglist.com > > > Archives (includes files) at http://www.biglist.com/lists/stella/archives/ Unsub & more at http://stella.biglist.com
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [stella] sample of Atari sounds, Fabrizio Zavagli | Thread | Re: [stella] sample of Atari sounds, Adam Wozniak |
Re: [stella] sample of Atari sounds, Kirk Israel | Date | Re: [stella] sample of Atari sounds, Fabrizio Zavagli |
Month |