943,696 Members | Top Members by Rank

Ad:
  • C# Discussion Thread
  • Unsolved
  • Views: 2505
  • C# RSS
Jan 7th, 2009
0

Splitting of wav files

Expand Post »
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.
Reputation Points: 10
Solved Threads: 0
Newbie Poster
sireesha.c is offline Offline
17 posts
since May 2008
Jan 7th, 2009
0

Re: Splitting of wav files

probably because wav files have a header - to tell them the speed, etc
Reputation Points: 196
Solved Threads: 190
Posting Virtuoso
LizR is offline Offline
1,735 posts
since Aug 2008
Jan 7th, 2009
0

Re: Splitting of wav files

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
Reputation Points: 10
Solved Threads: 0
Newbie Poster
sireesha.c is offline Offline
17 posts
since May 2008
Jan 7th, 2009
0

Re: Splitting of wav files

exactly - do a google on wav file headers.
Reputation Points: 196
Solved Threads: 190
Posting Virtuoso
LizR is offline Offline
1,735 posts
since Aug 2008
Jan 7th, 2009
0

Re: Splitting of wav files

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
Reputation Points: 10
Solved Threads: 0
Newbie Poster
sireesha.c is offline Offline
17 posts
since May 2008
Jan 7th, 2009
0

Re: Splitting of wav files

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.
Reputation Points: 196
Solved Threads: 190
Posting Virtuoso
LizR is offline Offline
1,735 posts
since Aug 2008
Jan 7th, 2009
0

Re: Splitting of wav files

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
Reputation Points: 10
Solved Threads: 0
Newbie Poster
sireesha.c is offline Offline
17 posts
since May 2008
Jan 7th, 2009
0

Re: Splitting of wav files

no. Im not your mother, i wont do it for you.
Look on google yourself
Reputation Points: 196
Solved Threads: 190
Posting Virtuoso
LizR is offline Offline
1,735 posts
since Aug 2008
Oct 9th, 2009
0
Re: Splitting of wav files
plz help to read and split wav file in c#
Reputation Points: 10
Solved Threads: 0
Newbie Poster
riteshdalvi is offline Offline
2 posts
since Oct 2009
Oct 9th, 2009
0
Re: Splitting of wav files
This download demonstrates how to read/write wave file headers: Wave File Headers...
Reputation Points: 341
Solved Threads: 233
Posting Shark
DdoubleD is offline Offline
984 posts
since Jul 2009

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in C# Forum Timeline: Counting instances of a value in DB
Next Thread in C# Forum Timeline: Dockable windows (just like in Visual Stusio)





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC