

 ᠭ ଠ⮢ 㪮 䠩 롮ப 
ͼ

 ⮬ 㬥 ᠭ ଠ 䠩 롮ப  IBM PC. 
 ⠢ ⮣ 㬥 祭  ࠧ 筨, ⮬
  ⢥砥  訡   筮 饭  ⠢
 㬥.

  ଠ 䠩 롮ப,  ७ﬨ:

   .SAM, .RAW -  ᠬ 롮ઠ, ,     ⮩ 
              ந.

   .WAV -  ଠ  Microsoft.

   .VOC -   Creative.



 R A W - ଠ 
ͼ

"롮ઠ" -  祭, ஥   室 DAC  砥
 ADC, 筮 楫 ᫮ ( 8  16 ⮢ ). 롮ઠ ࠪਧ
 㪮 ᨣ.  뤠 롮ન ।
 ( HKz ),  롮ப/ᥪ㭤. ஬ ⮣, 롮ઠ 
    (  ),   ( ८ ),  ..., 襬
 .  ᠬ  ந뢠 롮ન, ஬  ᠬ,
室 :

  - ᫮   롮 ( 8/16 ,   32  );
  -  롮ન ( 5Hkz/44Hkz,   48Hkz );
  - ᫮  ( 1/2-/८,   4  ).

᫨ 롮ઠ ८,  ,  ᭠砫   ࢮ ,
⥬ ண.    ࠪਧ 뤠    ᥪ㭤.
 ८   - .

 㪠 ࠬ  - .RAW 䠩, ,  ﭨ 
ࠢ쭮 ந.



 W A V - ଠ 
ͼ

 RIFF 䠩  Microsoft.  ᯮ  Windows. ⮬ 쬠
"७".  宦  AIFF - ଠ Apple,  ᯮ 
࠭ ᮪⢥ 㪠 㬥⮢,  ⠪  ᯮ
 SGI.  宦,   ᮢ⨬.

砫   RIFF 䠩:

typedef struct {
	char id[4]; - 䨪 䠩 = "RIFF" = 0x46464952
	long len;   -  䠩  ⮣ 
} IDRiff;

 WAV-䠩    ᪮쪨 ᪮,   ᪨, 
ᮤঠ  ᪮쪮 롮ப,  -  ଠ. 
 ᥣ,  - ᥣ,    롮ઠ .

 ᪠ WAV:

typedef struct {
	char id[4];  - 䨪 = "WAVE" = 0x45564157
	char fmt[4]; - 䨪 = "fmt " = 0x20746D66
	long len;    -  ⮣ ᪠ WAV - 䠩,
} IDChuckWave;

   ।⢥ ᮪ WAV:

typedef struct {
        int type;   - ⨯ 㪮 , 뢠 - !!!
			1 -  롮ઠ;
			0x101 - IBM mu-law;
                        0x102 - IBM a-law;
                        0x103 - ADPCM.
        int channels; - ᫮  1/2 - !!!
        long SamplesPerSec; -  롮ન - !!!
        long AvgBytesPerSec; -  뤠 ⮢
        int align; - ࠢ
        int bits; - ᫮   롮  - !!!
} IDWave;

祭 - ᮡ 室.  䨪 롮ન:

typedef struct {
	char id[4]; - 䨪 ="data" =0x61746164
        long len;   -  롮ન ( ⭮ 2 )
} IDSampleWave;

롮ப  ᪥   ᪮쪮.

ਬ ணࠬ  ᬮ WAV:

#include <stdio.h>
#include <string.h>

typedef struct {
	char id_riff[4];
        long len_riff;

	char id_chuck[4];
	char fmt[4];
	long len_chuck;

	int  type;
	int  channels;
	long freq;
	long bytes;
	int  align;
	int  bits;

	char id_data[4];
	long len_data;
} TitleWave;


void    main
	( int argc, char * argv[] )
{
FILE * f;
TitleWave tw;

if ( argc<2 ) { printf("  .wav 䠩\n"); return ; }
f=fopen(argv[1],"rb");
if ( f==0 ) { printf("  䠩 - %s\n",argv[1]); return; }
fread(&tw,sizeof(TitleWave),1,f);
fclose(f);
printf("LEN RIFF\t - %ld\n", tw.len_riff );
if ( strncmp(tw.id_riff,"RIFF",4)!=0 )
	printf(" ᮢ 䨪 RIFF\n");
printf("LEN Chuck\t - %ld\n", tw.len_chuck );
if ( strncmp(tw.id_chuck,"WAVE",4)!=0 )
	printf(" ᮢ 䨪 CHUCK\n");
if ( strncmp(tw.fmt,"fmt ",4)!=0 )
	printf(" ᮢ 䨪 FMT\n");
printf("Type\t\t - %d\n", tw.type );
printf("Channels\t - %d\n", tw.channels );
printf("Sample Per Sec\t - %d\n", tw.freq );
printf("Bytes Per Sec\t - %d\n", tw.bytes );
printf("Bits\t\t - %d\n", tw.bits );
printf("Aligned\t\t - %d\n", tw.align );
printf("LEN Data\t - %ld\n", tw.len_data );
if ( strncmp(tw.id_data,"data",4)!=0 )
	printf(" ᮢ 䨪 DATA\n");
}



 V O C - ଠ 
ͼ

 .voc :

typedef struct {
	char txt_id[20]; // "Creative Voice File\x1A"
        unsigned int offset_data; // ᬥ饭 砫 ࢮ  
	unsigned int ver; //  ᨨ
	unsigned int id; // 䨪, ᫮ ୮  ᨨ 
		  //    1234h, .. (((~ver)+0x1234)&0xFFFF)==id
} VocHeader;

⥬   .  ࠧ   ࠧ ⨯. 
 :

 㪮 :

typedef struct {
	unsigned char type; // ⨯ 
	unsigned long len; //   (  㦭 ⮫쪮  3  )
} VocBlock;

   .  ᨬ  ⨯   ࠧ.
 ᪮쪮 ⨯ :

type=0. 蠥  .


type=1.  㪮 :

 ⮬    㦭  , ⮡  
㪮 .

 ⮣ .

typedef struct {
	unsigned char rate; //  ⨧樨,    40H
	unsigned char type_zip; // ᯮᮡ 㯠 0 -  㯠
} VocBlock1;

  㪮 .

type=2.  த 㪮 :

 㪮 .

type=3.  設

typedef struct {
        unsigned int time; // ६ 設
        unsigned char rate; //  ⨧樨,    40H
} VocBlock3;

type=4. -થ

unsigned int marker; // થ

type=5.  ⥪⮢ ᮮ饭

⮢ , 稢騥 㫥.

type=6.  㪮 横

unsigned int count_repeat; // ᫮ ஢  

type=7.   㪮 横

 

type=8.  ७ ன

typedef struct {
        unsigned int rate; //  ⨧樨,    40H
                            // : 65536 - (256000000/rate)
                            // ८: 65536 - (25600000/(2*rate))
        unsigned char pack; // ᯮᮡ 㯠 =0  㯠
        unsigned char mode; //  : 0 - , 1 - ८
} VocBlock8;


ਬ ணࠬ  ᬮ VOC:

#include <stdio.h>
#include <string.h>

typedef struct {
	char txt_id[20]; // "Creative Voice File\x1A"
        unsigned int offset_data; // ᬥ饭 砫 ࢮ  
	unsigned int ver; //  ᨨ
	unsigned int id; // 䨪, ᫮ ୮  ᨨ 
		  //    1234h, .. (((~ver)+0x1234)&0xFFFF)==id
} VocHeader;

typedef struct {
	unsigned char type; // ⨯ 
	unsigned long len; //   (  㦭 ⮫쪮  3  )
} VocBlock;

typedef struct {
	unsigned char rate; //  ⨧樨,    40H
	unsigned char type_zip; // ᯮᮡ 㯠 0 -  㯠
} VocBlock1;

typedef struct {
        unsigned int time; // ६ 設
        unsigned char rate; //  ⨧樨,    40H
} VocBlock3;

unsigned int marker; // થ
unsigned int count_repeat; // ᫮ ஢  

typedef struct {
        unsigned int rate; //  ⨧樨,    40H
                            // : 65536 - (256000000/rate)
                            // ८: 65536 - (25600000/(2*rate))
        unsigned char pack; // ᯮᮡ 㯠 =0  㯠
        unsigned char mode; //  : 0 - , 1 - ८
} VocBlock8;

void    main
	( int argc, char * argv[] )
{
FILE * f;
VocHeader vh;
VocBlock vb;
VocBlock1 vb1;
VocBlock3 vb3;
VocBlock8 vb8;
unsigned int rate;

if ( argc<2 ) { printf("  .voc 䠩\n"); return ; }
f=fopen(argv[1],"rb");
if ( f==0 ) { printf("  䠩 - %s\n",argv[1]); return; }
fread(&vh,sizeof(VocHeader),1,f);
if ( strncmp(vh.txt_id,"Creative Voice File\x1a",19)!=0 )
	{ printf(" \n"); goto Fin; }
printf("Creative Voice File\t - v%u.%02u\n",(vh.ver>>8)&0xFF,vh.ver&0xFF);
printf("砫\t\t\t - %Xh\n",vh.offset_data);
printf("䨪\t\t - %Xh\n",vh.id);
if((((~vh.ver)+0x1234)&0xFFFF)!=vh.id)
	{ printf(" ᮢ\n"); goto Fin; }

fseek( f, vh.offset_data, SEEK_SET );
while ( 1 )
{
	fread(&vb,sizeof(VocBlock)-1,1,f);
	vb.len&=0xffffffL; //   
	if ( ferror(f)!=0 )
		{ printf("訡 ⥭\n"); goto Fin; }
	switch ( vb.type )
	{
	case 0: printf(".\n"); goto Fin;
	case 1: printf(" :");
		fread(&vb1,sizeof(VocBlock1),1,f);
		rate = (unsigned int)(1000000/(256-vb1.rate));
		printf("  - %u, 㯠 - %u, len - %lu\n",
		 rate, vb1.type_zip, vb.len-2 );
		fseek( f, vb.len-2, SEEK_CUR );
		break;
        case 2: printf("த 㪠 : %lu\n", vb.len );
		fseek( f, vb.len, SEEK_CUR );
		break;
        case 3:
                fread(&vb3,sizeof(VocBlock3),1,f);
                printf("設 : ६ - %u,  - %u\n",
                        vb3.time, vb3.rate );
                break;
        case 4:
                fread(&marker,2,1,f);
                printf("થ - %u\n", marker );
                break;
        case 5:
                printf("  - %lu\n",vb.len);
                break;
        case 6:
                fread( &count_repeat,2,1,f );
                printf("७ - %u\n", count_repeat-1);
                break;
        case 7:
                printf(" ७\n");
                break;
        case 8:
                fread(&vb8,sizeof(VocBlock8),1,f);
                rate = (unsigned int)(256000000L/(65536L-vb8.rate));
                printf("ன :  - %u, 㯠 - %u, ० - %s\n",
                        rate, vb8.pack, vb8.mode==0?"":"८" );
                break;
        default:
		printf("T - %d ??????\n", vb.type );
		fseek( f, vb.len, SEEK_CUR );
		break;
	}
}

Fin:
fclose(f);
}



 ਬ砭:
ͼ

    㬥 ⠢ ᨬ .. 10/1995. . -,
   ஢᪮ . . v1.
   묨  ⠢ ⮣ 㬥 㦨 ଠ
    ࠧ 筨. ⮬    ⢥⢥
     ଠ,   ० 孨  ⥫ 
   ᯮ짮 ⮣ 㬥.
 訬 ﬨ,   ⥫ ணࠬ஢ Sound Blaster !
			   Vale !

