public override AudioFile Read(string fileName)
        {
            AudioFile audioFile = new AudioFile();

            byte[] vs    = File.ReadAllBytes(fileName + ".wav");
            int    index = 0;

            //Check File Validity
            if (ByteTools.BytesToString(vs, ref index, 4) != "RIFF")
            {
                throw new FileLoadException("File Header Invalid");
            }
            int tFileLength = (int)ByteTools.BytesToUInt(vs, ref index);

            if (ByteTools.BytesToString(vs, ref index, 4) != "WAVE")
            {
                throw new FileLoadException("File Header Invalid");
            }
            if (ByteTools.BytesToString(vs, ref index, 4) != "fmt ")
            {
                throw new FileLoadException("File Header Invalid");
            }
            //Read Format
            AudioFileFormat format           = new AudioFileFormat();
            int             lengthOfHeader   = (int)ByteTools.BytesToUInt(vs, ref index);
            int             indexAfterHeader = index + lengthOfHeader;

            index               += 2;
            format.nChannels     = ByteTools.BytesToUShort(vs, ref index);
            format.SampleRate    = ByteTools.BytesToUInt(vs, ref index);
            index               += 6;
            format.BitsPerSample = ByteTools.BytesToUShort(vs, ref index);
            index                = indexAfterHeader;
            //Check Validity Again
            while (ByteTools.BytesToString(vs, ref index, 4) != "data")
            {
                index -= 3;
                if (index > 100)
                {
                    throw new FileLoadException("File Header Invalid");
                }
            }
            //Read Audio Data
            audioFile.audioSize = ByteTools.BytesToUInt(vs, ref index);
            audioFile.audioData = new byte[(int)audioFile.audioSize];
            Array.Copy(vs, index, audioFile.audioData, 0, (int)audioFile.audioSize);
            //Return All Necessary Data
            audioFile.fileFormat = format;
            return(audioFile);
        }
        public AudioFile Read(string fileName, out ArrayList ID3Frames)
        {
            AudioFile audioFile = new AudioFile();

            byte[] vs    = File.ReadAllBytes(fileName + ".mp3");
            int    index = 0;

            //Load ID3
            readID3(vs, ref index);
            Console.WriteLine("ID3v2." + ID3Ver + " Header Loaded");
            //Start Reading Frames
            AudioFileFormat format = new AudioFileFormat();

            byte[] audioData;
            while (index < vs.Length)
            {
                //TODO: Implement MP3 File Reading
                //Read Frame Header
                byte[] headerBytes = new byte[4];
                Array.Copy(vs, index, headerBytes, 0, 4);
                index += 4;
                MP3FrameHeader header = ReadFrameHeader(headerBytes);
                if (format.BitsPerSample != header.bps)
                {
                    format.BitsPerSample = (ushort)header.bps;
                }
                if (format.SampleRate != header.sampleRate)
                {
                    format.SampleRate = header.sampleRate;
                }
                if (format.nChannels != header.channels)
                {
                    format.nChannels = (ushort)header.channels;
                }
                if (header.prot)
                {
                    index += 2;
                }
                int bound = header.channelMode == 0b0 ? 4 : header.channelMode == 0b01 ? 8 : header.channelMode == 0b10 ? 12 : header.channelMode == 0b11 ? 16 : -1;
            }
            ID3Frames = frames;
            return(audioFile);
        }