Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| blocks:app-note:ltc_timecode [2025-04-28 11:46] – [Use the timecode in Blocks] fredrik | blocks:app-note:ltc_timecode [2026-10-06 13:55] (current) – admin | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| - | ====Use the timecode | + | ======LTC timecode |
| - | There are a few steps to do before we can make use of the incoming analog timesource in blocks. | + | |
| + | This application note describes how to receive analog timecode from an external source. A USB analog audio interface plugs in to the Blocks server. The audio interface must be "class compliant" | ||
| - | ===Enable the driver=== | + | {{: |
| + | |||
| + | A separate program is used to receive the timecode. This program is included on our Linux Server Image, and can be found in the " | ||
| + | |||
| + | There are other alternative that sometimes may be more suitable, such as the one made by joananton@joananton.com you can [[https:// | ||
| + | |||
| + | ====Configuring the Timecode Reader Software==== | ||
| + | Connect the USB audio device to the server. Use a second computer (e.g. any laptop with an analog autio output) to play [[https:// | ||
| + | |||
| + | ===Find the ALSA Name of the Sound Device=== | ||
| + | You must determine the the operating system' | ||
| + | |||
| + | < | ||
| + | |||
| + | Look for an entry like: | ||
| + | < | ||
| + | plughw: | ||
| + | USB PnP Sound Device, USB Audio | ||
| + | Hardware device with all software conversions | ||
| + | </ | ||
| + | |||
| + | The name to use then is | ||
| + | < | ||
| + | |||
| + | If you have more than one USB audio device one can expect the next audio device to be named: | ||
| + | < | ||
| + | and so on. | ||
| + | |||
| + | ===Echo Test=== | ||
| + | To test if the signal can be received, connect some headphones to the USB card output and make an Echo test: | ||
| + | |||
| + | < | ||
| + | |||
| + | Make sure to use the name determined above. You should hear the incoming timecode in the headphones. | ||
| + | Stop the echo test by hitting ctrl+c. | ||
| + | |||
| + | ===Test the LTC Timecode Reader Program=== | ||
| + | Test the timecode-reader program by using the -t parameter. | ||
| + | First change to the directory where the timecode-reader program is stored: | ||
| + | |||
| + | < | ||
| + | |||
| + | 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</ | ||
| + | |||
| + | Adjust the signal level to minimize errors. | ||
| + | |||
| + | ====Using Timecode in Blocks==== | ||
| + | A few additional steps are required to make use of the timecode in blocks. | ||
| + | |||
| + | ===Enable the Driver=== | ||
| The driver to handle the timedata from the LTC-reader software is not enabled by default. | The driver to handle the timedata from the LTC-reader software is not enabled by default. | ||
| - | To enable the driver | + | To enable the driver, first must make sure the driver files exist in the script/ |
| Change to the script directory: | Change to the script directory: | ||
| - | < | + | < |
| - | Move the driver | + | Move the following |
| - | < | + | |
| - | Restart the blocks server: | + | < |
| - | < | + | mv driver-archive/ |
| + | mv driver-archive/ | ||
| + | </ | ||
| - | The driver is now available to use on network devices. | + | Restart |
| - | ===Setup | + | |
| - | Under the page Manage/ | + | < |
| + | |||
| + | The driver is now available for use. | ||
| + | |||
| + | ===Add the Network Device=== | ||
| + | |||
| + | Under the Manage/ | ||
| The port is predefined in the driver to match the default configuration to the Timecode reader on the server. | The port is predefined in the driver to match the default configuration to the Timecode reader on the server. | ||
| + | |||
| {{: | {{: | ||
| - | ===Configure the driver=== | + | ===Configure the Driver=== |
| - | You must configure | + | Configure |
| A. Set the ' | A. Set the ' | ||
| Line 33: | Line 102: | ||
| B. Set options using JSON data in the " | B. Set options using JSON data in the " | ||
| {{: | {{: | ||
| - | ===Connect a Blocks timeline to sync with timecode=== | ||
| - | Create | + | ===Synchronize |
| - | Set the timeline | + | |
| + | Add a Timeline | ||
| {{: | {{: | ||
| - | Apply any time offset | + | Apply a time offset, if required. This timeline is now controlled by the timecode. |
| + | |||
| + | ====Autostarting the Timecode Reader==== | ||
| + | |||
| + | To make the timecode reader start automatically with the computer, you must perform a few more steps. The Blocks server (based on a recent Linux server image) comes with a " | ||
| + | |||
| + | < | ||
| + | |||
| + | Edit the timecode-reader.service.config file using the //nano// text editor: | ||
| + | |||
| + | < | ||
| + | |||
| + | Edit the TIMECODE_READER_OPTIONS= line to make the software use the wanted device name. | ||
| + | In my case I set it to: | ||
| + | |||
| + | < | ||
| + | |||
| + | Save the file using Ctrl-O then exit the //nano// editor using Ctrl-X. | ||
| + | |||
| + | Inform Linux that you've canged the configuration file: | ||
| + | |||
| + | < | ||
| + | |||
| + | Finally, enable the service to start at computer startup. | ||
| + | |||
| + | < | ||
| + | |||
| + | ====Using Multiple Timecode Readers on One Computer==== | ||
| + | |||
| + | :!: **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 | ||
| + | </ | ||