Hello peeps, This may sound a bit of a strange request but I am an electronic engineer who's not very good with programming. I am, if anyone can help, looking to write an ANSI C program which will mix two audio wav files together. The program should operate in a DOS console and simply request both the input files, the percentage mix and the output filename. I'm really into my audio and have just never been able to work out how to do it, if anyone knows of any code I could use or knows of where I could start looking it would be much apopreciated. Kind regards........
The hard part of this is going to be figuring out how to read and write wave files. If you have some kind of library that'll make it easier, otherwise you'll need to research the file structure and work out how to write code to read and write files in the appropriate structure. After that it's easy, if the files represent the same data rate. The output amplitude at a given time is just the sum of the amplitude values of the input files at that same time. Watch out for overflows, and decide what to do if the files are not the same length. Work in higher precision than the input files, for example if they're 16 or 24-bit audio, use 32-bit integers. Convert the percentage mix into integer (e.g. 75 for 75%) then multiply values by 100 and divide by the value; the headroom you have will easily accommodate this even if you're mixing several files together. When checking for overflows, use something like if (MAXVALUE-a)<b rather than trying to figure out if a+b overflows. This keeps the calculations within the same precision. (i.e. if a and b are 16 bit, you can't check in 16 bits if a+B>65535, you would have to upconvert to 32 bits. But you can check if 65535-a<b within 16 bits).
Hi Im trying to create a composition consisting of four sounds and am trying to find some simple music mixing software that will allow me to do such a thing, but I have NO idea what to use. Can any one suggest any thing??? Regards Dave