Skip to content

Commit ae5ec51

Browse files
committed
do not store date inside SFF files
doing so produces a different set of bytes (and file hash) with ever regeneration of the same input data
1 parent 0fd4dce commit ae5ec51

File tree

1 file changed

+9
-8
lines changed

1 file changed

+9
-8
lines changed

src/Spectrogram/SFF.cs

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -98,8 +98,8 @@ public void Load(string filePath)
9898
byte bytesPerValue = bytes[71];
9999
Decibels = bytes[72] == 1;
100100

101-
// recording start time
102-
DateTime dt = new DateTime(bytes[74] + 2000, bytes[75], bytes[76], bytes[77], bytes[78], bytes[79]);
101+
// recording start time - no longer stored in the SFF file
102+
//DateTime dt = new DateTime(bytes[74] + 2000, bytes[75], bytes[76], bytes[77], bytes[78], bytes[79]);
103103

104104
// data storage
105105
int firstDataByte = (int)BitConverter.ToUInt32(bytes, 80);
@@ -178,12 +178,13 @@ public void Save(string filePath)
178178
header[73] = dataExtraByte;
179179

180180
// source file date and time
181-
header[74] = (byte)(DateTime.UtcNow.Year - 2000); // 2-digit year
182-
header[75] = (byte)DateTime.UtcNow.Month;
183-
header[76] = (byte)DateTime.UtcNow.Day;
184-
header[77] = (byte)DateTime.UtcNow.Hour;
185-
header[78] = (byte)DateTime.UtcNow.Minute;
186-
header[79] = (byte)DateTime.UtcNow.Second;
181+
// dont store this because it makes SFF files different every time they are generated
182+
//header[74] = (byte)(DateTime.UtcNow.Year - 2000);
183+
//header[75] = (byte)DateTime.UtcNow.Month;
184+
//header[76] = (byte)DateTime.UtcNow.Day;
185+
//header[77] = (byte)DateTime.UtcNow.Hour;
186+
//header[78] = (byte)DateTime.UtcNow.Minute;
187+
//header[79] = (byte)DateTime.UtcNow.Second;
187188

188189
// ADD NEW VALUES HERE (after byte 80)
189190
Array.Copy(BitConverter.GetBytes(MelBinCount), 0, header, 84, 4);

0 commit comments

Comments
 (0)