import struct


def read_htk_header(datafile):
        """
        Read HTK header of datafile, return ...
        
        From the HTKBook, p.69:
             nSamples   -- number of samples in file (4-byte integer)
             sampPeriod -- sample period in 100ns units (4-byte integer)
             sampSize   -- number of bytes per sample (2-byte integer)
             parmKind   -– a code indicating the sample kind (2-byte integer)

        """
        header_pattern = 'iihh'
        header_size = struct.calcsize(header_pattern)
        with open(datafile, mode='rb') as f: 
            data = f.read(header_size)
        unpacked = struct.unpack(header_pattern, data)
        return unpacked