C Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me

The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.

Go Back   Dev Shed ForumsProgramming LanguagesC Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old September 12th, 2012, 03:47 AM
mahaju mahaju is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Nov 2010
Posts: 120 mahaju User rank is Sergeant (500 - 2000 Reputation Level)mahaju User rank is Sergeant (500 - 2000 Reputation Level)mahaju User rank is Sergeant (500 - 2000 Reputation Level)mahaju User rank is Sergeant (500 - 2000 Reputation Level)mahaju User rank is Sergeant (500 - 2000 Reputation Level) 
Time spent in forums: 1 Day 2 h 17 m 3 sec
Reputation Power: 20
C program about enhancing speech in wav file

Hi
I am trying to analyze a program that enhances speech in a noisy wav file sample
The final result has the correct wav file header and is exactly like the original one
However the final file is a few hundred bytes shorter than the original which I think should be equal in length
However, when I try to play the wav file Windows Media Player says it cannot play this file
What could be the reason?
I can plot both the wav files in Matlab and there is definitely sound in the created file
And since the header is exactly the same as the original shouldn't it be playable?

Reply With Quote
  #2  
Old September 12th, 2012, 04:34 AM
salem's Avatar
salem salem is offline
Contributed User
Click here for more information
 
Join Date: Jun 2005
Posts: 3,839 salem User rank is General 12nd Grade (Above 100000 Reputation Level)salem User rank is General 12nd Grade (Above 100000 Reputation Level)salem User rank is General 12nd Grade (Above 100000 Reputation Level)salem User rank is General 12nd Grade (Above 100000 Reputation Level)salem User rank is General 12nd Grade (Above 100000 Reputation Level)salem User rank is General 12nd Grade (Above 100000 Reputation Level)salem User rank is General 12nd Grade (Above 100000 Reputation Level)salem User rank is General 12nd Grade (Above 100000 Reputation Level)salem User rank is General 12nd Grade (Above 100000 Reputation Level)salem User rank is General 12nd Grade (Above 100000 Reputation Level)salem User rank is General 12nd Grade (Above 100000 Reputation Level)salem User rank is General 12nd Grade (Above 100000 Reputation Level)salem User rank is General 12nd Grade (Above 100000 Reputation Level)salem User rank is General 12nd Grade (Above 100000 Reputation Level)salem User rank is General 12nd Grade (Above 100000 Reputation Level)salem User rank is General 12nd Grade (Above 100000 Reputation Level)  Folding Points: 153 Folding Title: Novice Folder
Time spent in forums: 2 Months 3 Weeks 2 Days 19 h 1 m 4 sec
Reputation Power: 1774
You could try other media players, such as VLC

> And since the header is exactly the same as the original shouldn't it be playable?
Maybe WMP also checks that the size stated in the header is consistent with the overall file length.

> However the final file is a few hundred bytes shorter than the original which I think should be equal in length
Well then, check your code.
One thing to check would be whether you opened the files in binary mode.

For example, if you read a wav file in text mode on windows, then all the 0x0D bytes will be silently dropped.
__________________
If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
If at first you don't succeed, try writing your phone number on the exam paper

Reply With Quote
  #3  
Old September 12th, 2012, 06:33 AM
mahaju mahaju is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Nov 2010
Posts: 120 mahaju User rank is Sergeant (500 - 2000 Reputation Level)mahaju User rank is Sergeant (500 - 2000 Reputation Level)mahaju User rank is Sergeant (500 - 2000 Reputation Level)mahaju User rank is Sergeant (500 - 2000 Reputation Level)mahaju User rank is Sergeant (500 - 2000 Reputation Level) 
Time spent in forums: 1 Day 2 h 17 m 3 sec
Reputation Power: 20
I meant only the header is exactly similar, the final file has to be different than the original one
However header being exactly similar would imply it contains the same information about the length of the file and the processed file is definitely a few 100 bytes shorter
I had assumed I would probably hear some garbage value noise because of them, but Windows Media Player just didn't play it

Reply With Quote
  #4  
Old September 12th, 2012, 07:32 AM
salem's Avatar
salem salem is offline
Contributed User
Click here for more information
 
Join Date: Jun 2005
Posts: 3,839 salem User rank is General 12nd Grade (Above 100000 Reputation Level)salem User rank is General 12nd Grade (Above 100000 Reputation Level)salem User rank is General 12nd Grade (Above 100000 Reputation Level)salem User rank is General 12nd Grade (Above 100000 Reputation Level)salem User rank is General 12nd Grade (Above 100000 Reputation Level)salem User rank is General 12nd Grade (Above 100000 Reputation Level)salem User rank is General 12nd Grade (Above 100000 Reputation Level)salem User rank is General 12nd Grade (Above 100000 Reputation Level)salem User rank is General 12nd Grade (Above 100000 Reputation Level)salem User rank is General 12nd Grade (Above 100000 Reputation Level)salem User rank is General 12nd Grade (Above 100000 Reputation Level)salem User rank is General 12nd Grade (Above 100000 Reputation Level)salem User rank is General 12nd Grade (Above 100000 Reputation Level)salem User rank is General 12nd Grade (Above 100000 Reputation Level)salem User rank is General 12nd Grade (Above 100000 Reputation Level)salem User rank is General 12nd Grade (Above 100000 Reputation Level)  Folding Points: 153 Folding Title: Novice Folder
Time spent in forums: 2 Months 3 Weeks 2 Days 19 h 1 m 4 sec
Reputation Power: 1774
> I am trying to analyze a program that enhances speech in a noisy wav file sample
So does this process remove samples from the file or not?

If it's just processing the file and adjusting all the samples, then the header will be the same, and the file will be the same length.

If (by design), the enhancement deletes samples, then the header file CANNOT be "exactly similar" (which is an oxymoron), and the file will be shorter.

If the header of the file says that there are 1000 samples in the file, and it only contains 990 (because the file isn't large enough to hold 1000), then WMP is perfectly entitled to believe the file is corrupt and not do anything.

You need to figure out which part of your overall process is screwing up. A stronger check on the validity of your WAV header would be a start.
Like for example, if you've made the file shorter, that subchunk2size has been updated.

Reply With Quote
  #5  
Old September 12th, 2012, 08:02 AM
mahaju mahaju is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Nov 2010
Posts: 120 mahaju User rank is Sergeant (500 - 2000 Reputation Level)mahaju User rank is Sergeant (500 - 2000 Reputation Level)mahaju User rank is Sergeant (500 - 2000 Reputation Level)mahaju User rank is Sergeant (500 - 2000 Reputation Level)mahaju User rank is Sergeant (500 - 2000 Reputation Level) 
Time spent in forums: 1 Day 2 h 17 m 3 sec
Reputation Power: 20
I am not sure whether it deletes samples or not
like I mentioned I am still analysing it
However from what I have understood till now it just takes the sound file data, passes it through some fft routines and filters, then performs iffts and writes it to a new wav file
It copies the exact header from the old file into the new file that's how I know the header will show the same length for both files
However I know from windows explorer and file properties that the new file is coming out to be a few hundred bytes shorter than the old one
This could be the reason why Media Player crashes but I am still not sure
I thought the player would just play the garbage values as sound since the file isn't actually longer than that specified in the header

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming LanguagesC Programming > C program about enhancing speech in wav file

Developer Shed Advertisers and Affiliates



Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.

© 2003-2013 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap