<commit_before>/**
 * Imports the config module
 * @module config
 */
import config from "../config.js";

/**
 * Builds a waveform for the current audio.
 * Help from: https://robots.thoughtbot.com/javascript-audio-api
 * https://stackoverflow.com/questions/21347833/html-svg-not-drawing-works-in-other-pages
 */
let WaveForm = (function() {
  /*
    Initialize the local variables used in the Waveform.
  */
  let buffer = "";
  let sampleRate = config.waveforms.sample_rate;
  let peaks = "";

  function init() {
    /*
      Grabs all of the waveform elements on the page.
    */
    let waveforms = document.querySelectorAll(".amplitude-wave-form");

    /*
      If there are waveforms, we iterate over them and set them up to display
      properly.
    */
    if (waveforms.length > 0) {
      /*
        Iterate over all of the waveforms and build the SVG parts.
      */
      for (let i = 0; i < waveforms.length; i++) {
        /*
          Clear the inner HTML of the element if we are replacing the waveform.
        */
        waveforms[i].innerHTML = "";

        /*
          Inserts an SVG into the element.
        */
        let svg = document.createElementNS("http://www.w3.org/2000/svg", "svg");
        svg.setAttribute("viewBox", "0 -1 " + sampleRate + " 2");
        svg.setAttribute("preserveAspectRatio", "none");

        /*
          Add a g component to the SVG
        */
        let g = document.createElementNS("http://www.w3.org/2000/svg", "g");<commit_msg>Re-fixed waveform sample rate issue<commit_after>/**
 * Imports the config module
 * @module config
 */
import config from "../config.js";

/**
 * Builds a waveform for the current audio.
 * Help from: https://robots.thoughtbot.com/javascript-audio-api
 * https://stackoverflow.com/questions/21347833/html-svg-not-drawing-works-in-other-pages
 */
let WaveForm = (function() {
  /*
    Initialize the local variables used in the Waveform.
  */
  let buffer = "";
  let sampleRate = '';
  let peaks = "";

  function init() {
    sampleRate = config.waveforms.sample_rate;
    
    /*
      Grabs all of the waveform elements on the page.
    */
    let waveforms = document.querySelectorAll(".amplitude-wave-form");

    /*
      If there are waveforms, we iterate over them and set them up to display
      properly.
    */
    if (waveforms.length > 0) {
      /*
        Iterate over all of the waveforms and build the SVG parts.
      */
      for (let i = 0; i < waveforms.length; i++) {
        /*
          Clear the inner HTML of the element if we are replacing the waveform.
        */
        waveforms[i].innerHTML = "";

        /*
          Inserts an SVG into the element.
        */
        let svg = document.createElementNS("http://www.w3.org/2000/svg", "svg");
        svg.setAttribute("viewBox", "0 -1 " + sampleRate + " 2");
        svg.setAttribute("preserveAspectRatio", "none");

        /*
          Add a g component to the SVG
        */
        let g = document.createElementNS("http://www.w3.org/2000/svg", "g");
{'fraction_non_alphanumeric': 0.1297029702970297, 'fraction_numerical': 0.015181518151815182, 'mean_word_length': 2.204016913319239, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 4, 'lorem ipsum': 0, 'www.': 4, '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': '188676', 'n_tokens_mistral': 938, 'n_tokens_neox': 886, 'n_words': 268}