I wrote a program in windows that will play binary audio sent to it over stdin, I called it aplay(like the linux program). I then wrote a seperate program as follows
FILE * f = popen("aplay.exe", "wb");
FILE * song = fopen("C:/Users/Ray/Dropbox/DJ Automica 2/Debug/raymonster 5.wav", "rb");
while(1)
{
byte buff[4096];
fread(buff, 4, 1024, song);
fwrite(buff, 4, 1024, f);
}
For some reason, the pipe doesn’t seem to be working in binary mode, because the audio is coming out all messed up. If I change my aplay to open the wave file by itself in text mode it sounds the same as when I do it through the pipe, if I open the wave file in binary mode it plays perfectly. Does anyone know how I can fix this?
If you include the header files
you can switch modes with