tictacsync 0.91a0__py3-none-any.whl → 0.96a0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of tictacsync might be problematic. Click here for more details.
- tictacsync/device_scanner.py +183 -133
- tictacsync/entry.py +152 -61
- tictacsync/multi2polywav.py +1 -1
- tictacsync/remergemix.py +4 -2
- tictacsync/remrgmx.py +28 -0
- tictacsync/timeline.py +285 -95
- tictacsync/yaltc.py +47 -32
- {tictacsync-0.91a0.dist-info → tictacsync-0.96a0.dist-info}/METADATA +1 -1
- tictacsync-0.96a0.dist-info/RECORD +16 -0
- tictacsync-0.91a0.dist-info/RECORD +0 -15
- {tictacsync-0.91a0.dist-info → tictacsync-0.96a0.dist-info}/LICENSE +0 -0
- {tictacsync-0.91a0.dist-info → tictacsync-0.96a0.dist-info}/WHEEL +0 -0
- {tictacsync-0.91a0.dist-info → tictacsync-0.96a0.dist-info}/entry_points.txt +0 -0
- {tictacsync-0.91a0.dist-info → tictacsync-0.96a0.dist-info}/top_level.txt +0 -0
tictacsync/yaltc.py
CHANGED
|
@@ -35,8 +35,7 @@ TEENSY_MAX_LAG = 1.01*128/44100 # sec, duration of a default length audio block
|
|
|
35
35
|
|
|
36
36
|
CACHING = True
|
|
37
37
|
DEL_TEMP = False
|
|
38
|
-
|
|
39
|
-
MAXDRIFT = 10e-3 # in sec, normally 10e-3 (10 ms)
|
|
38
|
+
MAXDRIFT = 15e-3 # in sec, for end of clip
|
|
40
39
|
|
|
41
40
|
|
|
42
41
|
################## pasted from FSKfreqCalculator.py output:
|
|
@@ -46,7 +45,7 @@ SYMBOL_LENGTH = 14.286 # ms, from FSKfreqCalculator.py
|
|
|
46
45
|
N_SYMBOLS = 35 # including sync pulse
|
|
47
46
|
##################
|
|
48
47
|
|
|
49
|
-
MINIMUM_LENGTH =
|
|
48
|
+
MINIMUM_LENGTH = 8 # sec
|
|
50
49
|
TRIAL_TIMES = [ # in seconds
|
|
51
50
|
(3.5, -2),
|
|
52
51
|
(3.5, -3.5),
|
|
@@ -233,7 +232,7 @@ class Decoder:
|
|
|
233
232
|
|
|
234
233
|
Uses the conditions below:
|
|
235
234
|
|
|
236
|
-
Extract duration is 1.143 s.
|
|
235
|
+
Extract duration is 1.143 s. (ie one sec + 1 symbol duration)
|
|
237
236
|
In self.word_props (list of morphology.regionprops):
|
|
238
237
|
if one region, duration should be in [0.499 0.512] sec
|
|
239
238
|
if two regions, total duration should be in [0.50 0.655]
|
|
@@ -244,13 +243,19 @@ class Decoder:
|
|
|
244
243
|
props = self.words_props
|
|
245
244
|
if len(props) not in [1,2]:
|
|
246
245
|
failing_comment = 'len(props) not in [1,2]: %i'%len(props)
|
|
246
|
+
else:
|
|
247
|
+
logger.debug('len(props), %i, is in [1,2]'%len(props))
|
|
247
248
|
if len(props) == 1:
|
|
249
|
+
logger.debug('one region')
|
|
248
250
|
w = _width(props[0])/self.samplerate
|
|
249
251
|
# self.effective_word_duration = w
|
|
250
252
|
# logger.debug('effective_word_duration %f (one region)'%w)
|
|
251
253
|
if not 0.499 < w < 0.512: # TODO: move as TOP OF FILE PARAMS
|
|
252
254
|
failing_comment = '_width %f not in [0.499 0.512]'%w
|
|
255
|
+
else:
|
|
256
|
+
logger.debug('0.499 < width < 0.512, %f'%w)
|
|
253
257
|
else: # 2 regions
|
|
258
|
+
logger.debug('two regions')
|
|
254
259
|
widths = [_width(p)/self.samplerate for p in props] # in sec
|
|
255
260
|
total_w = sum(widths)
|
|
256
261
|
# extra_window_duration = SOUND_EXTRACT_LENGTH - 1
|
|
@@ -260,6 +265,8 @@ class Decoder:
|
|
|
260
265
|
failing_comment = 'two regions duration %f not in [0.50 0.655]\n%s'%(total_w, widths)
|
|
261
266
|
# fig, ax = plt.subplots()
|
|
262
267
|
# p(ax, sound_extract_one_bit)
|
|
268
|
+
else:
|
|
269
|
+
logger.debug('0.5 < total_w < 0.656, %f'%total_w)
|
|
263
270
|
logger.debug('failing_comment: %s'%(
|
|
264
271
|
'none' if failing_comment=='' else failing_comment))
|
|
265
272
|
return failing_comment == '' # no comment = extract seems TicTacCode
|
|
@@ -558,25 +565,24 @@ class Recording:
|
|
|
558
565
|
implicitly True for each video recordings (but not set)
|
|
559
566
|
|
|
560
567
|
device_relative_speed : float
|
|
561
|
-
|
|
562
568
|
the ratio of the recording device clock speed relative to the
|
|
563
569
|
video recorder clock device, in order to correct clock drift with
|
|
564
570
|
pysox tempo transform. If value < 1.0 then the recording is
|
|
565
571
|
slower than video recorder. Updated by each
|
|
566
|
-
|
|
572
|
+
MediaMerger instance so the value can change
|
|
567
573
|
depending on the video recording . A mean is calculated for all
|
|
568
574
|
recordings of the same device in
|
|
569
|
-
|
|
575
|
+
MediaMerger._get_concatenated_audiofile_for()
|
|
570
576
|
|
|
571
577
|
time_position : float
|
|
572
578
|
The time (in seconds) at which the recording starts relative to the
|
|
573
|
-
video recording. Updated by each
|
|
579
|
+
video recording. Updated by each MediaMerger
|
|
574
580
|
instance so the value can change depending on the video
|
|
575
581
|
recording (a video or main sound).
|
|
576
582
|
|
|
577
583
|
final_synced_file : a pathlib.Path
|
|
578
584
|
contains the path of the merged video file after the call to
|
|
579
|
-
AudioStitcher.
|
|
585
|
+
AudioStitcher.build_audio_and_write_merged_media if the Recording is a
|
|
580
586
|
video recording, relative to the working directory
|
|
581
587
|
|
|
582
588
|
synced_audio : pathlib.Path
|
|
@@ -593,13 +599,15 @@ class Recording:
|
|
|
593
599
|
|
|
594
600
|
def __init__(self, media, do_plots=False):
|
|
595
601
|
"""
|
|
602
|
+
Set AVfilename string and check if file exists, does not read any
|
|
603
|
+
media data right away but uses ffprobe to parses the file and sets
|
|
604
|
+
probe attribute.
|
|
605
|
+
|
|
606
|
+
Logs a warning and sets Recording.decoder to None if ffprobe cant
|
|
607
|
+
interpret the file or if file has no audio. If file contains audio,
|
|
608
|
+
initialise Recording.decoder(but doesnt try to decode anything yet).
|
|
609
|
+
|
|
596
610
|
If multifile recording, AVfilename is sox merged audio file;
|
|
597
|
-
Set AVfilename string and check if file exists, does not read
|
|
598
|
-
any media data right away but uses ffprobe to parses the file and
|
|
599
|
-
sets probe attribute.
|
|
600
|
-
Logs a warning if ffprobe cant interpret the file or if file
|
|
601
|
-
has no audio; if file contains audio, instantiates a Decoder object
|
|
602
|
-
(but doesnt try to decode anything yet)
|
|
603
611
|
|
|
604
612
|
Parameters
|
|
605
613
|
----------
|
|
@@ -673,6 +681,7 @@ class Recording:
|
|
|
673
681
|
print('Recording init failed: %s'%recording_init_fail)
|
|
674
682
|
self.probe = None
|
|
675
683
|
self.decoder = None
|
|
684
|
+
return
|
|
676
685
|
logger.debug('ffprobe found: %s'%self.probe)
|
|
677
686
|
logger.debug('n audio chan: %i'%self.get_audio_channels_nbr())
|
|
678
687
|
self._read_audio_data()
|
|
@@ -708,7 +717,8 @@ class Recording:
|
|
|
708
717
|
self.audio_data.shape))
|
|
709
718
|
|
|
710
719
|
def __repr__(self):
|
|
711
|
-
return 'Recording of %s'%_pathname(self.new_rec_name)
|
|
720
|
+
# return 'Recording of %s'%_pathname(self.new_rec_name)
|
|
721
|
+
return _pathname(self.new_rec_name)
|
|
712
722
|
|
|
713
723
|
def _check_for_camera_error_correction(self):
|
|
714
724
|
# look for a file number
|
|
@@ -780,20 +790,21 @@ class Recording:
|
|
|
780
790
|
def get_corrected_duration(self):
|
|
781
791
|
"""
|
|
782
792
|
uses device_relative_speed to compute corrected duration. Updated by
|
|
783
|
-
each
|
|
784
|
-
|
|
793
|
+
each MediaMerger object in
|
|
794
|
+
MediaMerger._get_concatenated_audiofile_for()
|
|
785
795
|
"""
|
|
786
796
|
return self.get_duration()/self.device_relative_speed
|
|
787
797
|
|
|
788
798
|
def needs_dedrifting(self):
|
|
789
799
|
rel_sp = self.device_relative_speed
|
|
790
|
-
if rel_sp > 1:
|
|
791
|
-
|
|
792
|
-
else:
|
|
793
|
-
|
|
800
|
+
# if rel_sp > 1:
|
|
801
|
+
# delta = (rel_sp - 1)*self.get_original_duration()
|
|
802
|
+
# else:
|
|
803
|
+
# delta = (1 - rel_sp)*self.get_original_duration()
|
|
804
|
+
delta = abs((1 - rel_sp)*self.get_original_duration())
|
|
794
805
|
logger.debug('%s delta drift %.2f ms'%(str(self), delta*1e3))
|
|
795
806
|
if delta > MAXDRIFT:
|
|
796
|
-
print('[gold1]%s[/gold1] will get drift correction: delta of [gold1]%.3f[/gold1] ms is too big'%
|
|
807
|
+
print('\n[gold1]%s[/gold1] will get drift correction: delta of [gold1]%.3f[/gold1] ms is too big'%
|
|
797
808
|
(self.AVpath, delta*1e3))
|
|
798
809
|
return delta > MAXDRIFT, delta
|
|
799
810
|
|
|
@@ -915,7 +926,7 @@ class Recording:
|
|
|
915
926
|
def set_time_position_to(self, video_clip):
|
|
916
927
|
"""
|
|
917
928
|
Sets self.time_position, the time (in seconds) at which the recording
|
|
918
|
-
starts relative to the video recording. Updated by each
|
|
929
|
+
starts relative to the video recording. Updated by each MediaMerger
|
|
919
930
|
instance so the value can change depending on the video
|
|
920
931
|
recording (a video or main sound).
|
|
921
932
|
|
|
@@ -942,9 +953,12 @@ class Recording:
|
|
|
942
953
|
if successful, returns a datetime.datetime instance;
|
|
943
954
|
if not returns None.
|
|
944
955
|
"""
|
|
945
|
-
logger.debug('for
|
|
956
|
+
logger.debug('for %s, recording.start_time %s'%(self,
|
|
946
957
|
self.start_time))
|
|
958
|
+
if self.decoder is None:
|
|
959
|
+
return None # ffprobe failes or file too short, see __init__
|
|
947
960
|
if self.start_time is not None:
|
|
961
|
+
logger.debug('Recording.start_time already found %s'%self.start_time)
|
|
948
962
|
return self.start_time #############################################
|
|
949
963
|
cached_times = {}
|
|
950
964
|
def find_time(t_sec):
|
|
@@ -969,8 +983,8 @@ class Recording:
|
|
|
969
983
|
len(TRIAL_TIMES)))
|
|
970
984
|
# time_around_beginning = self._find_time_around(near_beg)
|
|
971
985
|
time_around_beginning = find_time(near_beg)
|
|
972
|
-
if self.TicTacCode_channel is None:
|
|
973
|
-
|
|
986
|
+
# if self.TicTacCode_channel is None:
|
|
987
|
+
# return None ####################################################
|
|
974
988
|
logger.debug('Trial #%i, end at %f'%(i+1, near_end))
|
|
975
989
|
# time_around_end = self._find_time_around(near_end)
|
|
976
990
|
time_around_end = find_time(near_end)
|
|
@@ -1048,6 +1062,7 @@ class Recording:
|
|
|
1048
1062
|
return int(ppm)
|
|
1049
1063
|
|
|
1050
1064
|
def get_speed_ratio(self, videoclip):
|
|
1065
|
+
# ratio between real samplerates of audio and videoclip
|
|
1051
1066
|
nominal = self.get_samplerate()
|
|
1052
1067
|
true = self.true_samplerate
|
|
1053
1068
|
ratio = true/nominal
|
|
@@ -1057,19 +1072,19 @@ class Recording:
|
|
|
1057
1072
|
return ratio/ratio_ref
|
|
1058
1073
|
|
|
1059
1074
|
def get_samplerate(self):
|
|
1060
|
-
#
|
|
1075
|
+
# returns int samplerate (nominal)
|
|
1061
1076
|
string = self._ffprobe_audio_stream()['sample_rate']
|
|
1062
1077
|
logger.debug('ffprobe samplerate: %s'%string)
|
|
1063
|
-
return eval(string)
|
|
1078
|
+
return eval(string)
|
|
1064
1079
|
|
|
1065
1080
|
def get_framerate(self):
|
|
1066
|
-
# return int samplerate (nominal)
|
|
1067
1081
|
string = self._ffprobe_video_stream()['avg_frame_rate']
|
|
1068
1082
|
return eval(string) # eg eval(24000/1001)
|
|
1069
1083
|
|
|
1070
|
-
def
|
|
1071
|
-
# returns a
|
|
1084
|
+
def get_start_timecode_string(self, with_offset=0):
|
|
1085
|
+
# returns a HH:MM:SS:FR string
|
|
1072
1086
|
start_datetime = self.get_start_time()
|
|
1087
|
+
# logger.debug('CLI_offset %s'%CLI_offset)
|
|
1073
1088
|
logger.debug('start_datetime %s'%start_datetime)
|
|
1074
1089
|
start_datetime += timedelta(seconds=with_offset)
|
|
1075
1090
|
logger.debug('shifted start_datetime %s (offset %f)'%(start_datetime,
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
tictacsync/LTCcheck.py,sha256=IEfpB_ZajWuRTWtqji0H-B2g7GQvWmGVjfT0Icumv7o,15704
|
|
2
|
+
tictacsync/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
3
|
+
tictacsync/device_scanner.py,sha256=3ji6LR_HelylsEU12vI2ZAzOtODA7pdUglIXLJUjIPY,29810
|
|
4
|
+
tictacsync/entry.py,sha256=P5l4b8QO5e7j_b_coKZtYi8snPI23gy9V5GojeMddDw,15394
|
|
5
|
+
tictacsync/multi2polywav.py,sha256=BsZxUjZo2Px6opKpFlgcvdZuUKDANEVTdapuWrX1jKw,7287
|
|
6
|
+
tictacsync/remergemix.py,sha256=bRyi1hyNcyM1rTkHh8DmSsIQjYpwPprxSyyVipnxz30,9909
|
|
7
|
+
tictacsync/remrgmx.py,sha256=uGsylyXEWSQE19pU-JaX6p-po8V4C1O5fBr58dVGpT0,765
|
|
8
|
+
tictacsync/synciso.py,sha256=XmUcdUF9rl4VdCm7XW4PeYWYWM0vgAY9dC2hapoul9g,4821
|
|
9
|
+
tictacsync/timeline.py,sha256=fv_-oQYBXdY5db2Kse3FM_aQaj_Tg4LKC2unWEQ24A4,68036
|
|
10
|
+
tictacsync/yaltc.py,sha256=7zMu0BxqNsHTB9RHLPgjer-puA13J1tRbgcuJJ_en_g,53233
|
|
11
|
+
tictacsync-0.96a0.dist-info/LICENSE,sha256=ZAOPXLh1zlQAnhHUd7oLslKM01YZ5UiAu3STYjwIxck,1068
|
|
12
|
+
tictacsync-0.96a0.dist-info/METADATA,sha256=M6yUlQJJQZ3QgyydgVybTo2kfdXgprhpOyJpCTfNDL4,5502
|
|
13
|
+
tictacsync-0.96a0.dist-info/WHEEL,sha256=oiQVh_5PnQM0E3gPdiz09WCNmwiHDMaGer_elqB3coM,92
|
|
14
|
+
tictacsync-0.96a0.dist-info/entry_points.txt,sha256=g3tdFFrVRcrKpuyKOCLUVBMgYfV65q9kpLZUOD_XCKg,139
|
|
15
|
+
tictacsync-0.96a0.dist-info/top_level.txt,sha256=eaCWG-BsYTRR-gLTJbK4RfcaXajr0gjQ6wG97MkGRrg,11
|
|
16
|
+
tictacsync-0.96a0.dist-info/RECORD,,
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
tictacsync/LTCcheck.py,sha256=IEfpB_ZajWuRTWtqji0H-B2g7GQvWmGVjfT0Icumv7o,15704
|
|
2
|
-
tictacsync/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
3
|
-
tictacsync/device_scanner.py,sha256=lvWps5XPvzubnTqisFWjdRUpxsM9YMRYMp-xQu7H6Os,27515
|
|
4
|
-
tictacsync/entry.py,sha256=TgiFdwTKWvtj7xU-556nkwDo4OqAjJ55g97Jt-lSeBg,11377
|
|
5
|
-
tictacsync/multi2polywav.py,sha256=k7VU-yjO1_0DbygWNytYvaExbiAs3_0-n0UmgGTa8wM,7282
|
|
6
|
-
tictacsync/remergemix.py,sha256=FJTMipIS0O7mMl_tr8BhuYqWvanSydvjGkFCEd-jaDk,9829
|
|
7
|
-
tictacsync/synciso.py,sha256=XmUcdUF9rl4VdCm7XW4PeYWYWM0vgAY9dC2hapoul9g,4821
|
|
8
|
-
tictacsync/timeline.py,sha256=0K1haVu7qUbyQmb0AsVoOB3CO8_OevHxpcJENx0kf48,57763
|
|
9
|
-
tictacsync/yaltc.py,sha256=2pMyDv69x56p3zq11L34PcqS_xC3-HwMPEDXGc7QhDg,52560
|
|
10
|
-
tictacsync-0.91a0.dist-info/LICENSE,sha256=ZAOPXLh1zlQAnhHUd7oLslKM01YZ5UiAu3STYjwIxck,1068
|
|
11
|
-
tictacsync-0.91a0.dist-info/METADATA,sha256=fnBgd-2zImEjHYIctys5-wF1TY4G-vxhCmdMz1wePk4,5502
|
|
12
|
-
tictacsync-0.91a0.dist-info/WHEEL,sha256=oiQVh_5PnQM0E3gPdiz09WCNmwiHDMaGer_elqB3coM,92
|
|
13
|
-
tictacsync-0.91a0.dist-info/entry_points.txt,sha256=g3tdFFrVRcrKpuyKOCLUVBMgYfV65q9kpLZUOD_XCKg,139
|
|
14
|
-
tictacsync-0.91a0.dist-info/top_level.txt,sha256=eaCWG-BsYTRR-gLTJbK4RfcaXajr0gjQ6wG97MkGRrg,11
|
|
15
|
-
tictacsync-0.91a0.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|