# This is the configuration file for audio-entropyd's initscript.
# Each option must be entered on a line by itself as if it was
# being entered on the command line.  The dash must be in the
# first column.
# Anything after a hash (#) mark and blank lines are ignored.
# Command line options override options in this file.
# And this has nothing to do with the options, but you should test the statistical quality of
# audio-entropyd on your setup with cat /dev/random | rngtest -c10000 or another practical number
# The test above takes about 6 hours on my system at 44100 frame rate with entropy-filter=0.
# RG Brown has a good explanation of the relationship of statistics with randomness in his man pages for dieharder.
# I get from 3 to 11 errors on runs.  Statistically, this is expected, but really for good
# cryptographic numbers we don't actually want random numbers, because they include the tails that
# aren't crpytographically secure.  Think patterns like 20 zeros or ones in a row, etc.  So, you'll have to decide
# what seems reasonable.  I think the best way to use this randomness is to make the /dev/urandom device
# more unpredictable.  When audio-entropyd is running, I increase /proc/sys/kernel/random/write_wakeup_threshold
# to 3840 and I lower /proc/sys/kernel/random/urandom_min_reseed_secs to 5,
# providing more entropy and allowing /dev/urandom to take entropy from the pool more often.

# Valid options are the following, also see with audio-entropyd -h  or --help
#
#--device=plughw:0  #default, you can use hw:0, but your device has to support 32 bit signed output natively
#--device plughw 0  # you can also leave a space in long options like this does, and short options do
--device=plughw:0
#-d plughw:0
#
#  I haven't actually compared the filters to see if they extract the *same* entropy.  It seems unlikely.
#  All of the filters have zero errors in rngtest out to at least 10, 200,000 bits.  The faster ones have been tested out
#  to about 10000 samples, and have an error rate about .1%.  That's the same as /dev/urandom, and is probably the
#  statistical error rate of the generator on the tests being used.
#  rngtest isn't actually testing audio-entropyd,
#  just it's rate of contribution to the kernel entropy pool which is used to generate the bits that rngtest gets from
#  /dev/random.  I test with no X, user idle, no network, overnight.  Nearly all the entropy in the pool will be
#  from audio-entropyd.
#  I recommend 30, 23, and 8.  21 and 0 also are OK.  But whichever test you use, you should tune for *your* device.

          #  This test uses the distance that the channels are apart in absolute normalized terms to determine if an event should generate a bit of entropy.
          #  I consider this test to be very good once it is tuned to your device.  Random variations in the distance between
          #  the channels triggers the generation of a random bit based on the time.
--entropy-filter=30  # determines how different channels are in absolute normalized terms. If over threshold, sets bit using
#                       program run time mod 2.  
                      # approximately 1 bit / 44 frames with threshold of .7
                      # approximately 1 bit / 18 frames with threshold of .5
--upper-threshold=.5  # this determines the absolute normalized distance the channels have to be apart, [0. - 2.], before a bit is generated.
 
          #  These tests use the order between channels to determine events which generate entropy
#--entropy-filter=10  # original test, doesn't work well on my device
                      # about 1 bit of entropy / 100 frames

#--entropy-filter=11  # original test, using dc offset to remove bias instead of a previous value
#                       approximately 1 bit / 14 frames

#--entropy-filter=12  # original test, uses time mod 2 to set bit rather than order conditions and alternator. 
#                       approximately 1 bit / 100 frames

          #  These tests use absolute normalized distance change between channels to determine events which generate entropy
#--entropy-filter=0     # first difference of difference between channels, less more or more less
                        # about 1 bit / 8 frames with lower-threshold == .0 and upper-threshold == .0
#--lower-threshold=-.20 # if the absolute normalized difference between channels isn't less than this, doesn't qualify as change
#--upper-threshold=.20  # if the absolute normalized difference between channels isn't greater than this, doesn't qualify as change

#--entropy-filter=1  # second difference == 0, ~ 1 bit / 17 frames
#--lower-threshold=-.20 # if the absolute normalized difference between channels isn't less than this, doesn't qualify as change
#--upper-threshold=.20  # if the absolute normalized difference between channels isn't greater than this, doesn't qualify as change

#--entropy-filter=2  # second difference != 0, ~ 1 bit / 13 frames
#--lower-threshold=-.20 # if the absolute normalized difference between channels isn't less than this, doesn't qualify as change
#--upper-threshold=.20  # if the absolute normalized difference between channels isn't greater than this, doesn't qualify as change

#--entropy-filter=3  # use 5 sample differences, pattern less more less more or more less more less, ~ 1 bit / 34 frames
#--lower-threshold=-.20 # if the absolute normalized difference between channels isn't less than this, doesn't qualify as change
#--upper-threshold=.20  # if the absolute normalized difference between channels isn't greater than this, doesn't qualify as change

#--entropy-filter=4  # use 5 sample differences, pattern less more more less or more less less more, ~ 1 bit / 55 frames
#--lower-threshold=-.20 # if the absolute normalized difference between channels isn't less than this, doesn't qualify as change
#--upper-threshold=.20  # if the absolute normalized difference between channels isn't greater than this, doesn't qualify as change

#--entropy-filter=5  # use 5 sample differences, pattern less more same less or more less same more, ~ 1 bit / 44 frames
#--lower-threshold=-.20 # if the absolute normalized difference between channels isn't less than this, doesn't qualify as change
#--upper-threshold=.20  # if the absolute normalized difference between channels isn't greater than this, doesn't qualify as change

#--entropy-filter=6  # use 5 sample differences, pattern same same more same or same same less same, ~ 1 bit / 100 frames
#--lower-threshold=-.20 # if the absolute normalized difference between channels isn't less than this, doesn't qualify as change
#--upper-threshold=.20  # if the absolute normalized difference between channels isn't greater than this, doesn't qualify as change

#--entropy-filter=7  # use 5 sample differences, pattern same same more or same same less, ~ 1 bit / 30 frames
#--lower-threshold=-.20 # if the absolute normalized difference between channels isn't less than this, doesn't qualify as change
#--upper-threshold=.20  # if the absolute normalized difference between channels isn't greater than this, doesn't qualify as change

#--entropy-filter=8  # first difference of difference between channels, less more or more less
                    # this version uses time mod 2 to set the bit rather than the condition.
                        # about 1 bit / 10 frames with lower-threshold == -.05 and upper-threshold == .05
                        # about 1 bit / 10 frames with lower-threshold == -.10 and upper-threshold == .10
                        # about 1 bit / 13 frames with lower-threshold == -.20 and upper-threshold == .20
#--lower-threshold=-.20 # if the absolute normalized difference between channels isn't less than this, doesn't qualify as change
#--upper-threshold=.20  # if the absolute normalized difference between channels isn't greater than this, doesn't qualify as change

          #  These tests use changes in individual channels normalized values to determine events which generate entropy
#--entropy-filter=20    # individual channel, each changes one less, one more
                        # about 1 bit / 26 frames with lower-threshold == -.1 and upper-threshold == .1
#--lower-threshold=-.1  #  if the actual change in normalized value is less than this, is considered a change for purposes of test
#--upper-threshold=.1   #  if the actual change in normalized value is more than this, is considered a change for purposes of test

#--entropy-filter=21    # individual channel, one relatively constant, one changes
                        # about 1 bit / 25 frames with lower-threshold == .2 and upper-threshold == .5
#--lower-threshold=.15  #  if the change in absolute normalized value is less than this, considered constant for purposes of test
#--upper-threshold=.40   #  if the change in normalized value is more than this, is considered a change for purposes of test

#--entropy-filter=22    # individual channel, each changes one less, one more, uses time mod 2 to set bit if either occurs
                        # about 1 bit / 30 frames with lower-threshold == -.1 and upper-threshold == .1
#--lower-threshold=-.1  #  if the change in normalized value is less than this, considered a change for purposes of test
#--upper-threshold=.1   #  if the change in normalized value is more than this, is considered a change for purposes of test

#--entropy-filter=23    # individual channel, one relatively constant, one changes, uses time mod 2 to set bit if either occurs
                        # about 1 bit / 26 frames with lower-threshold == .2 and upper-threshold == .5
                        # about 1 bit / 13 frames with lower-threshold == .15 and upper-threshold == .4
#--lower-threshold=.15  #  if the change in absolute normalized value is less than this, considered constant for purposes of test
#--upper-threshold=.4   #  if the change in normalized value is more than this, is considered a change for purposes of test

#-e 0
#
#  This sets the threshold for any entropy filter tests that use normalized distance between the channels
#  Unfortunately, they have different requirements to be meaningful for different entropy filters.  If you
#  are going to use them, it is best to look at the code, though I've set reasonable defaults above under
#  each filter that requires them.
#--lower-threshold=.0 # default
#--lower-threshold=.25
#-l .05
#  This sets the threshold for any entropy filter tests that use normalized distance between the channels
#--upper-threshold=.5  # default
#--upper-threshold=.7
#-u .5
#
#
# pausing and resuming is the default if the device supports it.  This option causes audio-entropyd
# to open and close the device for each sample it captures, and throws away skip-size samples each time
# before capturing the sample.  This is very inefficient, but ensures that the data gathered is always
# from regular operation.
#--always_close  
#-a
#
#--do-not-fork  # fork is default
#-n
#
#--sample-rate=22050  # default
--sample-rate=44100
#-r 44100
#
#--sample-size=11072  # default
#--sample-size=22144
#-z 11072
#
#--skip-size=11025  # default
--skip-size=5555
#-s 11025
#
#--internal-test # default is not to do internal testing.  
#The kernel pool conditions the entropy data it is passed by audio-entropyd regardless.
#--internal-test
#-i
#
#--store-in-file="/tmp/audio_entropyd_output"  # default is to not store in a file, but to fill the entropy pool
#-f "/tmp/audio_entropyd_output"
#
#--verbose  # default is no messages, more repeats, more messages, max 3 has an effect
#--verbose
#--verbose
#-v
#-vv
#-vvv
#
#--help
#-h
