Skip to content

Commit

Permalink
Merge pull request #43 from mbmleone/master
Browse files Browse the repository at this point in the history
Wave Header Incorrect
  • Loading branch information
NateRickard authored Dec 18, 2019
2 parents f3bf8b5 + f7a93a8 commit 01e3b76
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions Plugin.AudioRecorder.Shared/AudioFunctions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ internal static void WriteWavHeader (BinaryWriter writer, int channelCount, int

if (audioLength > -1)
{
writer.Write (audioLength + 36); // 36 + subchunk 2 size (data size)
writer.Write ((Int32)(audioLength - 8)); // Size of the overall file - 8 bytes, in bytes (32-bit integer).
}
else
{
Expand All @@ -71,7 +71,7 @@ internal static void WriteWavHeader (BinaryWriter writer, int channelCount, int
writer.Write (Encoding.UTF8.GetBytes ("data"));

//subchunk 2 (data) size
writer.Write (audioLength);
writer.Write (audioLength-44);
}

// Adapted from http://stackoverflow.com/questions/5800649/detect-silence-when-recording
Expand Down

0 comments on commit 01e3b76

Please sign in to comment.