<commit_before>/**
 * Plucked string synthesis using Karplus-Strong algorithm.
 *
 */

#include "aquila/synth/KarplusStrongSynthesizer.h"
#include <fstream>
#include <iostream>
#include <sstream>
#include <string>


class NoteReader
{
public:
    NoteReader(Aquila::Synthesizer& synthesizer):
        m_synthesizer(synthesizer)
    {
    }

    void playString(const std::string& notes)
    {
        std::istringstream stream(notes);
        playStream(stream);
    }

    void playFile(const std::string& filename)
    {
        std::ifstream stream(filename);
        playStream(stream);
    }

    void playStream(std::istream& stream)
    {
        std::string line, note;
        unsigned int duration, lineNumber;
        while(std::getline(stream, line))
        {
            lineNumber++;
            if (!line.empty())
            {
                std::istringstream lineStream(line);
                if (lineStream >> note >> duration)
                {
                    m_synthesizer.playNote(note, duration);
                }
                else
                {
                    std::cerr << "Parse error on line " << lineNumber
                              << ": '" << line << "'" << std::endl;
                }
            }
        }
    }

private:
    Aquila::Synthesizer& m_synthesizer;
};<commit_msg>Fixed uninitialized variable.<commit_after>/**
 * Plucked string synthesis using Karplus-Strong algorithm.
 *
 */

#include "aquila/synth/KarplusStrongSynthesizer.h"
#include <fstream>
#include <iostream>
#include <sstream>
#include <string>


class NoteReader
{
public:
    NoteReader(Aquila::Synthesizer& synthesizer):
        m_synthesizer(synthesizer)
    {
    }

    void playString(const std::string& notes)
    {
        std::istringstream stream(notes);
        playStream(stream);
    }

    void playFile(const std::string& filename)
    {
        std::ifstream stream(filename);
        playStream(stream);
    }

    void playStream(std::istream& stream)
    {
        std::string line, note;
        unsigned int duration, lineNumber = 0;
        while(std::getline(stream, line))
        {
            lineNumber++;
            if (!line.empty())
            {
                std::istringstream lineStream(line);
                if (lineStream >> note >> duration)
                {
                    m_synthesizer.playNote(note, duration);
                }
                else
                {
                    std::cerr << "Parse error on line " << lineNumber
                              << ": '" << line << "'" << std::endl;
                }
            }
        }
    }

private:
    Aquila::Synthesizer& m_synthesizer;
};
{'fraction_non_alphanumeric': 0.11830357142857142, 'fraction_numerical': 0.0003720238095238095, 'mean_word_length': 1.7551229508196722, 'pattern_counts': {'":': 2, '<': 35, '<?xml version=': 0, '>': 19, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3868874', 'n_tokens_mistral': 799, 'n_tokens_neox': 756, 'n_words': 147}