## Which audio file format gives smallest size for silent tracks?

4

I want to make a bunch of silent audio files (of different lengths: A few seconds up to some minutes), just to but them into playlists and so on in order to have silent times in between.

I am wondering which audio file format to use which gives smallest file size while having exact silence.

Right now, I am using FLAC with 1kHz sampling rate, mono, 16 bits bit-depth. A 60 seconds silent file such is 723 bytes big. I created it with ReZound.

On my 60 second silent file, the output of mediainfo gives:

General
Complete name                            : silence-060s.flac
Format                                   : FLAC
Format/Info                              : Free Lossless Audio Codec
File size                                : 723 Bytes
Duration                                 : 1mn 0s
Overall bit rate mode                    : Variable
Overall bit rate                         : 96 bps

Audio
Format                                   : FLAC
Format/Info                              : Free Lossless Audio Codec
Duration                                 : 1mn 0s
Bit rate mode                            : Variable
Bit rate                                 : 85 bps
Channel(s)                               : 1 channel
Channel positions                        : Front: C
Sampling rate                            : 1 000 Hz
Bit depth                                : 16 bits
Stream size                              : 637 Bytes (88%)
Writing library                          : libFLAC 1.3.1 (UTC 2014-11-25)


723 bytes filesize is already good, but comparing to the task -- just silence -- I would imagine you can encode it with just a few bytes for any lengths. You just would neet to specify the duration ... or have a bit depth of 0 bit and a sample rate of 1/duration.

But a 600s silent file is already 6.6 KiB big, the filesize scales approximately linear with the duration.

Is there any (at best free) audio file format which takes into account exact silence and can encode that in a feasible way? (OK, I might try MIDI or other sequencer-based formats, at least MIDI is not well supported on audio playback software on Linux and needs special software ...)

2Why use lossless compression for silence? :-D You could lower the quality to an absolute minimum, use lowest bitdepth, sample rate and max compression settings – Michael Hansen Buur – 2016-04-01T10:43:42.663

@Michael Hansen Buur: With oggenc (Ogg Vorbis), I achieved 2.3 KiB minimum, with lame (mp3), I achieved 59 KiB (both on the 60 seconds silence). So, which settings do you recommend that actually do work? – Golar Ramblar – 2016-04-01T13:13:23.007

Ok, so I managed to generate a 1MB file of duration 277:46:40! Believe it or not, the format is .wav... at 8 bit mono, and a marvellous sample rate of 1 Hz. Would that count? Caveat: I can't get any program to actually play it... – leftaroundabout – 2016-04-02T23:08:27.440

@leftaroundabout: That would count. How did you do it? Just coding according to the .wav-standard by hand? I want to try (and if my software plays it). – Golar Ramblar – 2016-04-03T06:56:12.750

1

Just an idea (which needs further research): do you actually need the silence to be a file or could you just play dynamically created data? If the latter is the case, you could probably find a solution to call a program that creates a silent audio file in realtime and put that in your playlist. That way you would entirely get around the file size issues for your silence tracks. I don't know enough about Linux to know how to do this, but I am pretty sure this is possible somehow (maybe using named pipes running sox or Ffmpeg to create the silent track).

That could be an idea in principle. For the audio player it should be 'transparent', and I should not need to start some other script beforehand. So I need a file that, when it is beeing read, it actually runs some code and delivers the output. – Golar Ramblar – 2016-04-02T09:31:27.190

That's what I was thinking, sadly I don't know how to do this but hey its Linux so I bet there is a way. – Hans Meiser – 2016-04-02T09:37:47.817

Generating silence with Ffmpeg or sox seems fairly easy so maybe that's a question to pass on to superuser... – Hans Meiser – 2016-04-02T09:38:58.687

Better to http://unix.stackexchange.com/ than to http://superuser.com/.

– Golar Ramblar – 2016-04-02T10:23:53.833

In any case please let us know if you find out anything elsewhere, this would also be handy for test-tone generation etc pp. – Hans Meiser – 2016-04-02T10:30:38.870

– Golar Ramblar – 2016-04-02T13:54:37.770

NICE, following that thread I found this I.e. http://www.rubydoc.info/gems/rfusefs/1.0.3 I don't know what your favourite programming language is but there are probably similar things for other languages

– Hans Meiser – 2016-04-02T15:02:22.963