<commit_before># coding: utf-8

from helpers import read_wav, db, rms
import filters

def main(filename):
    fs, data = read_wav(filename)
    db_sig, db_h3, k3 = calc_k3(fs, data)
    print '{:22}: total {:2.1f}dB, h3 {:2.1f}dB, k3 {:5.2f}%'.format(
        filename, db_sig, db_h3, k3
    )

def calc_k3(fs, data):
    h3 = filters.thd_for_1k(fs, data)
    return db(rms(data)), db(rms(h3)), 100. * rms(h3) / rms(data)

if __name__ == '__main__':
    main('1k+3k75+25Summe.wav')
    main('1k+3klr97+3summe.wav')
    main('1k+3klr3ProzSumme.wav')

<commit_msg>made klirr a straightforward script<commit_after>from helpers import read_wav, db, rms
import filters

for filename in (
        '1k+3k75+25Summe.wav',
        '1k+3klr97+3summe.wav',
        '1k+3klr3ProzSumme.wav'):
    fs, data = read_wav(filename)
    h3 = filters.thd_for_1k(fs, data)
    print '{:22}: total {:2.1f}dB, h3 {:2.1f}dB, k3 {:5.2f}%'.format(
        filename,
        db(rms(data)),
        db(rms(h3)),
        100. * rms(h3) / rms(data)
    )

{'fraction_non_alphanumeric': 0.16975609756097562, 'fraction_numerical': 0.06731707317073171, 'mean_word_length': 3.1707317073170733, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '543955', 'n_tokens_mistral': 492, 'n_tokens_neox': 466, 'n_words': 89}