MATLAB: WAV into binary bits

audiosteganographywav to binary

How to convert a wav file data into binary (0,1) format, so that it can again be converted from binary form to wav?

Best Answer

wavdata = wavread('FileName.wav');
wavbinary = dec2bin( typecast( single(wavdata(:)), 'uint8'), 8 ) - '0';
orig_size = size(wavdata);
Then the reverse:
wavdata = reshape( typecast( bin2dec( uint8(wavbinary + '0') ), 'single' ), orig_size );