Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
blocks:app-note:ltc_timecode [2025-04-25 09:30]
mattias [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====== ======LTC timecode as sync source======
  
-This application note describes a method to receive analog timecode from an external source.  For simplicity use a USB analog soundcard that plug in to the blocks server. Such audio interface should be "class compliant" USB-A, that means to special driver is required for the device to operate basic functionality properly.+This application note describes a method to receive analog timecode from an external source.  For simplicity we use a USB analog soundcard that we plug in to the blocks server. Such audio interface should be "class compliant" USB-A, that means to special driver is required for the device to operate basic functionality properly.
 {{:blocks:app-note:ltc_timecode:i_face.jpg?400|}}  {{:blocks:app-note:ltc_timecode:i_face.jpg?400|}} 
  
-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.+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://www.youtube.com/watch?v=VY9kEkZim_k made by joananton@joananton.com. This reciever will produce serial data from the LTC timecode and can be connected to any Blocks spot with the same driver used in this article
  
 ====Setup the timecode reader software==== ====Setup the timecode reader software====
 Plug in the USB audio device to the blocks server. Plug in the USB audio device to the blocks server.
-Use a second computer to play [[https://int.pixilab.se/outgoing/permanent/wiki/LTC_10mins_30fps_44100x24.wav|some sample LTC timecode]], just for testing purposes. I just play the sample audio in my Windows laptops mediaplayer. +Use a second computer to play [[https://int.pixilab.se/outgoing/permanent/wiki/LTC_10mins_30fps_44100x24.wav|some sample LTC timecode]], just for testing purposes. We play the sample audio from a Windows laptops mediaplayer. 
 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. 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=== ===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: 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:
-<code>aplay -l</code>+<code>arecord -L</code>
 Look for an entry like:  Look for an entry like: 
 <code>plughw:CARD=Device,DEV=0 <code>plughw:CARD=Device,DEV=0
Line 58: Line 61:
 ===Enable the driver=== ===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 make a driver enabled one must make sure the driver files exist in the script/driver directory in the PIXILAB-Blocks-root. The TimecodeLTC driver are stored in the script/driver-archive/ directory and needs to be enabled:+To enable the driver you must make sure the driver files exist in the script/driver directory in the PIXILAB-Blocks-root. The TimecodeLTC driver is stored in the script/driver-archive/ directory and needs to be enabled:
  
 Change to the script directory:  Change to the script directory: 
Line 73: Line 76:
  
 Under the page Manage/Network we set up a new device and assign the TimecodeLTC driver. Under the page Manage/Network we set up a new device and assign the TimecodeLTC driver.
-The ports 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. 
 {{:blocks:app-note:ltc_timecode:timecodeblocksdevice.png?800|}} {{:blocks:app-note:ltc_timecode:timecodeblocksdevice.png?800|}}
  
 ===Configure the driver=== ===Configure the driver===
  
-One must configure the driver for the expected timecode type. This can be done in either of the following ways:+You must configure the driver with the expected timecode type. The driver will fporward this information to the timecode reader program  . This can be done with one of the following methods:
  
 A. Set the 'type' property of this Network Device to the expected type. A. Set the 'type' property of this Network Device to the expected type.
Line 114: Line 117:
 ====Make multiple Timecode readers autostart==== ====Make multiple Timecode readers autostart====
  
 +:!: **IMPORTANT:** To use multiple timecode readers on the same computer, make sure you're running version 1.4 or later of the **timecode-reader** program. You can see the version number by the following command on the command line, while logged in as the pixi-server user. If your version is older than 1.4, {{:blocks:app-note:timecode-reader:timecode-reader-1.4.zip|download version 1.4 here}}, unpack the ZIP and replace the **timecode-reader** file in the //native// subdirectory of the home directory.
  
-If we want to read more than one LTC timesource we would typically need to duplicate and change the unit files in order to be able to do so. +<code>~/native/timecode-reader -h</code>
  
-We can rewrite the example unit file into a unit template to do this.+To read more than one LTC timecode source you could duplicate and modify the unit file, thus creating 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.
  
-Rename the unit file like this:+**1.** Rename the unit file like this:
 <code>mv timecode-reader.service timecode-reader@.service</code> <code>mv timecode-reader.service timecode-reader@.service</code>
  
-Edit the unit template.  +**2.** Edit the unit template. 
 <code>nano timecode-reader@.service</code> <code>nano timecode-reader@.service</code>
  
-Use this unit configuration:+Using this configuration:
 <code> <code>
 [unit] [unit]
Line 142: Line 145:
 </code> </code>
  
-Rename the config:+**3.** Rename the unit's configuration file:
 <code>mv timecode-reader.service.config timecode-reader.alpha.config</code> <code>mv timecode-reader.service.config timecode-reader.alpha.config</code>
  
-Make as many copies as you want instances:+**4.** Make a copy of that configuration file with a new name:
 <code>cp timecode-reader.alpha.config timecode-reader.beta.config</code> <code>cp timecode-reader.alpha.config timecode-reader.beta.config</code>
  
 +**5.** Edit the config files, specifying different audio interfaces and different network ports in each instance. 
 +<code>nano timecode-reader.beta.config</code>
  
-Edit the config files as in the single instance case above. Make sure to specify a different udp port on all the subsequent instances.  +The configuraition file will look something like this (but with your device name and desired port number)
-<code>nano timecode-reader.service.beta.config</code> +
 <code> <code>
 # Options to pass to the timecode-reader program, e.g., # Options to pass to the timecode-reader program, e.g.,
-# TIMECODE_READER_OPTIONS=-d "Alsa device name"§ -p "UDP port" +# TIMECODE_READER_OPTIONS=-d "Alsa device name" -p "UDP port" 
-TIMECODE_READER_OPTIONS=-d plughw:CARD=Device_1,DEV=0 -p 1634+TIMECODE_READER_OPTIONS=-d plughw:CARD=Device_1,DEV=0 -p 1638
 </code> </code>
  
-Efter any unit change make sure to reinitizialize systemd daemon:+**6.** Notify systemd of your changes:
  
 <code> <code>
-systemctl --user daemon-reexec  # Just in case you've changed the template 
 systemctl --user daemon-reload </code> systemctl --user daemon-reload </code>
  
-Enable (autostart) and start the two instances+**7.** Finally, enable and start the two instances
 <code> <code>
 systemctl --user enable --now timecode-reader@alpha.service systemctl --user enable --now timecode-reader@alpha.service
 systemctl --user enable --now timecode-reader@beta.service systemctl --user enable --now timecode-reader@beta.service
 </code> </code>