How to use the amodem.config.Configuration function in amodem

To help you get started, we’ve selected a few amodem examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github romanz / amodem / tests / test_common.py View on Github external
def test_configs():
    default = config.Configuration()
    fastest = config.fastest()
    slowest = config.slowest()
    assert slowest.modem_bps <= default.modem_bps
    assert fastest.modem_bps >= default.modem_bps
github romanz / amodem / amodem / config.py View on Github external
bitrates = {
    1: Configuration(Fs=8e3, Npoints=2, frequencies=[2e3]),
    2: Configuration(Fs=8e3, Npoints=4, frequencies=[2e3]),
    4: Configuration(Fs=8e3, Npoints=16, frequencies=[2e3]),
    8: Configuration(Fs=8e3, Npoints=16, frequencies=[1e3, 2e3]),
    12: Configuration(Fs=16e3, Npoints=16, frequencies=[3e3, 5e3]),
    16: Configuration(Fs=16e3, Npoints=16, frequencies=[2e3, 5e3]),
    20: Configuration(Fs=16e3, Npoints=16, frequencies=[2e3, 6e3]),
    24: Configuration(Fs=16e3, Npoints=16, frequencies=[1e3, 6e3]),
    28: Configuration(Fs=32e3, Npoints=16, frequencies=[3e3, 9e3]),
    32: Configuration(Fs=32e3, Npoints=16, frequencies=[2e3, 9e3]),
    36: Configuration(Fs=32e3, Npoints=64, frequencies=[4e3, 9e3]),
    42: Configuration(Fs=32e3, Npoints=64, frequencies=[4e3, 10e3]),
    48: Configuration(Fs=32e3, Npoints=64, frequencies=[3e3, 10e3]),
    54: Configuration(Fs=32e3, Npoints=64, frequencies=[2e3, 10e3]),
    60: Configuration(Fs=32e3, Npoints=64, frequencies=[2e3, 11e3]),
    64: Configuration(Fs=32e3, Npoints=256, frequencies=[3e3, 10e3]),
    72: Configuration(Fs=32e3, Npoints=256, frequencies=[2e3, 10e3]),
    80: Configuration(Fs=32e3, Npoints=256, frequencies=[2e3, 11e3]),
}


def fastest():
    return bitrates[max(bitrates)]


def slowest():
    return bitrates[min(bitrates)]
github romanz / amodem / scripts / record.py View on Github external
def run(args):
    config = Configuration()
    with open(args.filename, 'wb') as dst:
        interface = audio.Interface(config=config)
        with interface.load(args.audio_library):
            src = interface.recorder()
            size = int(config.sample_size * config.Fs)  # one second of audio
            while True:
                dst.write(src.read(size))
github romanz / amodem / scripts / plot.py View on Github external
def main():
    config = Configuration()

    for fname in sys.argv[1:]:
        x = common.load(open(fname, 'rb'))
        t = np.arange(len(x)) * config.Ts
        pylab.figure()
        pylab.title(fname)
        spectrogram(t, x, config.Fs)

    pylab.show()