Differences
This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
blocks:app-note:ltc_timecode [2025-04-28 11:46] fredrik [Use the timecode in Blocks] |
blocks:app-note:ltc_timecode [2025-05-06 10:59] (current) mattias [Make multiple Timecode readers autostart] |
||
---|---|---|---|
Line 1: | Line 1: | ||
+ | ======LTC timecode as sync source====== | ||
+ | |||
+ | This application note describes a method to receive analog timecode from an external source. | ||
+ | {{: | ||
+ | |||
+ | We refer to the analog input on the Blocks server in the article, the application can run on any linux computer, so if your source signal is elsewhere it may make sense to pickup the sync signal with another computer running the LTC_timecode reader software. One way of doing that is to use the blocks server image to create the computer. Disable the blocks service and then follow the instructions in this application not to make this into a LTC timecode reader device. | ||
+ | |||
+ | There are other alternative that sometimes may be more suitable, such as the one shown here: | ||
+ | https:// | ||
+ | |||
+ | ====Setup the timecode reader software==== | ||
+ | Plug in the USB audio device to the blocks server. | ||
+ | Use a second computer to play [[https:// | ||
+ | Plug an 3.5mm audio cable between the computers audio output with the line in/mic input of the analog audio card of the Blocks server. | ||
+ | |||
+ | ===Find out the ALSA name of the sound device=== | ||
+ | To capture the desired device we must figure out the ALSA name of the usb-device. To do so we open the terminal as the pixi-server user and type: | ||
+ | < | ||
+ | Look for an entry like: | ||
+ | < | ||
+ | USB PnP Sound Device, USB Audio | ||
+ | Hardware device with all software conversions | ||
+ | </ | ||
+ | |||
+ | The ALSA name is | ||
+ | < | ||
+ | |||
+ | If you have more than one USB audio device one can expect the next one to be named: | ||
+ | < | ||
+ | and so on. | ||
+ | |||
+ | |||
+ | ===Echo test=== | ||
+ | To test if we get any signal one can now plug in headphones in the USB card output and make an Echo test: | ||
+ | < | ||
+ | You should hear the incoming timecode in the headphones. | ||
+ | Stop the echo test by hitting ctrl+c. | ||
+ | |||
+ | ===Test run the LTC reader software=== | ||
+ | Now we can dryrun also the LTC reader software by making it log the time using the -t parameter. | ||
+ | Change to the directory where the software is stored, on a Blocks server image is is stored in home/ | ||
+ | |||
+ | < | ||
+ | |||
+ | Run the program using the -d parameter to specify device and -t parameter to run in test mode. | ||
+ | < | ||
+ | |||
+ | We should see the time changing as the time source progress in the console output: | ||
+ | < | ||
+ | 01:57.11 signal, dbFS: -0.6 | ||
+ | </ | ||
+ | |||
+ | In test mode we may also see some error logging while reading the signal. | ||
+ | < | ||
+ | Minor error ignored. 92926 contiguous with lastReceived 92925</ | ||
+ | |||
====Use the timecode in Blocks==== | ====Use the timecode in Blocks==== | ||
There are a few steps to do before we can make use of the incoming analog timesource in blocks. | There are a few steps to do before we can make use of the incoming analog timesource in blocks. | ||
Line 25: | Line 81: | ||
===Configure the driver=== | ===Configure the driver=== | ||
- | You must configure the driver | + | You must configure the driver |
A. Set the ' | A. Set the ' | ||
Line 41: | Line 97: | ||
Apply any time offset as required. This timeline is now controlled by the timecode. | Apply any time offset as required. This timeline is now controlled by the timecode. | ||
+ | ====Make the Timecode reader autostart==== | ||
+ | |||
+ | To make the timecode reader autostart we must perform a few more steps. On a blocks server we have prepared whats called | ||
+ | |||
+ | Change to the users unit files directory: | ||
+ | < | ||
+ | |||
+ | Edit the timecode-reader.service.config file. | ||
+ | < | ||
+ | Edit the TIMECODE_READER_OPTIONS= line to make the software use the wanted device name. | ||
+ | In my case I set it to: | ||
+ | |||
+ | < | ||
+ | |||
+ | Next step is to enable the service at computer startup. | ||
+ | |||
+ | < | ||
+ | |||
+ | ====Make multiple Timecode readers autostart==== | ||
+ | |||
+ | :!: **IMPORTANT: | ||
+ | |||
+ | < | ||
+ | |||
+ | To read more than one LTC timecode source you could duplicate and modify the unit file, thus creating a separate unit file for this purpose. However, a better solution is to modify the unit file to a //unit template//, as this keeps all the common stuff in one place. Follow this procudure to use that option. | ||
+ | |||
+ | **1.** Rename the unit file like this: | ||
+ | < | ||
+ | |||
+ | **2.** Edit the unit template. | ||
+ | < | ||
+ | |||
+ | Using this configuration: | ||
+ | < | ||
+ | [unit] | ||
+ | Description=LTC Timecode Reader (%i) | ||
+ | |||
+ | [Service] | ||
+ | EnvironmentFile=%h/ | ||
+ | ExecStart=%h/ | ||
+ | TimeoutStopSec=20 | ||
+ | Restart=on-failure | ||
+ | RestartSec=10 | ||
+ | |||
+ | [Install] | ||
+ | WantedBy=default.target | ||
+ | </ | ||
+ | |||
+ | **3.** Rename the unit's configuration file: | ||
+ | < | ||
+ | |||
+ | **4.** Make a copy of that configuration file with a new name: | ||
+ | < | ||
+ | |||
+ | **5.** Edit the config files, specifying different audio interfaces and different network ports in each instance. | ||
+ | < | ||
+ | |||
+ | The configuraition file will look something like this (but with your device name and desired port number) | ||
+ | < | ||
+ | # Options to pass to the timecode-reader program, e.g., | ||
+ | # TIMECODE_READER_OPTIONS=-d "Alsa device name" -p "UDP port" | ||
+ | TIMECODE_READER_OPTIONS=-d plughw: | ||
+ | </ | ||
+ | |||
+ | **6.** Notify systemd of your changes: | ||
+ | |||
+ | < | ||
+ | systemctl --user daemon-reload </ | ||
+ | |||
+ | **7.** Finally, enable and start the two instances | ||
+ | < | ||
+ | systemctl --user enable --now timecode-reader@alpha.service | ||
+ | systemctl --user enable --now timecode-reader@beta.service | ||
+ | </ |