Splitting of wav files

Please support our C# advertiser: Intel Parallel Studio Home
Reply

Join Date: May 2008
Posts: 17
Reputation: sireesha.c is an unknown quantity at this point 
Solved Threads: 0
sireesha.c sireesha.c is offline Offline
Newbie Poster

Splitting of wav files

 
0
  #1
Jan 7th, 2009
Hi,

i am working on splitting .wav files with bitrate 13 kbps,mono,
sample rate 8 khz and audio format GSM 6.10.my code is like this


private void SplitFile(string FileInputPath, string FolderOutputPath, int OutputFiles)
{

string inputFile = FileInputPath; // Substitute this with your Input File
FileStream fs = new FileStream(inputFile, FileMode.Open, FileAccess.Read);
int numberOfFiles = Convert.ToInt32(OutputFiles);
int sizeOfEachFile = (int)Math.Ceiling((double)fs.Length / numberOfFiles);

for (int i = 1; i <= numberOfFiles; i++)
{
string baseFileName = Path.GetFileNameWithoutExtension(inputFile);
string extension = Path.GetExtension(inputFile);
FileStream outputFile = new FileStream(Path.GetDirectoryName(inputFile) + "\\" + baseFileName + "." + i.ToString().PadLeft(5, Convert.ToChar("0")) + "." + extension, FileMode.Create, FileAccess.Write);
int bytesRead = 0;
byte[] buffer = new byte[sizeOfEachFile];

if ((bytesRead = fs.Read(buffer, 0, sizeOfEachFile)) > 0)
{
outputFile.Write(buffer, 0, bytesRead);
}
outputFile.Close();
}
fs.Close();


using this code the second splitting file is not playing and giving error like Codec data corrupted error.
Reply With Quote Quick reply to this message  
Join Date: Aug 2008
Posts: 1,735
Reputation: LizR has a spectacular aura about LizR has a spectacular aura about 
Solved Threads: 186
LizR LizR is offline Offline
Posting Virtuoso

Re: Splitting of wav files

 
0
  #2
Jan 7th, 2009
probably because wav files have a header - to tell them the speed, etc
Did I just hear "You gotta help us, Doc. We've tried nothin' and we're all out of ideas" ? Is this you? Dont let this be you! I will put in as much effort as you seem to.
Reply With Quote Quick reply to this message  
Join Date: May 2008
Posts: 17
Reputation: sireesha.c is an unknown quantity at this point 
Solved Threads: 0
sireesha.c sireesha.c is offline Offline
Newbie Poster

Re: Splitting of wav files

 
0
  #3
Jan 7th, 2009
Actually the .wav file have some properties like Audio formate-gsm 6.10,Audio sample rate 8KHz ,channels 1 mono,Bit Rate 13 kbps. so using this we have to split
plz tel me the request i will post
Reply With Quote Quick reply to this message  
Join Date: Aug 2008
Posts: 1,735
Reputation: LizR has a spectacular aura about LizR has a spectacular aura about 
Solved Threads: 186
LizR LizR is offline Offline
Posting Virtuoso

Re: Splitting of wav files

 
0
  #4
Jan 7th, 2009
exactly - do a google on wav file headers.
Did I just hear "You gotta help us, Doc. We've tried nothin' and we're all out of ideas" ? Is this you? Dont let this be you! I will put in as much effort as you seem to.
Reply With Quote Quick reply to this message  
Join Date: May 2008
Posts: 17
Reputation: sireesha.c is an unknown quantity at this point 
Solved Threads: 0
sireesha.c sireesha.c is offline Offline
Newbie Poster

Re: Splitting of wav files

 
0
  #5
Jan 7th, 2009
Hi LiZR,

Give me ur gmailid i will send u the audio file which i have to split and now i am searching abt file headers

sireesha
Reply With Quote Quick reply to this message  
Join Date: Aug 2008
Posts: 1,735
Reputation: LizR has a spectacular aura about LizR has a spectacular aura about 
Solved Threads: 186
LizR LizR is offline Offline
Posting Virtuoso

Re: Splitting of wav files

 
0
  #6
Jan 7th, 2009
No, Im not giving anyone contact info - nor am I likely to be writing your code for you. I have my own coding to do.
Did I just hear "You gotta help us, Doc. We've tried nothin' and we're all out of ideas" ? Is this you? Dont let this be you! I will put in as much effort as you seem to.
Reply With Quote Quick reply to this message  
Join Date: May 2008
Posts: 17
Reputation: sireesha.c is an unknown quantity at this point 
Solved Threads: 0
sireesha.c sireesha.c is offline Offline
Newbie Poster

Re: Splitting of wav files

 
0
  #7
Jan 7th, 2009
Hi LizR,

Ok.Then give me the hint is the way i am trying to split wav file is correct or not.for some .wav files it is splitting correctly and playing two files and some files it is splittings but error in playing second file.And Give me any supporting links to do this task.

Thanks,
Sireesha
Reply With Quote Quick reply to this message  
Join Date: Aug 2008
Posts: 1,735
Reputation: LizR has a spectacular aura about LizR has a spectacular aura about 
Solved Threads: 186
LizR LizR is offline Offline
Posting Virtuoso

Re: Splitting of wav files

 
0
  #8
Jan 7th, 2009
no. Im not your mother, i wont do it for you.
Look on google yourself
Did I just hear "You gotta help us, Doc. We've tried nothin' and we're all out of ideas" ? Is this you? Dont let this be you! I will put in as much effort as you seem to.
Reply With Quote Quick reply to this message  
Join Date: Oct 2009
Posts: 2
Reputation: riteshdalvi is an unknown quantity at this point 
Solved Threads: 0
riteshdalvi riteshdalvi is offline Offline
Newbie Poster
 
0
  #9
Oct 9th, 2009
plz help to read and split wav file in c#
Reply With Quote Quick reply to this message  
Join Date: Jul 2009
Posts: 886
Reputation: DdoubleD is a jewel in the rough DdoubleD is a jewel in the rough DdoubleD is a jewel in the rough DdoubleD is a jewel in the rough 
Solved Threads: 140
DdoubleD DdoubleD is offline Offline
Practically a Posting Shark
 
0
  #10
Oct 9th, 2009
This download demonstrates how to read/write wave file headers: Wave File Headers...
Reply With Quote Quick reply to this message  
Reply

Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC