memory address problem

Hi,
I am working on this project.
I am trying to take a .wav file and read the data (headers, chuncks, samples and addresses of the samples, ETC...).
I have this code:


import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.File;
import javax.sound.sampled.AudioFileFormat;
import javax.sound.sampled.AudioFormat;
import javax.sound.sampled.AudioInputStream;
import javax.sound.sampled.AudioSystem;
import java.io.*;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;
import java.io.IOException;
import java.lang.Exception;


public class Project_Ala

{
    public static void main(String[] args) throws java.lang.IllegalArgumentException,
                        java.io.IOException,
                        java.lang.Exception
    {      
        FileReader fr = null;
        FileWriter fw = null;
       
        try
        {
              File      sourceFile = new File("C:/Documents and Settings/s118608/Desktop/School/CIS416_PROGRAMMING/Project/dsclip.wav");      
              
              AudioFileFormat fileFormat = AudioSystem.getAudioFileFormat(sourceFile);                                                            
                  AudioFileFormat.Type targetFileType = fileFormat.getType();                                                                                    
                  AudioFormat audioFormat = fileFormat.getFormat();                                                                                                
                  System.out.println("fileFormat "+fileFormat);
                                                                                                                  System.out.println();                                                                                                                                          
                                    
            fr = new FileReader("C:/Documents and Settings/s118608/Desktop/School/CIS416_PROGRAMMING/Project/dsclip.wav");
                   
            fw = new FileWriter("C:/Documents and Settings/s118608/Desktop/School/CIS416_PROGRAMMING/Project/dsclip.txt");
           
                  int ch = 0, i = 0;
         
       while((ch = fr.read()) != -1)
                  {
                  //System.out.print(ch);                                                
                  fw.write(ch);                                                                  
                System.out.print(Integer.toHexString(ch));
                System.out.print(" ");
                //fw.write(Integer.toHexString(ch));
                fw.write(" ");
                     i++;                                                                               
                      if (i%4==0)
                           {                                                                              
                           System.out.print("   ");                                                                        
                        }                    
                     if (i == 24)                                                                  
                           {                                                                              
                           System.out.println();                                                
                           i=0;                                                                        
                        }
                  }
        }
        catch (IOException e)
        {
            e.printStackTrace();
        }  
        finally
        {
            try
            {
                fr.close();
                fw.close();
            }
            catch (IOException e)
            {
                e.printStackTrace();
            }            
        }    
    }
}


Here is a sample output:

--------------------Configuration: <Default>--------------------
fileFormat WAVE (.wav) file, byte length: 10051, data format: ULAW 8000.0 Hz, 8 bit, mono, 1 bytes/frame, , frame length: 10005

52 49 46 46    3b 27 0 0    57 41 56 45    66 6d 74 20    12 0 0 0    7 0 1 0    
40 1f 0 0    40 1f 0 0    1 0 8 0    0 0 64 61    74 61 15 27    0 0 ef e9    
ff 72 fe ea    eb f5 f6 7b    f6 7a 68 7d    70 7e 71 72    fe fe f1 f2    7e 6a fe fe    
73 fd fd fd    fe fe fe f1    ff ff ff 72    fe fe fe ea    71 6a fd fd    fd fe fe fe    
73 74 e9 f1    ff f2 f3 70    71 72 73 f0    e3 eb f6 6e    6f 7d 7d f4    7c 6f 71 6a  

What I need is to get the output to look like this:

--------------------Configuration: <Default>--------------------
fileFormat WAVE (.wav) file, byte length: 10051, data format: ULAW 8000.0 Hz, 8 bit, mono, 1 bytes/frame, , frame length: 10005

52 49 46 46    3b 27 0 0    57 41 56 45    66 6d 74 20    12 0 0 0    7 0 1 0    
40 1f 0 0    40 1f 0 0    1 0 8 0    0 0 64 61    74 61 15 27    0 0 ef e9    

value 7F hex is located at address 1E7A hex
or
7F @1E7A

I can get the hex value out but not the hex address of that value.
How do I get the address out?
Thanks
Al


lacroix_alAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

CEHJCommented:
Surely all you need to do is to map the value to the offset?
lacroix_alAuthor Commented:
ok
So how do I go about doing that?
Al
CEHJCommented:
You're already tracking the offset:

>>i++;

so you just need to keep a track of/print the offset-value from whatever data section you need.              

http://www.cs.caltech.edu/~fowlkes/writeup/source/WAVReader.java

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Starting with Angular 5

Learn the essential features and functions of the popular JavaScript framework for building mobile, desktop and web applications.

lacroix_alAuthor Commented:
Cehj,
Ok so in this program arg[0] = the input file.
What does arg[1] =?
Al
Mick BarryJava DeveloperCommented:
args[1] is ther number of amplitudes to output.
lacroix_alAuthor Commented:
Thank you
Al
CEHJCommented:
:-)
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Java

From novice to tech pro — start learning today.