<commit_before>import timeit

import numpy as np


DURATION = 100
NUM_TRIALS = 5
INPUT_SAMPLE_RATE = 32000
OUTPUT_SAMPLE_RATE = 24000

SETUP = '''
from scipy import signal
import resampy

n = int(round(DURATION * INPUT_SAMPLE_RATE))
x = np.random.randn(n)
'''

STATEMENT = '''
y = resampy.resample(x, INPUT_SAMPLE_RATE, OUTPUT_SAMPLE_RATE)
'''

# STATEMENT = '''
# y = signal.resample_poly(x, 3, 4)
# '''


def main():

    print(
        ('Resampling {} seconds of audio from {} hertz to {} hertz '
         '{} times...').format(
             DURATION, INPUT_SAMPLE_RATE, OUTPUT_SAMPLE_RATE, NUM_TRIALS))<commit_msg>Improved audio resampling timing script.<commit_after>import timeit

import numpy as np


DURATION = 100
NUM_TRIALS = 5
INPUT_SAMPLE_RATE = 22050
OUTPUT_SAMPLE_RATE = 24000

SETUP = '''
import math

from scipy import signal
import resampy

gcd = math.gcd(INPUT_SAMPLE_RATE, OUTPUT_SAMPLE_RATE)
up = OUTPUT_SAMPLE_RATE / gcd
down = INPUT_SAMPLE_RATE / gcd

n = int(round(DURATION * INPUT_SAMPLE_RATE))
x = np.random.randn(n)
'''

# STATEMENT = '''
# y = resampy.resample(x, INPUT_SAMPLE_RATE, OUTPUT_SAMPLE_RATE)
# '''

STATEMENT = '''
y = signal.resample_poly(x, up, down)
'''


def main():

    print(
        ('Resampling {} seconds of audio from {} hertz to {} hertz '
         '{} times...').format(
             DURATION, INPUT_SAMPLE_RATE, OUTPUT_SAMPLE_RATE, NUM_TRIALS))
{'fraction_non_alphanumeric': 0.12464183381088825, 'fraction_numerical': 0.02148997134670487, 'mean_word_length': 3.9017543859649124, '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': '5428080', 'n_tokens_mistral': 564, 'n_tokens_neox': 526, 'n_words': 118}