# Path: abkhazia/utils/logger.py
# class LevelFilter(logging.Filter):
# class WhitespaceRemovingFormatter(logging.Formatter):
# class NoEmptyMessageFilter(logging.Filter):
# class NoLocalSubdirNotFound(logging.Filter):
#     def __init__(self, passlevels):
#     def filter(self, record):
#     def format(self, record):
#     def filter(self, record):
#     def filter(self, record):
# def get_log(log_file=os.devnull, verbose=False, header_in_stdout=False):
# def reopen_files(log, mode='a+'):
# def null_logger():


import os
import wave
import contextlib
import numpy as np
import array
from abkhazia.utils import logger
# You should have received a copy of the GNU General Public License
# along with abkhazia. If not, see <http://www.gnu.org/licenses/>.
"""Provides the CorpusMergeWavs class"""





#FIXME: this won't work for corpora with several speakers per wavefile
#FIXME modifying original corpus in place could lead to undesirable
# side-effects. Better to use a copy
class CorpusMergeWavs(object):
    """A class for merging the wavs files together for each speaker,
    at the end of this class, one .wav file = one speaker. This
    class also adjusts segments.txt to match the new wavs.


    corpus : The abkhazia corpus to filter. The corpus is assumed
      to be valid.

    log : A logging.Logger instance to send log messages

    function : A string that specifies the cutting function that
      will be used on the corpus

    plot : A boolean which, if set to true, enables the plotting
      of the speech distribution and the cutting function
    """



# Path: abkhazia/utils/logger.py
# class LevelFilter(logging.Filter):
# class WhitespaceRemovingFormatter(logging.Formatter):
# class NoEmptyMessageFilter(logging.Filter):
# class NoLocalSubdirNotFound(logging.Filter):
#     def __init__(self, passlevels):
#     def filter(self, record):
#     def format(self, record):
#     def filter(self, record):
#     def filter(self, record):
# def get_log(log_file=os.devnull, verbose=False, header_in_stdout=False):
# def reopen_files(log, mode='a+'):
# def null_logger():


# Path: abkhazia/corpus/corpus_merge_wavs.py
import os
import wave
import contextlib
import numpy as np
import array
from abkhazia.utils import logger

# You should have received a copy of the GNU General Public License
# along with abkhazia. If not, see <http://www.gnu.org/licenses/>.
"""Provides the CorpusMergeWavs class"""





#FIXME: this won't work for corpora with several speakers per wavefile
#FIXME modifying original corpus in place could lead to undesirable
# side-effects. Better to use a copy
class CorpusMergeWavs(object):
    """A class for merging the wavs files together for each speaker,
    at the end of this class, one .wav file = one speaker. This
    class also adjusts segments.txt to match the new wavs.


    corpus : The abkhazia corpus to filter. The corpus is assumed
      to be valid.

    log : A logging.Logger instance to send log messages

    function : A string that specifies the cutting function that
      will be used on the corpus

    plot : A boolean which, if set to true, enables the plotting
      of the speech distribution and the cutting function
    """



    def __init__(self, corpus, log=logger.null_logger()):