      - returns: An Int initialized by converting the given little-endian byte buffer into
             an unsigned 32-bit integer.
      */
-    private static func dataToUInt32(data: NSData, offset: Int) -> Int {
-        var num: UInt32 = 0
+    private static func dataToUInt32(data: Data, offset: Int) -> Int {
+        var num: UInt8 = 0
         let length = 4
-        let range = NSMakeRange(offset, length)
-        data.getBytes(&num, range: range)
+        let range = Range(uncheckedBounds: (lower: offset, upper: offset + length))
+        data.copyBytes(to: &num, from: range)
         return Int(num)
     }
     

     - parameter data: The WAV-formatted audio file produced by Watson Text to Speech. The
            byte data will be analyzed and repaired in-place.
     */
    private static func repairWAVHeader(data: NSMutableData) {
        
        // resources for WAV header format:
        // [1] http://unusedino.de/ec64/technical/formats/wav.html
        // [2] http://soundfile.sapp.org/doc/WaveFormat/
        
        // update RIFF chunk size
        let fileLength = data.length
        var riffChunkSize = UInt32(fileLength - 8)
        let riffChunkSizeRange = NSMakeRange(4, 4)
        data.replaceBytes(in: riffChunkSizeRange, withBytes: &riffChunkSize)
        
        // find data subchunk
        var subchunkID: String?

        }
        
        // compute data subchunk size (excludes id and size fields)
        var dataSubchunkSize = UInt32(data.count - fieldOffset - fieldSize)
        
        // update data subchunk size
        let dataSubchunkSizeData = Data(bytes: &dataSubchunkSize, count: MemoryLayout<UInt32>.stride)
        data.replaceSubrange(Range(uncheckedBounds: (lower: fieldOffset, upper: fieldOffset+fieldSize)), with: dataSubchunkSizeData)
    }
}
