<commit_before>; bender – Copyright (c) 2016 <NAME> <<EMAIL>>

(defun wav2tap-0 (i o cpu-cycles)
  (alet (read-wavinfo i)
    (| (== 1 (wavinfo-format-tag !))
       (error "WAV file data isn't in PCM format."))
    (| (== 1 (wavinfo-channels !))
       (error "WAV file data isn't mono."))
    (| (== 16 (wavinfo-bits !))
       (error "WAV file data in in 16-bit format."))
    (with (last-low     0
           last-value   0
           sample-rate  (wavinfo-sample-rate !))
      (awhile (read-word i)
              nil
        (= ! (bit-xor ! #x8000))
        (when (& (< #x8000 last-value)
                 (< ! #x8000))
          (let cycles (integer (* last-low (/ cpu-cycles sample-rate)))
            (? (< cycles #x800)
               (write-byte (/ cycles 8) o)
               (write-dword (<< cycles 8) o))
            (= last-low 0)))
        (++! last-low)
        (= last-value !)))))

(defun wav2tap (i o &key cpu-cycles)
  (write-tap o (with-string-stream pulses
                 (wav2tap-0 i pulses cpu-cycles))))<commit_msg>Fliter most above 8kHz and ignore smallest amplitudes.<commit_after>; bender – Copyright (c) 2016 <NAME> <<EMAIL>>

(defun wav2tap-0 (i o cpu-cycles)
  (alet (read-wavinfo i)
    (| (== 1 (wavinfo-format-tag !))
       (error "WAV file data isn't in PCM format."))
    (| (== 1 (wavinfo-channels !))
       (error "WAV file data isn't mono."))
    (| (== 16 (wavinfo-bits !))
       (error "WAV file data in in 16-bit format."))
    (with (last-low     0
           last-value   0
           last-edge    0
           sample-rate  (wavinfo-sample-rate !)
           min-length   (/ sample-rate 8000))
      (awhile (read-word i)
              nil
        (= ! (bit-xor ! #x8000))
        (when (< last-edge !)
          (= last-edge !))
        (when (& (< min-length last-low)
                 (< #x8800 last-edge)
                 (< #x8000 last-value)
                 (< ! #x8000))
          (let cycles (integer (* last-low (/ cpu-cycles sample-rate)))
            (? (< cycles #x800)
               (write-byte (/ cycles 8) o)
               (write-dword (<< cycles 8) o))
            (= last-low 0)
            (= last-edge 0)))
        (++! last-low)
        (= last-value !)))))

(defun wav2tap (i o &key cpu-cycles)
  (write-tap o (with-string-stream pulses
                 (wav2tap-0 i pulses cpu-cycles))))
{'fraction_non_alphanumeric': 0.168077900084674, 'fraction_numerical': 0.03429297205757832, 'mean_word_length': 1.6610360360360361, 'pattern_counts': {'":': 0, '<': 22, '<?xml version=': 0, '>': 9, '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': '194857', 'n_tokens_mistral': 902, 'n_tokens_neox': 794, 'n_words': 210}