1. Limited time only! Sign up for a free 30min personal tutor trial with Chegg Tutors
    Dismiss Notice
Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Noob MATLAB Question - Importing Data

  1. Jul 4, 2011 #1
    1. The problem statement, all variables and given/known data

    Search the internet for some fun sound bytes to include in your programs. Two sources are http://www.wavcentral.com and http://www/wavsource.com [Broken]. Import the sound byte and use it in an appropriate sport in your program. For example, end your program with Elmer Fudd singing "Kill the Wabbit."

    2. Relevant equations



    3. The attempt at a solution

    So I located a file that I wanted to use, downloaded it the current directory with all my other MATLAB files.

    http://www.wavsource.com/snds_2011-07-03_6218469021342645/tv/looney_tunes/kill_wabbit2.wav [Broken]

    but when I input the following command I get an error

    y=wavread( 'kill_wabbit2.wav' )
    ??? Error using ==> wavread at 166
    Data compression format (Format #85) is not supported.

    I was wondering what exactly it is that I'm doing wrong and how to produce the results that the problem was expecting me to because it appears that I did something wrong.
     
    Last edited by a moderator: May 5, 2017
  2. jcsd
  3. Jul 4, 2011 #2

    ideasrule

    User Avatar
    Homework Helper

    Do you have audio codec #85? If not: http://www.updatexp.com/audio-codec-tag-85.html [Broken]
     
    Last edited by a moderator: May 5, 2017
  4. Jul 4, 2011 #3
    No. After installing it though I still get the same result.

    I think I may be having installation issues.
     
  5. Jul 4, 2011 #4
    I get this window to come up but the folder that it installs the files to is apparently empty.
    Wait I take that back it's not empty...
     

    Attached Files:

  6. Jul 4, 2011 #5
    This is what it put into the installation file. It would seem to have installed correctly yet I'm still getting the same results when I try to run that commands in MATLAB
     

    Attached Files:

  7. Jul 4, 2011 #6
    I however don't think it's something wrong with my pc just that there's something wrong with MATLAB or that I don't have a certain codec or something. If it's something wrong with my laptop what exactly is causing it not to install correctly and how do I resolve that issue so that way I can get MATLAB to run that command without getting an error message?
     
    Last edited by a moderator: Jul 5, 2011
  8. Jul 5, 2011 #7
    Alright well I uninstalled the program from my computer. I tried rerunning it in comparability mode with Windows 95, thought maybe it had a problem installing on Vista or something, but the same results happen. Also this is the window that pops up after I try to close the window that comes up in my third post. Clicking on resume just does nothing but leave me at the window in my third post in this topic so the only thing I can do is click exit which closes the window
     

    Attached Files:

  9. Jul 5, 2011 #8
    So I'm wondering if that was the correct program?
     
  10. Jul 5, 2011 #9
    Something to consider:

    Sometimes audio is taken in two channels, or one channel, or simply puts the recorded data in a different format then what the matlab mfile that reads it is expecting. This can obviously, at times, cause problems during the read.

    Have you stepped into the actual matlab mfile that does the reading? The format of the incoming data could be what is wrong. Another way of testing this would be getting waveform files from a different source and seeing if the same error comes up.

    A secondary, indirect solution would be to convert your wav file to a different format, then try to input the data once more. This would shed light on whether or not format is an issue.

    I would try these things first before dealing with re-installations and codecs.
     
  11. Jul 5, 2011 #10
    well I tried this file instead
    http://www.wav-sounds.com/answering_machine/rappin.wav
    and the same thing occured

    and no I haven't stepped into the actual matlab mfile that does the reading

    ok I tried a different format, the only other format that I'm aware that matlab can read is .au so I download this file
    http://simplythebest.net/sounds/other_formats/Sun_Audio/sound_effects_AU/sound_effect_AU_files/bird_1.au [Broken]

    sense i don't know the command to directly read it I tried importing it
    file->Import Data...-> clicked on the file

    and the window in the attachments came up

    I tried doing the same with both .wav files but some window comes up with the message
    uniterpertable data
     

    Attached Files:

    Last edited by a moderator: May 5, 2017
  12. Jul 6, 2011 #11
    Okay, I actually sat down and tried it. It was definitely a codec problem. Once I downloaded the codec already linked on this topic, it worked for me. But if you can't get that to work for some reason or another here's a way I got around it - it's a bit unsophisticated though.

    If you open the file in Microsoft sound recorder and then go "file -> properties -> convert now" you can change the wav file to a PCM format. Or if your particular version of Microsoft Sound Recorder doesn't have this option you can download Switch Sound File Converter and open the wav file and convert it to a wav file, but with the option chosen of "PCM Uncompressed" under encoder options. Your problem is that, while your wav file is the correct type of file, it is compressed in a fashion that wavread is not able to process. This often happens when downloading files from the internet which have their own stipulations on compression. If, say, you were to make this wav file from Matlab and then upload it, this problem would not occur. It's all about the compression options. Either way, converting it thus will avoid your problem. Open it in matlab and you should be fine.
     
    Last edited: Jul 6, 2011
  13. Jul 6, 2011 #12
    Hi Ecthelion,

    Thanks for your help. I'm going to see if I can get it to work. I take it you mean the Switch Sound File Converter? I can't seem to find the recorder. My version of Microsoft Sound Recorder doesn't allow me to open files just record.
     
  14. Jul 6, 2011 #13
    So I just converted it online sense I was having troubles. It seems to work fine but when I input this command
    y=wavread('kill_wabbit')
    a whole bunch of numbers just shows up...
    lets see...
     
  15. Jul 6, 2011 #14
    and my speakers are working fine...
    I also tried this just get a whole bunch of numbers


    >> [data,fs]=wavread('kill_wabbit2.wav')
     
  16. Jul 6, 2011 #15
    Graph the numbers. Does it look like a voice signal? Are the values high enough to produce a sound?

    I'm assuming you're trying to play the wavefile - what command are you using? All wavread is doing is importing the data. Type in "doc wavread" and look at the options the article presents in and at the end to play the data.
     
    Last edited: Jul 6, 2011
  17. Jul 6, 2011 #16
    thanks =)
     
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook




Similar Discussions: Noob MATLAB Question - Importing Data
  1. Matlab question (Replies: 2)

  2. Matlab question (Replies: 1)

Loading...