public AudioFile(byte[] byteArray, int channels, int bitDepth, int sampleRate) { header = new AudioFileHeader(); this.maxAmp = 1; this.minAmp = -1; header.sampleRate = sampleRate; header.bitDepth = bitDepth; header.channels = channels; header.chunkID = 1179011410; header.riffType = 1163280727; header.fmtID = 544501094; header.fmtSize = 16; header.fmtCode = 1; header.byteRate = sampleRate * channels * bitDepth / 8; header.fmtBlockAlign = channels * bitDepth / 8; header.dataID = 1635017060; header.bytes = byteArray.Length; header.fileSize = header.bytes + 36; int bytesForSamp = bitDepth / 8; int samps = header.bytes / bytesForSamp; this.byteArr = byteArray; byteToFloat(); DeMux(); }
private AudioFile(AudioFileHeader header) { this.header = header; this.nyquistLimit = (int)header.sampleRate / 2; maxAmp = 1; minAmp = -1; this.random = new Random(); }