Hi,
How do I modify an audio file( say mp3 or wav) using c# .
I want to compare 2 audio files if they are same..
Also if someone could tell me how to record an audio using code would be great...

Recommended Answers

All 12 Replies

you can treat them as text files and compare the content of them. or treat them as binary files and read some amount of bytes in each iteration and compare the read values.
i dont understand why it requires big algorithms as Ramy suggested.

If you have big identical in size audio files 10+ MB it's not good to compare files + what about if files in different format?? how to compare + MATLAB researchers really do great work in such field in performance perspective and so on.

if two sound files are different, it will show the difference starting from the very beginning. so if it is 10 mgbytes, even reading the first 30 bytes will differ if the files are different. about formatting, of course you cant compare wav to mp3, but i think he is not asking for that either.

Bravo Serkan but
1- If the different in the last byte
2- I have program to convert to different types the input was file and it produces .mp3 and .wmv your program should say they are identical because when you compare strings you compare characters and when you compare sounds you compare signals.

i know but those signals are represented in a binary form. the difference cant be on the last portion. think these files as the music you listen to. have you ever heard two songs having differences at the end? compare Forbidden City to Dragon Mistress or Luna to Loneliness or Mama to Air. Or compare Marty Friedman to any other composer, do you need to listen to the end to tell the difference?

Serkan you're developing not just playing :) in sometimes I need to compare a lot of files dozens of files what makes me hear if I need to know if file hasn't the full track and some dozens of reasons I've to compare by the signals. they just can take the most proper solution mine or yours.

Hi, thanks for the replies
I want to compare only two small files may be about 10 to 15 seconds long..so what would be the ideal option..
Also I have a little knowledge of programming in matlab.
So can we make a dll in matlab and how to call it from c# code ??

If they are small files return back to Serkan methodology.

Respect my Authority!!! :D :D

Hai, Ramy
More inof on Matlab please...

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.