#codec #decoding #pure #real-time #decoder #timecode #coder

timecode-coder

A pure Rust no_std library for decoding and encoding timecode in real-time

1 unstable release

0.3.0 Dec 4, 2022
0.2.0 Dec 4, 2022
0.1.0 Dec 4, 2022

#2127 in Encoding

Download history 1/week @ 2024-02-14 6/week @ 2024-02-21 12/week @ 2024-02-28 2/week @ 2024-03-06 1/week @ 2024-03-13 15/week @ 2024-03-27 35/week @ 2024-04-03 68/week @ 2024-04-10

118 downloads per month

MIT license

44KB
888 lines

Rust timecode coder

A pure Rust no_std library for encoding and decoding timecode in real-time.

Decode LTC

Add dependency to Cargo.toml

[dependencies]
timecode-coder = { version = "x.x.x", features = ["decode_ltc"] }

Let's say you have a function that receives buffers from your audio interface:

use timecode_coder::ltc_decoder::LtcDecoder;

struct MyAudioHandler {
    decoder: LtcDecoder<u16>,
}

impl MyAudioHandler {
    // Sampling rate can by any Type that implements `FromPrimitive` 
    fn new(sampling_rate: u32) -> Self {
        Self {
            decoder: LtcDecoder::new(sampling_rate)
        }
    }
    fn new_buffer(&mut self, samples: [u16; 512]) {
        for sample in samples {
            if let Some(timecode_frame) = get_timecode_frame(sample) {
                /// New TimecodeFrame received
            }
        }
    }
}

TimecodeFrame provides:

  • hours
  • minutes
  • seconds
  • frames
  • frame-rate (auto detected)

Warning. Drop frames are not yet supported. They will be detected as normal '25fps' or '30fps'

Encode LTC

not yet implemented

Decode MIDI

not yet implemented

Encode MIDI

not yet implemented

Dependencies

~170KB