I wrote a program on Windows that will play the binary sound sent to it via stdin, I called it aplay (for example, the linux program). Then I wrote a separate 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 does not seem to work in binary mode because the sound is out of order. If I change my iple to open the wave file on its own 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?
source
share