2007년 4월 3일 화요일

Wave File Format

Table of Contents

Overview

The Wave file format is Windows' native file format for storing digital audio data. It has become one of the most widely supported digital audio file formats on the PC due to the popularity of Windows and the huge number of programs written for the platform. Almost every modern program that can open and/or save digital audio supports this file format, making it both extremely useful and a virtual requirement for software developers to understand. The following specification gives a detailed description of the structure and inner workings of this format.

Data Formats

Since the Wave file format is native to Windows and therefor Intel processors, all data values are stored in Little-Endian (least significant byte first) order.

Strings
Wave files may contain strings of text for specifying cue point labels, notes, etc. Strings are stored in a format where the first byte specifies the number of following ASCII text bytes in the string. The following bytes are of course the ASCII character bytes that make up the text string. Pascal programmers will notice that this is the same format used for Pascal strings.

7 'e' 'x' 'a' 'm' 'p' 'l' 'e'
Wave String Format Example

File Structure

Basic Wave File Layout

Chunk ID "RIFF"
Chunk Data Size
RIFF Type ID "WAVE"
Chunk ID "fmt "
Chunk Data Size
Sample Format Info
Chunk ID "data"
Chunk Data Size
Digital Audio Samples

Chunk Header
Chunk Data Bytes

Wave files use the standard RIFF structure which groups the files contents (sample format, digital audio samples, etc.) into separate chunks, each containing it's own header and data bytes. The chunk header specifies the type and size of the chunk data bytes. This organization method allows programs that do not use or recognize particular types of chunks to easily skip over them and continue processing following known chunks. Certain types of chunks may contain sub-chunks. For example, in the diagram to the right, you can see that the "fmt " and "data" chunks are actually sub-chunks of the "RIFF" chunk.

One tricky thing about RIFF file chunks is that they must be word aligned. This means that their total size must be a multiple of 2 bytes (ie. 2, 4, 6, 8, and so on). If a chunk contains an odd number of data bytes, causing it not to be word aligned, an extra padding byte with a value of zero must follow the last data byte. This extra padding byte is not counted in the chunk size, therefor a program must always word align a chunk headers size value in order to calculate the offset of the following chunk.

Wave File Header - RIFF Type Chunk

Wave file headers follow the standard RIFF file format structure. The first 8 bytes in the file is a standard RIFF chunk header which has a chunk ID of "RIFF" and a chunk size equal to the file size minus the 8 bytes used by the header. The first 4 data bytes in the "RIFF" chunk determines the type of resource found in the RIFF chunk. Wave files always use "WAVE". After the RIFF type comes all of the Wave file chunks that define the audio waveform.

Offset Size Description Value
0x00 4 Chunk ID "RIFF" (0x52494646)
0x04 4 Chunk Data Size (file size) - 8
0x08 4 RIFF Type "WAVE" (0x57415645)
0x10
Wave chunks
RIFF Type Chunk Values

Wave File Chunks

There are quite a few types of chunks defined for Wave files. Many Wave files contain only two of them, specifically the Format Chunk and the Data Chunk. These are the two chunks needed to describe the format of the digital audio samples and the samples themselves. Although it is not required by the official Wave file specification, it is good practice to place the Format Chunk before the Data Chunk. Many programs expect the chunks to be stored in this order and it is more sensible when streaming digital audio from a slow, linear source such as the Internet. If the format were to come after the data, all of the data and then the format would have to be streamed before playback could start correctly.

All RIFF Chunks and therefore Wave Chunks are stored in the following format. Notice that even the above mentioned RIFF Type Chunk conforms to this format.

Offset Size Description
0x00 4 Chunk ID
0x04 4 Chunk Data Size
0x08 Chunk Data Bytes
RIFF Chunk Format

The rest of this document goes through the different types of Wave chunks, describing the format of their data bytes and what they mean. You can use the table of contents at the beginning of this document to help find the chunk type you are interested in.

Format Chunk - "fmt "

The format chunk contains information about how the waveform data is stored and should be played back including the type of compression used, number of channels, sample rate, bits per sample and other attributes.

Offset Size Description Value
0x00 4 Chunk ID "fmt " (0x666D7420)
0x04 4 Chunk Data Size 16 + extra format bytes
0x08 2 Compression code 1 - 65,535
0x0a 2 Number of channels 1 - 65,535
0x0c 4 Sample rate 1 - 0xFFFFFFFF
0x10 4 Average bytes per second 1 - 0xFFFFFFFF
0x14 2 Block align 1 - 65,535
0x16 2 Significant bits per sample 2 - 65,535
0x18 2 Extra format bytes 0 - 65,535
0x1a
Extra format bytes *
Wave Format Chunk Values, * read following text for details

Chunk ID and Data Size
The chunk ID is always "fmt " (0x666D7420) and the size is the size of the standard wave format data (16 bytes) plus the size of any extra format bytes needed for the specific Wave format, if it does not contain uncompressed PCM data. Note the chunk ID string ends with the space character (0x20).

Compression Code
The first word of format data specifies the type of compression used on the Wave data included in the Wave chunk found in this "RIFF" chunk. The following is a list of the common compression codes used today.

Code Description
0 (0x0000) Unknown
1 (0x0001) PCM/uncompressed
2 (0x0002) Microsoft ADPCM
6 (0x0006) ITU G.711 a-law
7 (0x0007) ITU G.711 �-law
17 (0x0011) IMA ADPCM
20 (0x0016) ITU G.723 ADPCM (Yamaha)
49 (0x0031) GSM 6.10
64 (0x0040) ITU G.721 ADPCM
80 (0x0050) MPEG
65,536 (0xFFFF) Experimental
Common Wave Compression Codes

Number of Channels
The number of channels specifies how many separate audio signals that are encoded in the wave data chunk. A value of 1 means a mono signal, a value of 2 means a stereo signal, etc.

Sample Rate
The number of sample slices per second. This value is unaffected by the number of channels.

Average Bytes Per Second
This value indicates how many bytes of wave data must be streamed to a D/A converter per second in order to play the wave file. This information is useful when determining if data can be streamed from the source fast enough to keep up with playback. This value can be easily calculated with the formula:

AvgBytesPerSec = SampleRate * BlockAlign

Block Align
The number of bytes per sample slice. This value is not affected by the number of channels and can be calculated with the formula:

BlockAlign = SignificantBitsPerSample / 8 * NumChannels

Significant Bits Per Sample
This value specifies the number of bits used to define each sample. This value is usually 8, 16, 24 or 32. If the number of bits is not byte aligned (a multiple of 8) then the number of bytes used per sample is rounded up to the nearest byte size and the unused bytes are set to 0 and ignored.

Extra Format Bytes
This value specifies how many additional format bytes follow. It does not exist if the compression code is 0 (uncompressed PCM file) but may exist and have any value for other compression types depending on what compression information is need to decode the wave data. If this value is not word aligned (a multiple of 2), padding should be added to the end of this data to word align it, but the value should remain non-aligned.

Data Chunk - "data"

The Wave Data Chunk contains the digital audio sample data which can be decoded using the format and compression method specified in the Wave Format Chunk. If the Compression Code is 1 (uncompressed PCM), then the Wave Data contains raw sample values. This document explains how an uncompressed PCM data is stored, but will not get into the many supported compression formats.

Wave files usually contain only one data chunk, but they may contain more than one if they are contained within a Wave List Chunk ("wavl").

Offset Length Type Description Value
0x00 4 char[4] chunk ID "data" (0x64617461)
0x04 4 dword chunk size depends on sample length and compression
0x08
sample data
Data Chunk Format

Multi-channel digital audio samples are stored as interlaced wave data which simply means that the audio samples of a multi-channel (such as stereo and surround) wave file are stored by cycling through the audio samples for each channel before advancing to the next sample time. This is done so that the audio files can be played or streamed before the entire file can be read. This is handy when playing a large file from disk (that may not completely fit into memory) or streaming a file over the Internet. The values in the diagram below would be stored in a Wave file in the order they are listed in the Value column (top to bottom).

Time Channel Value
0 1 (left) 0x0053
2 (right) 0x0024
1 1 (left) 0x0057
2 (right) 0x0029
2 1 (left) 0x0063
2 (right) 0x003C
Interlaced Stereo Wave Samples

One point about sample data that may cause some confusion is that when samples are represented with 8-bits, they are specified as unsigned values. All other sample bit-sizes are specified as signed values. For example a 16-bit sample can range from -32,768 to +32,767 with a mid-point (silence) at 0.

As mentioned earlier, all RIFF chunks (including WAVE "data" chunks) must be word aligned. If the sample data uses an odd number of bytes, a padding byte with a value of zero must be placed at the end of the sample data. The "data" chunk header's size should not include this byte.

Fact Chunk - "fact"

A fact chunk stores compression code dependant information about the contents of the Wave file. It is required by all compressed WAVE formats and if the waveform data is contained inside a "wavl" LIST chunk, but is not required for the uncompressed PCM WAVE format files (compression code 1) that contain the waveform data inside a "data" chunk.

Offset Size Description Value
0x00 4 Chunk ID "fact" (0x66616374)
0x04 4 Chunk Data Size depends on format
0x08
Format Dependant Data
Fact Chunk Format

Format Dependant Data
There is currently only one field defined for the format dependant data. It is a single 4-byte value that specifies the number of samples in the waveform data chunk. This value can be used with the Samples Per Second value specified in the format chunk to calculate the waveforms length in seconds.

As new WAVE formats are introduced, the fact chunk will be expanded, appending fields after the defined number of samples field. Applications can use the fact chunk size to determine which fields are present in the chunk.

Wave List Chunk - "wavl"

A wave list chunk is used to specify several alternating "slnt" and "data" chunks. These chunks can help reduce a Wave file's size while specifying audible segments of samples when a stream of digital audio contains several periods of silence.

This type of chunk is considered to be an abuse of the Wave file format by many programmers (including myself) and it's support is not recommended. Also many programs will not recognize this type of chunk, simply ignoring it. This form of compression unnecessarily complicates the structure of a Wave file and could be better implemented in other ways, including the use of several existing compression formats.

Offset Size Description Value
0x00 4 Chunk ID "slnt" (0x736C6E74)
0x04 4 Chunk Data Size depends on size of data and slnt chunks
0x08 List of Alternating "slnt" and "data" Chunks
Wave List Chunk Format

Silent Chunk - "slnt"

A silent chunk is used to specify a segment of silence that will last some duration of samples. It is always contained within a wave list chunk. While this chunk represents silence, it does not necessarily define a zero volume or baseline sample. It actually holds the last sample value present in the preceding data chunk in the wave list chunk. If there is no preceding data chunk in the wave list chunk, a baseline value should be used (127 for 8-bit data, 0 for 16-bit or higher data). This may seem trivial, but if not followed, may cause undesired clicks and pops in the audio signal.

Offset Size Description Value
0x00 4 Chunk ID "slnt" (0x736C6E74)
0x04 4 Chunk Data Size 4
0x08 4 Number of Silent Samples 0 - 0xFFFFFFFF
Silent Chunk Format

Number of Silent Samples
This value specifies the number of silent samples that appear in the waveform at this point in the wave list chunk.

Cue Chunk - "cue "

A cue chunk specifies one or more sample offsets which are often used to mark noteworthy sections of audio. For example, the beginning and end of a verse in a song may have cue points to make them easier to find. The cue chunk is optional and if included, a single cue chunk should specify all cue points for the "WAVE" chunk. No more than one cue chunk is allowed in a "WAVE" chunk.

Offset Size Description Value
0x00 4 Chunk ID "cue " (0x63756520)
0x04 4 Chunk Data Size depends on Num Cue Points
0x08 4 Num Cue Points number of cue points in list
0x0c
List of Cue Points
Cue Chunk Format

Chunk ID and Data Size
The chunk ID for a cue chunk is always "cue " (0x666D7420). Note that the chunk ID string ends with the space character (0x20). The chunk data size is equal to the size of the Num Cue Points value (4) plus the number of following cue points multiplied by the size of each cue point's data (24). The following formula can be used to calculate a Cue Chunk's data size:

ChunkDataSize = 4 + (NumCuePoints * 24)

Num Cue Points
This value specifies the number of following cue points in this chunk.

List of Cue Points
A list of cue points is simply a set of consecutive cue point descriptions that follow the format described below.

Offset Size Description Value
0x00 4 ID unique identification value
0x04 4 Position play order position
0x08 4 Data Chunk ID RIFF ID of corresponding data chunk
0x0c 4 Chunk Start Byte Offset of Data Chunk *
0x10 4 Block Start Byte Offset to sample of First Channel
0x14 4 Sample Offset Byte Offset to sample byte of First Channel
Cue Point Format

ID
Each cue point has a unique identification value used to associate cue points with information in other chunks. For example, a Label chunk contains text that describes a point in the wave file by referencing the associated cue point.

Position
The position specifies the sample offset associated with the cue point in terms of the sample's position in the final stream of samples generated by the play list. Said in another way, if a play list chunk is specified, the position value is equal to the sample number at which this cue point will occur during playback of the entire play list as defined by the play list's order. If no play list chunk is specified this value should be 0.

Data Chunk ID
This value specifies the four byte ID used by the chunk containing the sample that corresponds to this cue point. A Wave file with no play list is always "data". A Wave file with a play list containing both sample data and silence may be either "data" or "slnt".

Chunk Start
The Chunk Start value specifies the byte offset into the Wave List Chunk of the chunk containing the sample that corresponds to this cue point. This is the same chunk described by the Data Chunk ID value. If no Wave List Chunk exists in the Wave file, this value is 0. If a Wave List Chunk exists, this is the offset into the "wavl" chunk. The first chunk in the Wave List Chunk would be specified with a value of 0.

Block Start
The Block Start value specifies the byte offset into the "data" or "slnt" Chunk to the start of the block containing the sample. The start of a block is defined as the first byte in uncompressed PCM wave data or the last byte in compressed wave data where decompression can begin to find the value of the corresponding sample value.

Sample Offset
The Sample Offset specifies an offset into the block (specified by Block Start) for the sample that corresponds to the cue point. In uncompressed PCM waveform data, this is simply the byte offset into the "data" chunk. In compressed waveform data, this value is equal to the number of samples (may or may not be bytes) from the Block Start to the sample that corresponds to the cue point.

Playlist Chunk - "plst"

The playlist chunk specifies the play order of a series of cue points. The cue points are defined in the cue chunk, somewhere else in the file. A playlist consists of an array of segments, each containing information about what sample the segment should start playing from, how long the segment is (in samples) and how many times to repeat the segment before moving on to the next segment in the play order.

Offset Size Description Value
0x00 4 Chunk ID "plst" (0x736C6E74)
0x04 4 Chunk Data Size num segments * 12
0x08 4 Number of Segments 1 - 0xFFFFFFFF
0x0a
List of Segments
Playlist Chunk Format

Number of Segments
This value specifies the number of following segments in the playlist chunk.

List of Segments
A list of segments is simply a set of consecutive segment descriptions that follow the format described below. The segments do not have to be in any particular order because each segments associated cue point position is used to determine the play order.

Offset Size Description Value
0x00 4 Cue Point ID 0 - 0xFFFFFFFF
0x04 4 Length (in samples) 1 - 0xFFFFFFFF
0x08 4 Number of Repeats 1 - 0xFFFFFFFF
Segment Format

Cue Point ID
The Cue Point ID specifies the starting sample for this segment by providing the value of a Cue Point defined in the Cue Point List. The ID that associates this segment with a Cue Point must be unique to all other segment Cue Point IDs.

Length
The Segment Length specifies the number of samples to play/loop from the starting sample defined by the associated Cue Point.

Number of Repeats
The number of repeats determines how many times this segment should be looped before playback should continue onto the next segment.

Associated Data List Chunk - "list"

An associated data list chunk is used to define text labels and names which are associated with the cue points to provide each text label or name a position.

Offset Size Description Value
0x00 4 Chunk ID "list" (0x6C696E74)
0x04 4 Chunk Data Size depends on contained text
0x08 4 Type ID "adtl" (0x6164746C)
0x0c
List of Text Labels and Names
Associated Data List Chunk Format

Type ID
The type ID is used to identify the type of associated data list and is always "adtl".

List of Text Labels and Names
The list of text labels and names is a list of assorted chunks that define text in different ways. The three main chunk types that are used in WAVE files are the Label Chunk, Note Chunk and Labeled Text Chunk.

Label Chunk - "labl"

The label chunk is always contained inside of an associated data list chunk. It is used to associate a text label with a Cue Point. This information is often displayed next to markers or flags in digital audio editors.

Offset Size Description Value
0x00 4 Chunk ID "labl" (0x6C61626C)
0x04 4 Chunk Data Size depends on contained text
0x08 4 Cue Point ID 0 - 0xFFFFFFFF
0x0c
Text
Label Chunk Format

Cue Point ID
The Cue Point ID specifies the sample point that corresponds to this text label by providing the ID of a Cue Point defined in the Cue Point List. The ID that associates this label with a Cue Point must be unique to all other label Cue Point IDs.

Text
The text is a null terminated string of characters. If the number of characters in the string is not even, padding must be appended to the string. The appended padding is not considered in the label chunk's chunk size field.

Note Chunk - "note"

The label chunk is always contained inside of an associated data list chunk. It is used to associate a text comment with a Cue Point. This information is stored in an identical fashion to the labels in the label chunk.

Offset Size Description Value
0x00 4 Chunk ID "note" (0x6E6F7465)
0x04 4 Chunk Data Size depends on contained text
0x08 4 Cue Point ID 0 - 0xFFFFFFFF
0x0C
Text
Label Chunk Format

Cue Point ID
The Cue Point ID specifies the sample point that corresponds to this text comment by providing the ID of a Cue Point defined in the Cue Point List. The ID that associates this label with a Cue Point must be unique to all other note chunk Cue Point IDs.

Text
The text is a null terminated string of characters. If the number of characters in the string is not even, padding must be appended to the string. The appended padding is not considered in the note chunk's chunk size field.

Labeled Text Chunk - "ltxt"

The labeled text chunk is always contained inside of an associated data list chunk. It is used to associate a text label with a region or section of waveform data. This information is often displayed in marked regions of a waveform in digital audio editors.

Offset Size Description Value
0x00 4 Chunk ID "ltxt" (0x6C747874)
0x04 4 Chunk Data Size depends on contained text
0x08 4 Cue Point ID 0 - 0xFFFFFFFF
0x0c 4 Sample Length 0 - 0xFFFFFFFF
0x10 4 Purpose ID 0 - 0xFFFFFFFF
0x12 2 Country 0 - 0xFFFF
0x14 2 Language 0 - 0xFFFF
0x16 2 Dialect 0 - 0xFFFF
0x18 2 Code Page 0 - 0xFFFF
0x1A
Text
Label Chunk Format

Cue Point ID
The Cue Point ID specifies the starting sample point that corresponds to this text label by providing the ID of a Cue Point defined in the Cue Point List. The ID that associates this label with a Cue Point must be unique to all other note chunk Cue Point IDs.

Sample Length
The sample length defines how many samples from the cue point the region or section spans.

Purpose ID
The purpose field specifies what the text is used for. For example a value of "scrp" means script text, and "capt" means close-caption. There are several more purpose IDs, but they are meant to be used with other types of RIFF files (not usually found in WAVE files).

Country, Language, Dialect and Code Page
These fields are used to specify information about the location and language used by the text and are typically used for queries to obtain information from the operating system.

Text
The text is a null terminated string of characters. If the number of characters in the string is not even, padding must be appended to the string. The appended padding is not considered in the note chunk's chunk size field.

Sampler Chunk - "smpl"

Offset Size Description Value
0x00 4 Chunk ID "smpl" (0x736D706C)
0x04 4 Chunk Data Size 36 + (Num Sample Loops * 24) + Sampler Data
0x08 4 Manufacturer 0 - 0xFFFFFFFF
0x0C 4 Product 0 - 0xFFFFFFFF
0x10 4 Sample Period 0 - 0xFFFFFFFF
0x14 4 MIDI Unity Note 0 - 127
0x18 4 MIDI Pitch Fraction 0 - 0xFFFFFFFF
0x1C 4 SMPTE Format 0, 24, 25, 29, 30
0x20 4 SMPTE Offset 0 - 0xFFFFFFFF
0x24 4 Num Sample Loops 0 - 0xFFFFFFFF
0x28 4 Sampler Data 0 - 0xFFFFFFFF
0x2C
List of Sample Loops
Sampler Chunk Format

Manufacturer
The manufacturer field specifies the MIDI Manufacturer's Association (MMA) Manufacturer code for the sampler intended to receive this file's waveform. Each manufacturer of a MIDI product is assigned a unique ID which identifies the company. If no particular manufacturer is to be specified, a value of 0 should be used.

The value is stored with some extra information to enable translation to the value used in a MIDI System Exclusive transmission to the sampler. The high byte indicates the number of low order bytes (1 or 3) that are valid for the manufacturer code. For example, the value for Digidesign will be 0x01000013 (0x13) and the value for Microsoft will be 0x30000041 (0x00, 0x00, 0x41). See the MIDI Manufacturers List for a list.

Product
The product field specifies the MIDI model ID defined by the manufacturer corresponding to the Manufacturer field. Contact the manufacturer of the sampler to get the model ID. If no particular manufacturer's product is to be specified, a value of 0 should be used.

Sample Period
The sample period specifies the duration of time that passes during the playback of one sample in nanoseconds (normally equal to 1 / Samplers Per Second, where Samples Per Second is the value found in the format chunk).

MIDI Unity Note
The MIDI unity note value has the same meaning as the instrument chunk's MIDI Unshifted Note field which specifies the musical note at which the sample will be played at it's original sample rate (the sample rate specified in the format chunk).

MIDI Pitch Fraction
The MIDI pitch fraction specifies the fraction of a semitone up from the specified MIDI unity note field. A value of 0x80000000 means 1/2 semitone (50 cents) and a value of 0x00000000 means no fine tuning between semitones.

SMPTE Format
The SMPTE format specifies the Society of Motion Pictures and Television E time format used in the following SMPTE Offset field. If a value of 0 is set, SMPTE Offset should also be set to 0.

Value SMPTE Format
0 no SMPTE offset
24 24 frames per second
25 25 frames per second
29 30 frames per second with frame dropping (30 drop)
30 30 frames per second
SMPTE Format Values

SMPTE Offset
The SMPTE Offset value specifies the time offset to be used for the synchronization / calibration to the first sample in the waveform. This value uses a format of 0xhhmmssff where hh is a signed value that specifies the number of hours (-23 to 23), mm is an unsigned value that specifies the number of minutes (0 to 59), ss is an unsigned value that specifies the number of seconds (0 to 59) and ff is an unsigned value that specifies the number of frames (0 to -1).

Sample Loops
The sample loops field specifies the number Sample Loop definitions in the following list. This value may be set to 0 meaning that no sample loops follow.

Sampler Data
The sampler data value specifies the number of bytes that will follow this chunk (including the entire sample loop list). This value is greater than 0 when an application needs to save additional information. This value is reflected in this chunks data size value.

List of Sample Loops
A list of sample loops is simply a set of consecutive loop descriptions that follow the format described below. The sample loops do not have to be in any particular order because each sample loop associated cue point position is used to determine the play order. The sampler chunk is optional.

Offset Size Description Value
0x00 4 Cue Point ID 0 - 0xFFFFFFFF
0x04 4 Type 0 - 0xFFFFFFFF
0x08 4 Start 0 - 0xFFFFFFFF
0x0C 4 End 0 - 0xFFFFFFFF
0x10 4 Fraction 0 - 0xFFFFFFFF
0x14 4 Play Count 0 - 0xFFFFFFFF
Sample Loop Format

Cue Point ID
The Cue Point ID specifies the unique ID that corresponds to one of the defined cue points in the cue point list. Furthermore, this ID corresponds to any labels defined in the associated data list chunk which allows text labels to be assigned to the various sample loops.

Type
The type field defines how the waveform samples will be looped.

Value Loop Type
0 Loop forward (normal)
1 Alternating loop (forward/backward, also known as Ping Pong)
2 Loop backward (reverse)
3 - 31 Reserved for future standard types
32 - 0xFFFFFFFF Sampler specific types (defined by manufacturer)
Loop Type Values

Start
The start value specifies the byte offset into the waveform data of the first sample to be played in the loop.

End
The end value specifies the byte offset into the waveform data of the last sample to be played in the loop.

Fraction
The fractional value specifies a fraction of a sample at which to loop. This allows a loop to be fine tuned at a resolution greater than one sample. The value can range from 0x00000000 to 0xFFFFFFFF. A value of 0 means no fraction, a value of 0x80000000 means 1/2 of a sample length. 0xFFFFFFFF is the smallest fraction of a sample that can be represented.

Play Count
The play count value determines the number of times to play the loop. A value of 0 specifies an infinite sustain loop. An infinite sustain loop will continue looping until some external force interrupts playback, such as the musician releasing the key that triggered the wave's playback. All other values specify an absolute number of times to loop.

Instrument Chunk - "inst"

The instrument chunk is used to describe how the waveform should be played as an instrument sound. This information is useful for communicating musical information between sample-based music programs, such as trackers or software wavetables. This chunk is optional and no more than 1 may appear in a WAVE file.

Offset Size Description Value
0x00 4 Chunk ID "ltxt" (0x6C747874)
0x04 4 Chunk Data Size 7
0x08 1 Unshifted Note 0 - 127
0x09 1 Fine Tune (dB) -50 - +50
0x0A 1 Gain -64 - +64
0x0B 1 Low Note 0 - 127
0x0C 1 High Note 0 - 127
0x0D 1 Low Velocity 1 - 127
0x0E 1 High Velocity 1 - 127
Instrument Chunk Format

Unshifted Note
The unshifted note field has the same meaning as the sampler chunk's MIDI Unity Note which specifies the musical note at which the sample will be played at it's original sample rate (the sample rate specified in the format chunk).

Fine Tune
The fine tune value specifies how much the sample's pitch should be altered when the sound is played back in cents (1/100 of a semitone). A negative value means that the pitch should be played lower and a positive value means that it should be played at a higher pitch.

Gain
The gain value specifies the number of decibels to adjust the output when it is played. A value of 0dB means no change, 6dB means double the amplitude of each sample and -6dB means to halve the amplitude of each sample. Every additional +/-6dB will double or halve the amplitude again.

Low Note and High Note
The note fields specify the MIDI note range for which the waveform should be played when receiving MIDI note events (from software or triggered by a MIDI controller). This range does not need to include the Unshifted Note value.

Low Velocity and High Velocity
The velocity fields specify the range of MIDI velocities that should cause the waveform to be played. 1 being the lightest amount and 127 being the hardest.

Format Variations

The down side to the Wave file format's popularity is that out of the hundreds of programs that support it, many abuse or misuse it due to bad programming and/or poor documentation. Once some of these "naughty" programs get fairly popular and churn out millions of incorrect Wave files, the rest of the software industry is forced to deal with it and write code that can read the incorrect files. New code should never write these errors, but possibly read them. Below are a few exceptions that have been made to the strict/original Wave file format.
  • Incorrect Block Alignment value - this can be dealt with by calculating the Block Alignment with the formula mentioned above.
  • Incorrect Average Samples Per Second value - this can be dealt with by calculating the Average Samples Per Second with the formula mentioned above.
  • Missing word alignment padding - this can be difficult to deal with, but can be done by giving the user a warning when unrecognized chunk ID's are encountered where a one byte read offset produces a recognized chunk ID. This is not a concrete solution, but will usually work even if the program doesn't have a comprehensive list of legal IDs.

2007년 2월 13일 화요일

MySQL 백업

mysqldump 사용



syntax

# mysqldump [options] database [tables]
# mysqldump [options] --databases [options] db1 [db2 db3...]
# mysqldupm [options] --all-databases [options]

1. 모든 DB 백업하기

# mysqldump -u root -p -A > all.sql

2 특정 DB만 백업하기

# mysqldump -u root -p testdb > testdb.sql

3. 원하는 DB 만 골라서 백업하기

# mysqldump -u root -p --databases testdb1 testdb2 > testdb.sql

4. 특정 테이블만 백업하기

# mysqldump -u root -p test sutdent > test_student.sql

2007년 2월 3일 토요일

Embedded Visual C++ 4 Setting

지기넷에서 퍼온 자료입니다.

인터넷을 검색해도, PPC 를 에뮬레이터를 돌리전까지 과정이 상세히 나온게 거의 없더군요.
저도 검색끝에 이거 하나 발견했네요. 다른분께 도움이 되면 좋겠네요.
참고로 원출처를 찾아가 허락을 맡으려했는데 , 어디에 있던 글인지 도저히 못찾겠더군요.
문제가 되면 원저작자는 말씀해주세요~

===========================================

출처 : www.propoz.co.kr

안녕하세요. Lucy입니다.

예전에 투데이스피피시에서 간단한 개발 강좌를 부탁하시기에 어떤 것을 가지고 강좌를 할까 고민을 하다가, 그래도 도움이 되는 것을 해보자해서 Windows Mobile 2003과 2003 SE를 위한 공용 텍스트 리더 어플리케이션을 단계별로 만드는 작업을 진행하면서 중요한 부분을 체크해 가는 방식으로 간단히 강좌를 진행하다가, 개인적인 사정으로 중단된 바가 있습니다.

그래서 이곳에서 다시 해당 강좌를 연재하려고 합니다.

먼저 많은 분들이 질문하시는 것들 중에 하나가 PC에서는 Visual Basic, Visual C++, Delphi 등 다양한 개발 도구들이 있는데, Pocket PC에서는 어떤 개발 도구를 쓰느냐 하는 질문입니다.

이 질문에 대한 답변이 첫 회의 주된 내용이 될 듯 하네요.

Pocket PC에서는 다양하다고는 할 수 없지만, 몇몇 개발 도구들이 있습니다. 주로 PC에서 개발해서 Pocket PC에서 실행하는 것이 정석입니다만, 간혹 Pocket C#와 같이 Pocket PC 상에서 직접 작성해서 컴파일하는 도구들도 준비되어 있습니다. 그러나 이런 도구들은 본격적인 개발을 위한 것이라기 보다는 간단한 테스트를 위한 목적으로 많이 사용됩니다.

이 강좌에서는 가장 많이 사용되는 도구인 Microsoft eMbedded Visual C++ 4.0 Service Pack 4 + Microsoft Windows Mobile 2003 SDK + Developer Resources for Windows Mobile 2003 Second Edition을 사용하여 개발을 진행하도록 하겠습니다.

물론 .NET Compact Framework를 이용하여 Managed Code로 작업할 수도 있겠지만, 이 강좌에서는 Native Code로 진행할 예정입니다.

개발을 진행하기 전에 이 강좌를 보시려면 다음의 조건이 어느 정도는 충족되어 있어야 합니다.

1. 개발에 관심이 있어서 관련 서적을 사서 보거나 빌려볼 수 있을 정도의 열정

아래 조건은 필수 조건은 아닙니다만, 없으면 귀찮아지는 것들입니다.

1. 개발에 필요한 수준의 영어 실력 (ㅡ_ㅡ 개발 문서가 전부 영문입니다.)
2. C++에 대한 기본적인 이해 (심층 분석까지 갈 필요는 없습니다.)
3. MFC/API에 대한 기본적인 이해 (심층 분석까지 갈 필요는 없습니다.)
4. Windows 시스템에 대한 기본적인 이해


1. 개발 도구 준비하기

Pocket PC 어플리케이션 개발을 진행하기 위해서 먼저 개발 도구를 준비하셔야 겠지요. Pocket PC는 작지만, 그 위에서 동작하는 어플리케이션을 개발하기 위해서는 많은 준비가 필요합니다.

먼저 PC의 운영 체제Windows 2000 Service Pack 2 이상, 혹은 Windows XP Service Pack 1 이상이어야만 합니다. Windows Server 2003에서도 개발을 진행할 수는 있습니다만, 상대적으로 귀찮은 부분이 많이 존재합니다.

그 중에서 권하는 것은 Windows XP Professional Service Pack 2입니다. (Service Pack 2는 굳이 없어도 되겠지만요.)

운영 체제의 요건이 충족된다면 개발 도구를 준비하셔야 합니다.

Pocket PC의 개발 도구는 VS.NET에 연동되어 있는 SDE(Smart Device Extension)를 제외하면 모두 무료로 배포되며, 마이크로소프트의 Pocket PC 개발자 사이트에서 다운로드하실 수 있습니다.

한글 환경에 맞추어 개발하기 위해 필요한 도구들은 다음과 같습니다.

1. Microsoft eMbedded Visual C++ 4.0 (다운로드 페이지) - 영문 버전

CD Key는 다음과 같습니다.

   TRT7H-KD36T-FRH8D-6QH8P-VFJHQ

2. Microsft eMbedded Visual C++ 4.0 SP4 (다운로드 페이지) - 영문 버전

3. Microsoft SDK for Windows Mobile 2003-based Pocket PCs (다운로드 페이지) - 영문 버전

4. Developer Resources for Windows Mobile 2003 Second Edition (다운로드 페이지)

5. 한글 Pocket PC 2003 Emulator Image (다운로드)

6. 영문 Pocket PC 2003 SE Emulator Image (다운로드 페이지)

7. 한글 Pocket PC 2003 SE Emulator Image (다운로드)

8. Run-time Type Information Library for the Windows Mobile-based Pocket PC 2003 SDK (다운로드)

위의 항목들을 순서대로 설치하셔야 합니다. 자세한 설치 방법과 설정 방법은 2회에서 다루도록 하겠습니다.

지루한 글 읽어 주셔서 감사합니다.


첫 번째 강좌를 올려드린 이후에 바쁜 일정으로 인해 꽤 오랫동안 강좌를 못한 점 진심으로 사과 드립니다. 이번에는 지난 시간에 이어 설치 부분을 계속 진행하기로 하겠습니다.

개발 도구라는 특성 상 단순히 설치 만으로 설정이 종료되지 않는다는 점 때문에 처음에 설치에 대해 많은 시간을 할애하여 설명하고 있습니다. 하지만 이 강좌의 설정 부분만 잘 숙지하시면 보다 쾌적한 개발 환경을 만끽하실 수 있습니다. 이 강좌의 내용대로 설정을 진행하시면 다음의 환경에 맞는 개발이 가능하게 됩니다.

- 영문 Pocket PC 2003
- 한글 Pocket PC 2003
- 영문 Pocket PC 2003 Second Edition
- 한글 Pocket PC 2003 Second Edition

물론 이를 응용하시면 중국어, 일본어, 독일어 등의 시스템에 맞는 개발도 진행하실 수 있습니다. 전체적으로 귀찮은 설정 작업을 해야한다는 점만 제외하면 어려운 것은 아니므로, 순서대로만 따라하시면 무리없이 설정을 끝내실 수 있습니다.


1. eMbedded Visual C++ 4.0 설치

eMbedded Visual C++ 4.0(이하 eVC4)의 설치는 일반적인 어플리케이션 설치와 같은 방식으로 설치가 진행되며, 마법사 형식(Next 버튼을 눌러서 다음 단계로 진행하는 방식)으로 설치가 진행됩니다.

일반적으로 CD를 가지고 있지 않으신 분들은 Microsoft 사이트에서 다운로드한 압축 자동 해제 파일 형태로 가지고 계실 텐데, 처음 설치 경로는 여러분의 계정 아래의 임시 폴더로 지정되어 있습니다. 반드시 경로를 C:\setupevc 등으로 바뀌주시기 바랍니다. 그러지 않으면 설치 파일과 임시 파일들이 한데 섞여 설치가 곤란하게 됩니다. 압축을 다 푸셨으면 C:\setupevc\setup.exe 파일을 실행하셔서 설치를 진행하시면 됩니다.

설치 프로그램은 eVC를 설치하기 전에 Platform Builder 4.0을 설치하게 되는데, 아주 특별한 경우를 제외하면 재부팅을 요구하게 됩니다. 이 때 재부팅을 하지 않으면 설치가 더 이상 진행되지 않으므로 반드시 재부팅을 해 주시기 바랍니다. 재부팅 후 설치 프로그램인 setup.exe를 다시 실행하시면 설치가 그 이후부터 계속 진행됩니다.

설치를 진행하다 보면 설치할 항목을 선택하게 되는데, Standard SDK는 설치하실 필요가 없기 때문에 해당 선택 상자를 지워주시면 됩니다.

설치가 끝나면 아까 생성되었던 C:\setupevc 폴더는 삭제하셔도 관계 없습니다.


2. eMbedded Visual C++ 4.0 Service Pack 4 설치

eMbedded Visual C++ 4.0 Service Pack 4(이하 SP4)의 설치는 eVC와 비슷하지만 훨씬 간단하게 구성되어 있습니다. 설치 방법은 마찬가지로 압축 해제를 통해 진행하게 되는데, 이 경우에도 가능하면 별도의 폴더를 만들어 설치하도록 하는 것이 좋습니다. 단, SP4는 압축이 풀린 후에 자동으로 설치가 진행되므로 이 점만 유의하시면 됩니다.


3. Microsoft SDK for Windows Mobile 2003-based Pocket PCs 설치

Microsoft SDK for Windows Mobile 2003-based Pocket PCs(이하 PPC2003 SDK)의 설치는 Microsoft Installer(이하 MSI)를 이용하여 설치가 이루어지며, 별도의 설정 변경 없이 설치를 진행하시면 됩니다.


4. Developer Resources for Windows Mobile 2003 Second Edition 설치

Developer Resources for Windows Mobile 2003 Second Edition(이하 DevResSE)의 설치 역시 MSI를 이용한 설치 작업을 진행하시면 됩니다.

설치 후 설정 작업을 해 주어야 하지만, 이 부분은 제일 마지막 단계에서 한꺼번에 설정을 하도록 하겠습니다.


5. 한글 Pocket PC 2003 Emulator Image 외의 에뮬레이터 이미지들 설치

에뮬레이터 이미지들 역시 MSI로 되어 있으므로 일반적인 어플리케이션과 같이 설치를 진행하시면 됩니다.

설치 후 설정 작업을 해 주어야 하지만, 이 부분은 제일 마지막 단계에서 한꺼번에 설정을 하도록 하겠습니다.


6. Run-time Type Information Library for the Windows Mobile-based Pocket PC 2003 SDK 설치

Run-time Type Information Library for the Windows Mobile-based Pocket PC 2003 SDK(이하 RTTI)는 eVC에서 try=catch를 정상적으로 사용할 수 있도록 해 주는 라이브러리입니다.

설치 위치를 C:\RTTI로 지정하신 후 압축을 해제하시면 됩니다.


7. 설정하기

지금부터 지루한 설정 작업이 진행됩니다.

7-1. 폴더 지정하기

먼저 eVC를 실행합니다. 시작-프로그램-Microsoft eMbedded Visual C++ 4.0-eMbedded Visual C++ 4.0을 클릭하면 됩니다.

eVC가 실행되면, 먼저 Tools-Options를 선택합니다. Options 대화 상자가 나타나면 Directories 탭을 선택합니다.

Platform은 POCKET PC 2003을 지정하고, CPUs에서 Win32 (WCE emulator)를 지정하고, Show Directories에서 Include files를 선택합니다.

리스트의 제일 아래 빈 박스 부분을 더블 클릭하면 새 폴더를 지정할 수 있는데, ... 버튼을 눌러 폴더 선택 대화 상자를 엽니다. C:\PROGRAM FILES\DEVELOPER RESOURCES FOR WINDOWS MOBILE 2003 SECOND EDITION\INC\POCKET PC 폴더를 선택하신 후, 해당 라인을 제일 위로 올립니다. 위로 올릴 때는 위쪽 화살표 아이콘을 눌러주면 됩니다.

이제 다시 Show Directories에서 Library files를 선택하고, 마찬가지로 C:\PROGRAM FILES\DEVELOPER RESOURCES FOR WINDOWS MOBILE 2003 SECOND EDITION\LIB\POCKET PC\X86를 추가하고 제일 위로 올립니다.

이제 CPUs를 Win32 (WCE ARMV4)로 변경하신 후 Include files에는 C:\PROGRAM FILES\DEVELOPER RESOURCES FOR WINDOWS MOBILE 2003 SECOND EDITION\INC\POCKET PC 폴더를 추가하시고, Library files에는 C:\PROGRAM FILES\DEVELOPER RESOURCES FOR WINDOWS MOBILE 2003 SECOND EDITION\LIB\POCKET PC\ARM을 추가합니다.

7-2. 에뮬레이터 등록하기

기본적으로 여기까지 진행하시면 영문 Pocket PC 2003 에뮬레이터와 디바이스만 등록이 되어 있는 상태입니다. 한글 Pocket PC 2003과 SE 에뮬레이터를 사용하려면 추가적인 설정이 필요합니다.

eVC가 실행된 상태에서 Tools-Configure Platform Manager를 선택합니다. POCKET PC 2003 아래에 POCKET PC 2003 Device와 Pocket PC 2003 Emulator가 등록된 것을 확인할 수 있습니다. 새로운 디바이스를 등록하기 위해 Add Device 버튼을 클릭합니다. 그러면 New Device 항목이 생성되는데, 이름은 나중에 지정해도 되니 일단 그대로 놔둡니다.

New Device가 선택된 상태에서 Properties 버튼을 클릭하면 디바이스 프로퍼티 대화 상자가 나타나는데, Transport는 TCP/IP Transport for Windows CE를 선택합니다. Startup Server는 Emulator Startup Server를 선택합니다.

Startup Server의 옆에 있는 Configure 버튼을 클릭하면 Emulation Configuration Settings 대화 상자가 나타납니다. Device의 Image에서는 연결할 에뮬레이터 이미지를 지정합니다. 한글판 Pocket PC 2003을 선택하기 위해 KOR POCKET PC 2003을 선택합니다. 이 항목이 없다면 5. 의 에뮬레이터가 정상적으로 설치되지 않은 것이므로 다시 확인을 하셔야 합니다. 나머지 부분은 건드리실 필요가 없으며, OK 버튼을 클릭하면 1차적으로 이미지 지정이 끝납니다.

이미지의 지정이 끝났다면 하단의 Test 버튼을 클릭해 봅니다. 에뮬레이터가 실행되고, 한글판 Pocket PC가 나타난다면 정상적으로 지정이 된 것입니다. OK 버튼을 눌러 설정을 완료합니다. 테스트를 하지 않았다면 테스트를 하지 않았다는 경고 대화 상자가 나타나므로 가급적이면 테스트를 거칠 것을 권합니다.

New Device의 이름을 변경하려면 해당 이름 위에서 클릭을 두 번 해주면 됩니다. 더블 클릭을 하면 설정 대화 상자가 열리므로 더블 클릭을 하면 안 됩니다. 이름은 POCKET PC 2003 Kor Emulator 정도로 바꿔줍니다. Korean Pocket PC 2003 Emulator로 할 수는 있지만, 나중에 에뮬레이터를 선택할 때 정신이 없으므로 가능하면 형태를 기본과 맞춰 주는 것이 좋습니다.

추가적으로 SE의 에뮬레이터도 지정을 해 주면 됩니다. Radio 관련 에뮬레이터는 일반적인 경우 지정할 필요가 없으며, SE는 언어별로 다음의 4가지 이미지만 설정하면 됩니다. (영문/한글을 지정할 경우 4 X 2 = 8개의 이미지를 지정해야 합니다.)

SE Emulator - 240x320 모드
SE Landscape Emulator - 320x240 모드
SE VGA Emulator - 480x640 모드
SE Landscape Emulator - 640x480 모드

7-3. RTTI 설정하기

eVC4를 종료하고, 아까 RTTI를 설치했던 폴더(C:\RTTI)로 갑니다. 안에는 Armv4 폴더와 emulator 폴더의 파일들, 그리고 EULA.txt 파일이 있습니다. 해당 파일과 폴더들을 전부 선택한 후 (폴더대로 선택해야 합니다.) C:\Program Files\Windows CE Tools\wce420\POCKET PC 2003\Lib 폴더에 복사하거나 옮깁니다.

Lib 폴더 안에도 Armv4 폴더와 emulator 폴더가 있으며, 각각의 파일들이 올바른 폴더 안에 들어가야 합니다.


이로서 개발 도구의 설치가 끝났습니다. 전부 다 마치면 대략 2시간 정도 걸립니다.

감사합니다.

2007년 2월 1일 목요일

2007년 1월 27일 토요일

국제 결혼

우리 나라가 이정도까지 살게 된건 채 20년이 되지 않는다.
좀 먹고 살만하니깐 여자들을 다른나라에서 사오는 어처구니 없는 행태가 일어나기도 한다.

길을 걷다보년 "베트남 처녀와 결혼하세요", "숫처녀" 이런 광고들이 눈에 많이 보인다.

베트남 여자, 또는 조선족 여자... 많은 우리나라보다 못사는 나라의 여자들은
나름대로의 Korean Dream 을 꿈꾸고 한국으로 오는거겠지?

하지만, 사지 멀쩡하고 정신 멀쩡하고 생각 제대로 박힌 남자가 저런광고를 보고 진짜 결혼을 하게 될까?
답은 NO 이다.

그렇다. 뭔가 하나쯤 부족하고 뭔가 하나쯤 모자를 그런 남자들이 광고를 보고 여자를 선택하는것이다.

그래서 한국으로 시집온 순진한 여자들은 농촌에서 개고생하고, 남편 폭력에 시달리고,
나이많은 남편 수발 들어주고 이런게 현실이다.

너무 부정적이지만 사실이다. 바로 현실인 것이다.

만약에 내가 다른 나라 여자를 정말로 사랑한다면... 그녀 없이는 살 수가 없다면 어떻게 될까?
우리나라보다 선진국인 유럽의 많은 나라들... 또는 미국, 호주, 일본 같은 나라의 여자라면 별로 상관이 없다. 만약 그런여자를 사랑해서 결혼을 하게 된다면 주위 시선은

"야~ 저녀석 능력있는데???" 가 되겠지..

하지만 중국여자나, 베트남, 인도네시아 이런나라의 여자를 사랑한다면???

"저녀석 어디 문제 있는거 아니야?" "도대체 뭐가 부족한거야?"

이런 반응이 대부분일 것이다.

부모님께 여쭈어 봤다. "국제 결혼 어떻게 생각하세요?" "괜찮지..." "중국여자라면???"
"흠... 넌 아직 젊으니깐 괜찮을거야..."

그래.. 추측이다. 괜찮을것이다... 하지만 이런 얘기를 꺼낸 아들의 걱정도 약간 포함되어 있는 뉘앙스다...

왜 이런 생각이 나오는것일까...
누군가가 우리보다 후진국인 나라의 여자들을 마구 마구 사오기 때문이다. 마구 마구 사와서 억지스러운 사랑을 만들고, 억지로 사랑하게 만들고, 억지로 한국여자를 만들어버리기 때문에...

사랑이 없는 다른나라 여자들은 그냥 숙명이니 하며 받아드리고 그렇게 살다가 한국에서 죽는것이다.

그래서 다른나라 여자를 사랑하는것을 두려워 하는 사람이 있는것이다.

이런 현실에서 정말 사랑은 어떻게 하라고? 말 안통해도 사랑만 있으면 되는거잖아? 사랑만 있으면 되는건데 왜 사회를 이렇게 만들어 놓는데?

부활 태권 V

사용자 삽입 이미지

태권 V 가 부활했다. 1970년대 그러니깐 나의 아버지도 학생시절에... 나온 녀석이 최근에 디지털로 부활했단다. 그동안 태권 V 를 디지털로 복원하려고 하는 노력은 많이 있었으나, 이번처럼 완료되서 극장에 까지 사영된건 처음이다.

사실 태권 V 를 그렇게 좋아하진 않는다. 만든사람이나 우리나라 사람이라면 일본의 마징가Z 를 모방하지 않은 순수 국내 창장물이라곤 하지만, 마징가 Z 를 알고 있는 사람이면, 태권V 가 마징가를 모방했다는것은 쉽게 알 수 있다.

태권 V 를 만든 김청기 감독 또한 그런걸 의식하고 있는지 인터뷰할때마다 국내 독창적인 창장물이라는것을 많이 강조한다.

좀 안쓰럽다는 생각이 들긴 든다.

부정적인 생각인지는 모르겠지만, 김청기 감독은 태권V 이후 우뢰매 씨리즈를 연속 히트 시키며, 감독계의 스타덤에 올랐으나, 우뢰매 5편 부터인가... 외국 애니메이션에 뒤 떨어진 조잡한 합성기술 또는 내용 부실등으로 입지를 잃게 되었다.
태권 V 의 부활은 아마 김청기 감독의 "최후의 저항" 정도 라고 생각한다.

지금 나와 비슷한 연대의 사람들은 옛추억을 떠올리면서 태권V 를 감상한다고 하지만, 지금 어린이들은 과연 어떤 생각을 할까... 일본 애니메이션이 넘쳐나는 이 세상에서 과연 태권 V 를 자랑스럽게 여길까 의문이 든다. 어쩌면 아무 생각없이 그냥 보고 있는지도 모를일이다.

태권 V 이 좋다 이거다. 하지만 정정당당하게 "어디를 약간 모방했으니 이해를 부탁한다." 또는 "그때 당시 국내 애니메이션 수준이 이정도였다." 이렇게 해서 공감을 얻는게 더 어른스러워 보이지 않을까?

그리고 이왕 이렇게 부활 시킨거, 극장 애니메이션으로 끝낼게 아니라 본격적인 캐릭터 산업에도 포함시키고 해외에 수출까지 가능할 수 있도록 더 개량하여 부가가치를 높여야 할 것이다.

2007년 1월 23일 화요일

개병대 이야기

"한번 개병대는 영원한 개병대"




어느 개병대가 있었습니다.
그는 동네 친구들도, 동네 사람들도 그를 무척 싫어합니다.
개병대는 너무 거칠다고 ,너무 안하 무인이라고,

너무 고지식하다고, 너무 똥폼을 잡는다고
오히려 그에게 욕하고 왕따를 시킵니다.

"개병대" 동네에 3명의 친구가 살고 있었습니다.
"땅개", "참새","물개"라는 친구들입니다.


어느날 동네 친구들이 다른 마을의 깡패들에게 처참하게 맞고 왔습니다.
세 친구 모두 인사 불성이 되도록 맞았습니다.

동네 친구들은 무서워서 동네 밖을 다닐 수가 없었습니다.
다른 마을에 깡패들이 그들만 보면
몹시 괴롭히고 못된 짓만 일삼습니다.

어느날 동네 친구 셋이서 그 동네 "개병대"에게 이야기를 합니다.
"이봐 개병대 우리와 함께 저기 동네 구경 안갈래?.

저기 동네에 가면 이쁜 아가씨들도 많고 좋은것도 아주 많다네"
하면서 "개병대"에게 같아 가지고 꼬십니다.

개병대는 정말 친구들이 고마웠습니다.
자기와 함께 어디 가자고 하기는 처음이었기 때문입니다.
하지만 개병대에게는 할 일이 있어서 같이 갈 수가 없었습니다.
친구들은 실망하면서 이웃 동네에 갔습니다. 이웃 동네 깡패들이 무서웠기 때문입니다.

그런데 이때 친구들 앞을 가로 막는 이웃 동네 깡패들이 나타났습니다.
역시 친구들은 그들에게는 상대가 되질 않았습니다.

개병대는 그래도 친구들이 자기와 함께 같이 가자고 한게 고마워서

하던 일을 멈추고 이웃 동네고 뛰어 갔습니다.
개병대 눈에는 동네 친구 들이 이웃 동네 깡패들에게 처참하게 깨진 모습만 보였습니다.

개병대는 친구들이 더 이상 맞는게 싫어서 나서기로 했습니다.
비록 친구들이 자기가 나서는걸 싫어 할지라도 ......,

이웃 동네 깡패들은 개병대의 상대가 되질 못했습니다.
아무리 기를 쓰고 덤벼 들어도 개병대는 결코 물러 서거나
두려워하는 기색은 전혀 없고 오히려 투지가 더 살아 나는 것이었습니다.

수적으로도 열세 였지만 그들은 결코
개병대의 적수가 될수 없었습니다.
개병대는 깡패들로 부터 친구들을 무사히 구할 수 있었습니다.
그런데 이때 친구들이 오히려 자기들을 도와준 개병대에게 따지고 묻습니다.
너 아니었어도 우리들 끼리 저 깡패들을 물리 칠수 있었다고.
모두 다 개병대 때문에 망쳤다고 오히려 짜증을 내고 면박을 줍니다.


그러나 그는 결코 그 친구들을 미워 하거나 싫어하진 않습니다.
그의 가슴에는 친구들에 대한 사랑이 가득하기 때문입니다.
하지만 그 친구들은 그렇지 않습니다.

깡패가 나타나서 행패를 부리면 그 친구들과 동네 사람들은 개병대을 부릅니다.
저 깡패들을 상대할 사람은
너 밖에 없다고 감언 이설로 설득을 시켜서 내 보냅니다.
그는 그 친구들을 위해 동네 사람들을 위해 대신

그 무시무시한 깡패들과 피 터지게 싸우고 망신창이가 되어도
사랑하는 친구들을 동네 사람들을 위해서 단 한발짝도 물러 서지 않습니다.
저 친구들에게는 그가 마지막 희망이기 때문입니다.

하지만 "토사구팽"이라는 말이 있듯이
동네가 깡패들로 부터 조용해지깐
이젠 개병대가 필요없다고 개병대 보고 이젠 다른 동네로 이사를 가라고 합니다.
아니면 이름을 바꾸고,삶의 방식도 바꾸고,바보처럼 멍청이 처럼 그들이
시키는 대로 하라고 강요합니다.
이제 더이상 필요없고 거추장 스럽다고 다시 동네에서 자기들의 입지가 난처해지는걸 ,

아주 싫어하는 아주 못된 친구들에 의해서 이루어진 일이었습니다.

동네 친구들은 개병대가 두렵습니다.
어느 누구보다고 강하고 ,이웃 동네 깡패들도 두려워 하는 그 개병대를 더 무서워 합니다.
언제 그 거친 행동을 자기들에게, 동네 사람들에게 할지 모른다고.
만에 하나 개병대가 약간 실수만 하면 마치 그 순간을 기다렸다는듯이 일제히 들로 일어 납니다.
개병대 때문에 불안해서 살수 없다고.....,

이제는 개병대의 생활 습관까지 간섭하고 나섭니다.
개병대의 하는 행동 하나 하나 간섭을 합니다.

만약 자기 들의 요구 사항을 들어 주지 않으면

모든 편의 시설및 생활 보장을 일체 제한 하겠다고
어름장을 놓습니다.

이 개병대은 앞으로 어떻게 해야 할까요?

그 친구들의 말대로 모두 따라서 해야 할까요?

그런데 이젠 그 친구들이 그 개병대의 행동과 생활 습관을 자기들이 모방을 하고 있습니다.
그 개병대가 하던 옷 차림 ,행동, 습관등등 ....,

하지만 그 개병대에게는 하지 못하게 합니다.
더 더욱 못하게 합니다. 개병대의 과거의 모습을 모두 지우려고 합니다.


더이상 개병대은 그들의 보호자가 아니라고 합니다.
그들의 쫄병에 지나지 않는다고 합니다.

그들의 더럽고 힘든 일만 맡아서 하라고 합니다.

하지만 개병대에게는 연장하나 제대로 된걸 주지도 않습니다.

사용하는 연장에도 일일이 감시하고,확인하고 또 확인합니다.

어쩌면 두번 다시 동네에서 개병대를 볼 수 없을지도 모르는데도
아무도 그를 도우려 하지 않습니다. 오직 그의 친척들 뿐입니다.

개병대를 어떻게 해야 할까요?
그냥 그 동네를 떠나라고 할까요?

그러면 이웃 동네 깡패들이 다시 처들어 오면 어떻게 할까요?
그때 가서 다시 개병대를 다시 이사 오라고 해야 할까요?


이웃 동네에서는 깡패들을 더 더욱 강인하고 난폭하게 키우고 있는데
이 동네에서는 오히려 그들과 맞설수 있는 개병대를 내 쫓으려 하고 있습니다.

동네가 다 망가지고 망신창이가 되고 나서 개병대에게 너무 했다고
후회해야 하는지 ......,



--- 첨부 ---



초기 해병대창설후 대대,연대급 인력으로 부대의 가치를 높이는일은 승리하는거였다.

삼군보다 앞서서, 먼저 고지를 점령하고 무조건 이겨야만 소부대의 가치를 인정받는것.


육군,해군,공군,해병사령관의 계급은 같았었다.

어느순간 해병대사령부를 해체하더니, 사령관의 계급도 한단계 떨어뜨렸다.

해군에서 UDT를 뺏어가더니, 이번엔 육군에서 공수부대를 뺏어갔다.


세무워카를 바꾸려하고, 상륙돌격머리를 바꾸려하고, 순검도 없앨려고한다.

사령관은 계급에밀려서 이리채이고 저리채이고 눈치를 볼수밖에 없다.


전역자들과 현역들이 힘을보태니, 사령부가 다시생겼고,

없애려는 여러가지전통을 다시 지킬수있었다.


전쟁때는 사람잘죽인다고 표창도많이해주고, 중대전체가 1계급특진할정도로대우해주더니

뒤도돌아볼수없는 상륙전이기에 죽이는법과 악과깡만 2년동안 교육시키더니

이젠 사회에서 혐호감이든다며, 없애려고한다. 지들이 그렇게 가르쳐놓고 어쩌라고 ~


해병대를 반으로잘라서, 반은 전쟁시 김포와 백령도의 총알받이로 ,

반은 포항에서 존내 훈련만시키다가 상륙전에 총알받이로 던져놓을려고하고

김포 1개사단은 육군 6개사단이 감당해야하는지역 맡으라고 던져놓고 ~

특수부대는 월급이나받지, 한달2만원받는 해병들 먹는거나 잘주든가 ~


사령부는 있으되, 상륙할 배하나 공군지원할 비행기하나없고,

사령관은 있으되, 계급에 밀려 제목소리도 못내고

해병대는 있으되, 해군에서 콩고물받아 생활해야하고

개병되는 있으되, 악과깡만 길러놓고 혐오스럽다고 꺼지라하고 ~ 어쩌라고 !!