Metadata-Version: 2.4
Name: ltc-reader
Version: 1.0.3
Summary: Python ltc reader.
Project-URL: Homepage, https://gitlab.ewi.tudelft.nl/capturelab/py-ltc-reader
Author-email: REIT <reit-ewi@tudelft.nl>
License-File: LICENSE
Requires-Python: >=3.9
Description-Content-Type: text/markdown

# ltc-reader

Python ltc reader.

[[_TOC_]]


## A generic LTC decoder

LTC stands for Linear Timecode and is a signal used in media production to
time synchronize multiple sources of audio and video involved in same production.

LTC is an analog audio signal and because of it can be easily transmitted
among stations and added as an audio channel with other audio and video.

## Installation

```bash
pip install ltc-reader
```

## Usage

The test code in LTCMapTest shows how to use this:

```
        with wave.open("tests/Audio_2.wav") as wav_file:
            metadata = wav_file.getparams()
            if metadata.nchannels != 1:
                raise ValueError("1-channel data required")  # noqa: EM101
            # frames = wav_file.readframes(metadata.nframes)
            data: bytes = wav_file.readframes(metadata.nframes)
            chan: Channel = ByteChannel(data, metadata.framerate, metadata.sampwidth, "little", None)

            map: LTCMap = LTCMap.fromChannel(chan)
            print(map)

```

Most lines are just fetching your audio from a file and extracting the data, sample rate, data width etc. You can change this with other code to read your favourite encoding (eg mp3 , aiff, flac, etc). The decoded data is then put into the Channel object and that is used to create the LTCMap. The Channel ensures the audio is 1-channel with float samples, and ensures there is a ```get``` method to get the Nth sample in the audio.

The example uses an ByteChannel, which assumes your data consists of a list of samples
and each sample is a fixed number of bytes in little or big endian form.
If your data has a different behaviour, you can implement your own Channel
to map map/adapt to the required form. Your data doesn't even have to be in memory for that.

The LTCMap processes all the Channel samples and finds all the LTCs contained.
This map can be accessed through the ```getMap``` method.
This map contains all sample positions (int) and the extracted LTCFrame data.
The sample position is the first sample of the LTC code in the channel.

NOTE
This contains hard copy of tudelft.utilities 1.1.6 from  https://gitlab.ewi.tudelft.nl/interactive-intelligence/utilities/utilitiespy


## Contributing

If you like to contribute have a look at the [Contributing page](CONTRIBUTING.md).

## License
Distributed under the terms of the [GPL license](LICENSE).
