Skip to content
This repository has been archived by the owner on Mar 16, 2021. It is now read-only.

Spurious 0x0d bytes (Carriage returns) injected into PCM stdout stream (Windows) #287

Open
williamsharkey opened this issue Mar 21, 2019 · 0 comments

Comments

@williamsharkey
Copy link
Contributor

williamsharkey commented Mar 21, 2019

When using output set to stdout, on Windows mrswatson is inserting extra bytes compared to outputting pcm -o output.pcm.

The extra bytes seem to be all 0x0d, Carriage return.

The extra bytes make the stdout file have crackling noise artifacts.
I am not sure the cause, but suspect it might have to do with flushing the log writer with newlines, (though the newline character is not the same a carriage return, it is the only think I can think of). see:

void flushLog(FILE *logFile) {

I put together a test case to show this. Run generate.bat to regenerate the files. After generating the pcm files both ways, I append 44 bytes of a wav header. Appending the bytes make the normally outputted pcm file match the wav file exactly. The stdout pcm file does not match and you can hear the extra crackle by listening to header_stdout.wav
diff

This zipfile contains a generate.bat , midimake.exe, head.exe, a vst instrument dll and mrswatson.exe to recreate the issue on windows. It should be enough to click generate.bat. midimake is a simple utility I made that makes a midi file based on the note numbers passed as arguments. head.exe is a simple utility I made that returns the first n bytes of a file.
pcmStdoutRecreateNoise.zip

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant