Audio screen

I am working on a project of my last year at JAVA

1) hiding text in the image

2) image in image

3) text in a sound file (WAVE)

I successfully completed 1) and 2) and attached the source code if someone might need it. I have problems in the 3rd, I hide the data in a sound file. I create an audio interface from a wave file and read it into an array of bytes but many things are not clear, when reading I assume that the first 44 bytes are header bytes? (since the file is in WAVE format), or the title is not copied at all. The problem is .... during decoding again I have to read the data from the newly created audio file in a byte array. And I can not find bytes where I have hidden data.

Can someone tell me what exactly happens when we read data into an array of bytes from the audio interface, I mean, what is actually read into an array of bytes?

File fileIn = new File("C:\\Users\\Rahul\\Desktop\\pro\\Don't Stay.wav");

AudioInputStream audioInputStream =

AudioSystem.getAudioInputStream(fileIn);

int avail= audioInputStream.available();

System.out.println("bytes available " +avail);

System.out.println(audioInputStream.markSupported());

int bytesPerFrame =

        audioInputStream.getFormat().getFrameSize();

      // Set an arbitrary buffer size of 1024 frames.

int numBytes = 1024 * bytesPerFrame;

byte[] audioBytes = new byte[numBytes];

audioInputStream.read(audioBytes);

byte btext[]=Stego_text("good morning!");

byte bcoded[]=steg.encoding(audioBytes,btext,0);



 byte[] stg= a.decode_text(audioBytes);

 String obtain= new String(stg);

        System.out.println(">>>"+ obtain); //the hidden message gets successfully displayed here





try {

   //

            AudioSystem.write(audioInputStream, Type.WAVE, new File("C:\\Users\\Rahul\\Desktop\\pro\\Don't Stay_restored.wav"));

        } catch (Exception e) {



            e.printStackTrace();

        }

        byte[] audioBytesNew = new byte[numBytes];

        audioInputStream.read(audioBytesNew);

        byte[] stg1= a.decode_text(audioBytesNew);

        String obtain1= new String(stg1);

        System.out.println(">>>"+ obtain1); //the hidden message does not get displayed 

if I decode an array of bytes immediately after editing, then it works fine and displays a hidden message, but after creating an array of bytes and reading audio interface data into it, and then decoding that byte array .. it does not work. I wonder why? please help me.

+5
source share
1 answer

The first 44 bytes are indeed the WAV header (see https://ccrma.stanford.edu/courses/422/projects/WaveFormat/ )

If you open the file in the HEX editor, you will see what it looks like ( http://imgur.com/iliA40R )

, InputStream, .

, . , reset() .

+1

All Articles