<commit_before>#!/usr/bin/env python

from __future__ import print_function

import sys

from helpers import read_wav, db, timeslice

try:
    filename = sys.argv[1]
except IndexError:
    print('usage {} <filename>'.format(sys.argv[0]))
    sys.exit()

outfilename = filename[:-3] + 'dat'

with open(outfilename, 'w') as outfile:
    fs, data = read_wav(filename)
    for i, t, r in timeslice(fs, data):
        print(t, *db(r), file=outfile)
<commit_msg>handling one channel files in wav2rms<commit_after>#!/usr/bin/env python

from __future__ import print_function

import sys

from helpers import read_wav, db, timeslice

try:
    filename = sys.argv[1]
except IndexError:
    print('usage {} <filename>'.format(sys.argv[0]))
    sys.exit()

outfilename = filename[:-3] + 'dat'

with open(outfilename, 'w') as outfile:
    fs, data = read_wav(filename)
    for i, t, r in timeslice(fs, data):
        try:
            print(t, *db(r), file=outfile)
        except TypeError:
            # if r is not iterable, it's only one channel
            print(t, db(r), file=outfile)


{'fraction_non_alphanumeric': 0.13148148148148148, 'fraction_numerical': 0.006481481481481481, 'mean_word_length': 3.376518218623482, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, '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': '4683543', 'n_tokens_mistral': 385, 'n_tokens_neox': 379, 'n_words': 106}