Skip to main content

Python ltc reader.

Project description

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

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.

License

Distributed under the terms of the GPL license.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ltc_reader-1.0.3.tar.gz (36.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

ltc_reader-1.0.3-py3-none-any.whl (52.4 kB view details)

Uploaded Python 3

File details

Details for the file ltc_reader-1.0.3.tar.gz.

File metadata

  • Download URL: ltc_reader-1.0.3.tar.gz
  • Upload date:
  • Size: 36.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.19 {"installer":{"name":"uv","version":"0.11.19","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for ltc_reader-1.0.3.tar.gz
Algorithm Hash digest
SHA256 1f3d232605103940398873f52c39e23bbb134e4a3127b9afe76e802e1442c079
MD5 d2c95655f59d48f360d31f14f88d83ec
BLAKE2b-256 d8f50d1a05182557c688d3902fbc682fa8fb6c5efec50b383b300e9c18da69f3

See more details on using hashes here.

File details

Details for the file ltc_reader-1.0.3-py3-none-any.whl.

File metadata

  • Download URL: ltc_reader-1.0.3-py3-none-any.whl
  • Upload date:
  • Size: 52.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.19 {"installer":{"name":"uv","version":"0.11.19","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for ltc_reader-1.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 ea985568156200d1d4f05a608dffddd0078c9b0768e9aa48e2de6dbfccb027e5
MD5 dd5465243c19980255637cd8e7d8db5f
BLAKE2b-256 a61335a47ca299fc6268a131517b4b5b38ceba7858df8519d8f60bd15d5df012

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page