Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Reading WAV as data/numbers into Excel

  1. Jun 21, 2008 #1
    Hi,

    I have read WAV files as data/numbers into MATLAB before for fourier analysis etc and am now trying to do the same with Excel.

    I have found code online which has allowed me to make use of the winmm.dll from windows to be able to create a WAV sound file from excel and also to be able to play them. Now i can record and play sounds i need to be able to read the data in the WAV files and perform Fourier analysis etc.

    Has anyone done this or have any code which i can implement to do this?

    Kind regards,

    Barrett.
     
  2. jcsd
  3. Jun 21, 2008 #2

    mgb_phys

    User Avatar
    Science Advisor
    Homework Helper

    Not that I can think of, first step would probably be to find some utility or write something to turn wav into text, just numbers in a csv file.
    One other problem, CD quality WAV is 44,000 values/second/per channel - Excel is going to struggle trying to do anything with that many rows.
     
    Last edited: Jun 21, 2008
  4. Jun 21, 2008 #3
    Yea good point...

    I think MATLAB has a bigger master array and thats why this was never an issue there.

    Perhaps what i need to think about is writing something that converts from WAV to txt but decimates a WAV file into excel sized chunks of txt for importation.

    Do you know of any code that i can get that would convert WAV to txt?

    Kind regards,

    Barrett.
     
  5. Nov 25, 2009 #4
    the sox program can do the conversion.

    See:

    http://www.integratedprocess.com/sigproc.html

    and

    http://sox.sourceforge.net/
     
  6. Nov 25, 2009 #5
    I believe 65k is the maximum number of rows. As pointed out, CD-quality audio has 44K*16b/second.

    Now, the beta version of 64bit excel might be able to go higher, or you may find clever way's of encoding your data (for example, 1 column per second will give you 65,000 seconds), but I think the bottom line is that excel is written for basic business purposes. If you need to do statistical analysis of large amounts of data, or store large database records, you are better off using a database or scientific program that was designed with analyzing large amounts of data: Matlab, Mathematica, Access, SQL, et cetera.
     
  7. Dec 15, 2009 #6
    Hi, vociferous. I wouldn't even begin to try it, not because Excell can't handle it, but because it can't handle it well at all.

    If you're looking to perform fourier transforms, or analyis on acoustical data, I suspect you're not talking about just one second's worth, right?

    Even if not, you might cram that into 64-bit Excell. Don't know for sure, though, as I've not played with it, yet. Yes, MatLab is a more obvious solution, as it's headroom stems from loftier goals (and better programming).

    Thus:

    1. You might try 64-bit Excel. If it works, terrific!

    2. If it doesn't, try MatLab.

    3. If that doesn't, repost the quest and let someone who knows more than I do help you find a solution. I'm pretty good at running through and eliminating the logical steps at this stage, but not much more.
     
  8. Jan 4, 2012 #7
    I read a wav file using sox and I got the following output

    ; Sample Rate 22050
    ; Channels 1
    0 -0.0234375
    4.5351474e-005 -0.0234375
    9.0702948e-005 -0.0234375
    0.00013605442 -0.0234375
    0.0001814059 -0.0234375
    0.00022675737 -0.0234375
    0.00027210884 -0.0234375
    0.00031746032 -0.0234375
    0.00036281179 -0.0234375
    0.00040816327 -0.0234375
    0.00045351474 -0.0234375
    0.00049886621 -0.0234375
    0.00054421769 -0.0078125
    0.00058956916 -0.0234375
    0.00063492063 -0.0234375
    0.00068027211 -0.0234375
    0.00072562358 -0.0234375
    0.00077097506 -0.0234375
    0.00081632653 -0.0234375
    0.000861678 -0.0234375
    0.00090702948 -0.015625

    Can someone help me in interpreting this information obtained. The first field I understood was time. What is the second field? If its amplitude, then why is it in fractions? What is the unit? I need to compress and reconstruct another wav file. So what unit should I consider?

    Thanks
     
  9. Jan 4, 2012 #8

    Borek

    User Avatar

    Staff: Mentor

  10. Jan 7, 2012 #9
    the first field is time, and it increments in 1/frequency.
    The second field is the amplitude. Digital audio always has an amplitude between -1 and 1. THe units are dB, however dB is a pure logarithmic unit. Its a unit, but its not actually there. Kind of like radians
     
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook

Have something to add?



Similar Discussions: Reading WAV as data/numbers into Excel
Loading...