#!/usr/bin/ruby
# -*- coding: utf-8 -*-

require 'rubygems'
require 'wav-file'

#f = open("saihate_oliver.wav")
format = WavFile::readFormat(f)
dataChunk = WavFile::readDataChunk(f)
f.close

#puts format

bit = 's*' if format.bitPerSample == 16
bit = 'c*' if format.bitPerSample == 8

wavs = dataChunk.data.unpack(bit)
#dataChunk.data = wavs.reverse.pack(bit)

#open("output.wav", "w"){|out|
#  WavFile::write(out, format,[dataChunk])
#}

#p wavs.length
#p wavs[4329032]
