question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Writing OGG produces an empty file

See original GitHub issue

I don’t know if I’m doing something wrong, but this produces an OGG file with zero frames:

import soundfile as sf
import numpy as np
a = np.empty(100000)
sf.write(a, 'delme.ogg', 44100)

This doesn’t seem to depend on my libsndfile binary, since the same error happens both on Debian Linux and on Windows XP 32bit. To be sure, I compiled a little test program in C, which correctly writes a non-empty OGG file (this I tried only on Linux), so it cannot really be related to my installed version of libsndfile, or can it?

Any ideas what’s wrong?

Can anybody write OGG files with PySoundFile?

Reading OGGs works perfectly, BTW … Writing other formats, too …

Issue Analytics

  • State:open
  • Created 8 years ago
  • Reactions:3
  • Comments:20 (7 by maintainers)

github_iconTop GitHub Comments

2reactions
bastibecommented, Feb 3, 2021

You can query soundfile.__libsndfile_version__ to get the version of soundfile you are using.

By the way, you say you are using “PySoundFile”, which is severely outdated. Please install “soundfile” instead, which is the current version.

0reactions
RonaldAJcommented, Sep 14, 2021

I seem to have the same problem using libsndfile1 1.0.28-7ubuntu0.1 with soundfile.__version__: 0.10.3.post1.

I see no easy option for downgrading libsndfile1 to 1.0.27.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Writing OGG produces an empty file · Issue #130 - GitHub
I don't know if I'm doing something wrong, but this produces an OGG file with zero frames: import soundfile as sf import numpy...
Read more >
Why redirecting output sometimes produces an empty file?
This means that for cat file > file , the output redirection (which truncates the file) occurs before cat is spawned, and cat...
Read more >
writing to file produces an empty file or no file at all
I tried to add: int fileLength = myFile.GetLength(); and see fileLength gets the correct length, but even then the file is removed /...
Read more >
Create an empty file using Python - GeeksforGeeks
Write Only ('w'): Open the file for writing. For an existing file, the data is truncated and over-written. Write and Read ('w+'): Open...
Read more >
5 Ways to Empty or Delete a Large File Content in Linux
5 Ways to Empty or Delete a Large File Content in Linux · 1. Empty File Content by Redirecting to Null · 2....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found