Fork me on GitHub
Release:
Date:
1.3
Feb 14, 2012
Flattr Mktoc

Table Of Contents

Download

Get latest source archive,
mktoc-1.3.tar.gz, or install with:

pip install mktoc --upgrade --user

Found a Bug?

Fill out a report on the issue tracker.

This Page

3.7. mktoc.wav

Utility classes for search and modifying WAV audio files.

The following are a list of the classes provided in this module:

class mktoc.wav.WavFileCache(_dir='.')[source]

Bases: object

Verifies the existence of a WAV file in the local file system.

The class provides fuzzy logic name matching of cached results in the case that the specified file can not be found. The files system is only scanned once, and all lookups after the initial test come from the cache. The cache size is limited to prevent over aggressive file system access.

Initialize the class instance with the input _dir argument. If no argument is supplied it defaults to the current working dir.

Parameters:_dir (str) – Base path location to perform the WAV file search.
__call__(file_)[source]

Search the cache for a fuzzy-logic match of the file name in file_ parameter. This method will always return the exact file name if it exists before attempting fuzzy matches.

Parameters:file (str) – File name to search for.
class mktoc.wav.WavOffsetWriter(offset_samples, pb_class, pb_args)[source]

Bases: object

Shift the audio data in a set of WAV files by a desired postive or negative sample offset.

The module will never modify the input WAV files, and always write to either a new directory in the ‘cwd’ or in the /tmp directory. The WAV files are treated as a set of data, in that, the direction of shift will cause audio sample data to be taken from either a previous or next WAV file. The shift in sample data will cause either the first or last WAV file to contain ‘sample count’ of NULL samples.

Parameters:
  • offset_samples (int) – Sample shift value
  • pb_class (ProgressBar) – outputs status updates to the user. First argument of the class init routine specifies the maximum value of the progress bar and is calulated by this class.
  • pb_args (list) – Argument list used to initialize progress bar. However, the first argument of the progress bar init routine is calculated by this class.
__call__(files, use_tmp_dir)[source]

Initiate the WAV offsetting algorithm.

New output files are written to either wav[+,-]n/ or /tmp/mktoc.[random]/

Parameters:
  • files (list) – WAV files read to apply the sample shifting process to.
  • use_tmp_dir (bool) – True indicates new WAV files are created in /tmp.