Noob MATLAB Question - Importing Data

  • Thread starter Thread starter GreenPrint
  • Start date Start date
  • Tags Tags
    Data Matlab Noob
Click For Summary

Discussion Overview

The discussion revolves around a MATLAB homework problem involving the importation of sound files into a program. Participants are troubleshooting issues related to audio codecs and file formats, specifically focusing on the error encountered when using the wavread function with certain sound files.

Discussion Character

  • Homework-related
  • Technical explanation
  • Debate/contested

Main Points Raised

  • One participant reports an error when attempting to read a WAV file using wavread, indicating that the data compression format is not supported.
  • Another participant suggests checking for the presence of audio codec #85 as a potential solution to the error.
  • Subsequent replies indicate that even after installing the codec, the error persists, leading to speculation about installation issues or MATLAB's compatibility with the codec.
  • Participants discuss the possibility that the audio file may be in a format that wavread does not expect, suggesting that the number of channels or the format of the recorded data could be problematic.
  • One participant proposes converting the WAV file to a different format to test if the issue lies with the file format itself.
  • Another participant shares a workaround involving converting the WAV file to a PCM format using Microsoft Sound Recorder or a third-party converter, stating that the original file's compression may be incompatible with wavread.
  • There are mentions of trying different audio files and formats, including .AU files, but encountering similar issues with unrecognized data.
  • One participant notes that after converting the file online, they still receive numerical data when attempting to read the file, prompting questions about the command used to play the audio.
  • Another participant advises on how to visualize the data to determine if it represents a voice signal and inquires about the command being used to play the audio.

Areas of Agreement / Disagreement

Participants express a range of views regarding the source of the problem, with some attributing it to codec issues, while others suggest it may be related to the file format or MATLAB's handling of the data. No consensus is reached on a definitive solution.

Contextual Notes

Participants mention various audio files and codecs, but there is uncertainty regarding the specific requirements for file formats and the compatibility of MATLAB with different audio codecs. The discussion includes attempts to troubleshoot installation issues and file conversions without resolving the underlying problem.

Who May Find This Useful

This discussion may be useful for MATLAB users encountering issues with importing audio files, particularly those dealing with codec compatibility and file format challenges in programming contexts.

GreenPrint
Messages
1,186
Reaction score
0

Homework Statement



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 . 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."

Homework Equations





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

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:
Physics news on Phys.org
Do you have audio codec #85? If not: http://www.updatexp.com/audio-codec-tag-85.html
 
Last edited by a moderator:
No. After installing it though I still get the same result.

I think I may be having installation issues.
 
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...
 

Attachments

  • Capture.JPG
    Capture.JPG
    36.8 KB · Views: 545
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
 

Attachments

  • Capture.JPG
    Capture.JPG
    49.5 KB · Views: 581
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:
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
 

Attachments

  • Capture.JPG
    Capture.JPG
    13 KB · Views: 527
So I'm wondering if that was the correct program?
 
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.
 
  • #10
well I tried this file instead
http://www.wav-sounds.com/answering_machine/rappin.wav
and the same thing occurred

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

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
 

Attachments

  • Capture.JPG
    Capture.JPG
    29.4 KB · Views: 702
Last edited by a moderator:
  • #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:
  • #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.
 
  • #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...
 
  • #14
and my speakers are working fine...
I also tried this just get a whole bunch of numbers>> [data,fs]=wavread('kill_wabbit2.wav')
 
  • #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:
  • #16
thanks =)
 

Similar threads

  • · Replies 3 ·
Replies
3
Views
3K
  • · Replies 2 ·
Replies
2
Views
3K
  • · Replies 12 ·
Replies
12
Views
4K
  • · Replies 3 ·
Replies
3
Views
3K
  • · Replies 3 ·
Replies
3
Views
3K
  • · Replies 7 ·
Replies
7
Views
4K
  • · Replies 1 ·
Replies
1
Views
9K
  • · Replies 1 ·
Replies
1
Views
3K
  • · Replies 1 ·
Replies
1
Views
3K
Replies
2
Views
8K