Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sndfile-mix-to-mono doesn't produce an output file #87

Open
markk opened this issue Jan 29, 2023 · 3 comments · May be fixed by #92
Open

sndfile-mix-to-mono doesn't produce an output file #87

markk opened this issue Jan 29, 2023 · 3 comments · May be fixed by #92

Comments

@markk
Copy link

markk commented Jan 29, 2023

strace shows the output file being unlinked after being opened.

$ sox -n noise.wav synth 1 whitenoise channels 2
$ soxi noise.wav

Input File     : 'noise.wav'
Channels       : 2
Sample Rate    : 48000
Precision      : 32-bit
Duration       : 00:00:01.00 = 48000 samples ~ 75 CDDA sectors
File Size      : 384k
Bit Rate       : 3.07M
Sample Encoding: 32-bit Signed Integer PCM

$ strace sndfile-mix-to-mono noise.wav noise-mono.wav &> test.txt

test.txt

@markk
Copy link
Author

markk commented Jan 29, 2023

Note that writing to stdout works:

sndfile-mix-to-mono noise.wav - > noise-mono.wav

... but that is not what --help describes as the correct usage.

@evpobr
Copy link
Member

evpobr commented Jan 31, 2023

Hi @markk . Thanks for report.

@janstary
Copy link

This is the culprit:

 /* Delete the output file length to zero if already exists. */
 remove (argv [argc - 1]);

Note the confusing comment: perhaps it used to truncate the file to zero if it existed;
now it unlinks the file from the filesystem, which means it will get removed once the program terminates.

Apparently, there is no reason to do that: if it exists, it will get overwritten.
Even if the one that exists is longer, it will get (correctly) overwritten by a new shorter one,
i.e. it is not like the rest of the old long one remains.

So a trivial fix is to just not do this.

@janstary janstary linked a pull request May 22, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants