Dionyssos commited on
Commit
1fc3525
·
1 Parent(s): 22a403e

how to concat soundscapes

Browse files
README.md CHANGED
@@ -27,7 +27,7 @@ tags:
27
 
28
  ## Available Voices
29
 
30
- <a href="https://audeering.github.io/shift/">Listen Voices!</a>
31
 
32
  ## Flask API
33
 
@@ -46,8 +46,6 @@ Flask
46
  CUDA_DEVICE_ORDER=PCI_BUS_ID HF_HOME=./hf_home CUDA_VISIBLE_DEVICES=2 python api.py
47
  ```
48
 
49
- ## Inference
50
-
51
  The following need `api.py` to be running on a `tmux session`.
52
 
53
  ## Text 2 Speech
 
27
 
28
  ## Available Voices
29
 
30
+ <a href="https://audeering.github.io/shift/">Listen to available voices!</a>
31
 
32
  ## Flask API
33
 
 
46
  CUDA_DEVICE_ORDER=PCI_BUS_ID HF_HOME=./hf_home CUDA_VISIBLE_DEVICES=2 python api.py
47
  ```
48
 
 
 
49
  The following need `api.py` to be running on a `tmux session`.
50
 
51
  ## Text 2 Speech
api.py CHANGED
@@ -29,14 +29,15 @@ Path(CACHE_DIR).mkdir(parents=True, exist_ok=True)
29
  # ssh-add ~/.ssh/id_ed25519_github2024
30
  #
31
  # git remote set-url origin git@github.com:audeering/shift
32
- # ==
33
 
34
  def _shift(x):
35
  n = x.shape[0]
36
  i = np.random.randint(.24 * n, max(1, .74 * n)) # high should be above >= 0
37
  x = np.roll(x, i)
38
- # fade_in = .5 + .5 * np.tanh(4*(np.linspace(-10, 10, x.shape[0]) + 9.4))
39
- # x = x * fade_in
 
40
  return x
41
 
42
  def overlay(x, sound_background=None):
@@ -47,11 +48,12 @@ def overlay(x, sound_background=None):
47
  n_repeat = len_speech // len(sound_background) + 1
48
  replica = [sound_background] * n_repeat
49
  replica = [_shift(_) for _ in replica]
 
50
  sound_background = np.concatenate(replica)
51
 
52
 
53
- print(f'\nSOUND BACKGROUND SHAPE\n{sound_background.shape=}\n{x.shape=}\n- - - -')
54
- x = .74 * x + .26 * sound_background[:len_speech]
55
  return x
56
 
57
  def tts_multi_sentence(precomputed_style_vector=None,
 
29
  # ssh-add ~/.ssh/id_ed25519_github2024
30
  #
31
  # git remote set-url origin git@github.com:audeering/shift
32
+ # ==
33
 
34
  def _shift(x):
35
  n = x.shape[0]
36
  i = np.random.randint(.24 * n, max(1, .74 * n)) # high should be above >= 0
37
  x = np.roll(x, i)
38
+ # fade_in = .5 * np.tanh(-4*(np.linspace(-10, 10, n) - 9.4))
39
+ x[0] = .5 * x[1]
40
+ x[-1] = .5 * x[-2] # smooth woof
41
  return x
42
 
43
  def overlay(x, sound_background=None):
 
48
  n_repeat = len_speech // len(sound_background) + 1
49
  replica = [sound_background] * n_repeat
50
  replica = [_shift(_) for _ in replica]
51
+ # The patch makes a woof assure smooth start to multiply the patch by a
52
  sound_background = np.concatenate(replica)
53
 
54
 
55
+ print(f'\n====SOUND BACKGROUND SHAPE\n{sound_background.shape=}{np.abs(sound_background.max())=}\n{x.shape=}\n- - - -')
56
+ x = .9 * x + .1 * sound_background[:len_speech]
57
  return x
58
 
59
  def tts_multi_sentence(precomputed_style_vector=None,
landscape2soundscape.py CHANGED
@@ -46,7 +46,7 @@ DESCRIPTIONS = [
46
  '01_Schick_AII840_001.jpg', # image
47
  '01_Schick_AII840_001.txt', # text
48
  'Statue in shire hill on autumn beach.', # audiocraft
49
- 'Gottlieb Schick 1802 - Bildnis der Heinrike Dannecker', # cv2 puttext title
50
  'en_US/m-ailabs_low#mary_ann',
51
  ],
52
  # 2
@@ -54,23 +54,23 @@ DESCRIPTIONS = [
54
  '02_Constable_AI555_001.jpg',
55
  '02_Constable_AI555_001.txt',
56
  'Meadows country farm village in sight',
57
- 'John Constable 1804 - Dorf An Dem Flusse Stour',
58
- 'en_US/m-ailabs_low#mary_ann',
59
  ],
60
  # 3
61
  [
62
  '03_Schinkel_WS200-002.jpg',
63
  '03_Schinkel_WS200-002.txt',
64
  'Arriving at the shore on horses',
65
- 'Karl Friedrich Schinkel 1815 - Gotische Kirche Auf Einem Felsen Am Meer',
66
- 'en_US/m-ailabs_low#mary_ann',
67
  ],
68
  #
69
  [
70
  '04_Friedrich_FV317_001.jpg',
71
  '04_Friedrich_FV317_001.txt',
72
  'Land steppes',
73
- 'Friedrich Caspar David 1824 - Der Watzmann',
74
  'en_US/m-ailabs_low#mary_ann',
75
  ],
76
  #
@@ -78,15 +78,15 @@ DESCRIPTIONS = [
78
  '05_Blechen_FV40_001.jpg',
79
  '05_Blechen_FV40_001.txt',
80
  'fjords',
81
- 'Carl Blechen 1829 - Unwetter In Der Romischen Campagna',
82
  'en_US/m-ailabs_low#mary_ann',
83
  ],
84
  # 6
85
  [
86
  '06_Menzel_AI900_001.jpg',
87
  '06_Menzel_AI900_001.txt',
88
- 'Olive trees in Seville',
89
- 'Adolph Menzel 1846 - Bauplatz mit Weiden',
90
  'en_US/m-ailabs_low#mary_ann',
91
  ],
92
  # 7
@@ -94,7 +94,7 @@ DESCRIPTIONS = [
94
  '07_Courbet_AI967_001.jpg',
95
  '07_Courbet_AI967_001.txt',
96
  'Storm at the strand of waves Tsunami',
97
- 'Gustave Courbet 1870 - Die Welle',
98
  'en_US/m-ailabs_low#mary_ann',
99
  ],
100
  # 8
@@ -102,7 +102,7 @@ DESCRIPTIONS = [
102
  '08_Monet_AI1013_001.jpg',
103
  '08_Monet_AI1013_001.txt',
104
  'Mai flowers blossom picnic',
105
- 'Claude Monet 1874 - Sommertag',
106
  'en_US/m-ailabs_low#mary_ann',
107
  ],
108
  # 9
@@ -110,7 +110,7 @@ DESCRIPTIONS = [
110
  '09_Blechen_AII823_001.jpg',
111
  '09_Blechen_AII823_001.txt',
112
  'Cascade in Africa',
113
- 'Carl Blechen 1832 - Wasserfälle Bei Tivoli',
114
  'en_US/m-ailabs_low#mary_ann',
115
  ],
116
  # 10
@@ -118,7 +118,7 @@ DESCRIPTIONS = [
118
  '10_Boecklin_967648_NG2-80_001_rsz.jpg',
119
  '10_Boecklin_967648_NG2-80_001.txt',
120
  'Hades ades at it sisland',
121
- 'Arnold Böcklin 1883 - Toteninsel',
122
  'en_US/m-ailabs_low#mary_ann',
123
  ],
124
  # 11
@@ -126,7 +126,7 @@ DESCRIPTIONS = [
126
  '11_Liebermann_NG4-94_001.jpg',
127
  '11_Liebermann_NG4-94_001.txt',
128
  'Tavern at the waterfront',
129
- 'Max Tiebermann 1916 - Gartenlokal An Der Havel. Nikolskoe',
130
  'en_US/m-ailabs_low#mary_ann',
131
  ],
132
  # 12
@@ -134,7 +134,7 @@ DESCRIPTIONS = [
134
  '12_Slevogt_AII1022_001.jpg',
135
  '12_Slevogt_AII1022_001.txt',
136
  'toy sailing yachts pool',
137
- 'Max Slevogt 1905 - Segelboote Auf Der Alster Am Abend',
138
  'en_US/m-ailabs_low#mary_ann',
139
  ],
140
  ]
@@ -159,7 +159,7 @@ for img, text, scene, title, voice in DESCRIPTIONS[:20]:
159
  fram = np.zeros((94, im.shape[1], 3), dtype=np.uint8)
160
  h, w, _ = fram.shape
161
  font = cv2.FONT_HERSHEY_SIMPLEX
162
- bottomLeftCornerOfText = (240, 74) # w,h
163
  fontScale = 2
164
  fontColor = (255, 255, 255)
165
  thickness = 4
@@ -171,7 +171,7 @@ for img, text, scene, title, voice in DESCRIPTIONS[:20]:
171
  fontColor,
172
  thickness,
173
  lineType)
174
- offset_h = 0
175
  im[offset_h:h+offset_h, :w, :] = (.4 * im[offset_h:h+offset_h, :w, :] + .6 * fram).astype(np.uint8)
176
 
177
  cv2.imwrite('_tmp_banner.png', im)
 
46
  '01_Schick_AII840_001.jpg', # image
47
  '01_Schick_AII840_001.txt', # text
48
  'Statue in shire hill on autumn beach.', # audiocraft
49
+ 'G. Schick, Bildnis der Heinrike Dannecker, 1802', # cv2 puttext title
50
  'en_US/m-ailabs_low#mary_ann',
51
  ],
52
  # 2
 
54
  '02_Constable_AI555_001.jpg',
55
  '02_Constable_AI555_001.txt',
56
  'Meadows country farm village in sight',
57
+ 'J. Constable, Dorf An Dem Flusse Stour, 1804',
58
+ 'en_US/m-ailabs_low#elliot_miller',
59
  ],
60
  # 3
61
  [
62
  '03_Schinkel_WS200-002.jpg',
63
  '03_Schinkel_WS200-002.txt',
64
  'Arriving at the shore on horses',
65
+ 'K. F. Schinkel, Gotische Kirche Auf Einem Felsen Am Meer, 1815',
66
+ 'en_US/hifi-tts_low#6097',
67
  ],
68
  #
69
  [
70
  '04_Friedrich_FV317_001.jpg',
71
  '04_Friedrich_FV317_001.txt',
72
  'Land steppes',
73
+ 'C. D. Friedrich, Der Watzmann, 1824',
74
  'en_US/m-ailabs_low#mary_ann',
75
  ],
76
  #
 
78
  '05_Blechen_FV40_001.jpg',
79
  '05_Blechen_FV40_001.txt',
80
  'fjords',
81
+ 'C. Blechen, Unwetter In Der Romischen Campagna, 1829',
82
  'en_US/m-ailabs_low#mary_ann',
83
  ],
84
  # 6
85
  [
86
  '06_Menzel_AI900_001.jpg',
87
  '06_Menzel_AI900_001.txt',
88
+ 'Olive Seville',
89
+ 'A. Menzel, Bauplatz mit Weiden, 1846',
90
  'en_US/m-ailabs_low#mary_ann',
91
  ],
92
  # 7
 
94
  '07_Courbet_AI967_001.jpg',
95
  '07_Courbet_AI967_001.txt',
96
  'Storm at the strand of waves Tsunami',
97
+ 'G. Courbet, Die Welle, 1870',
98
  'en_US/m-ailabs_low#mary_ann',
99
  ],
100
  # 8
 
102
  '08_Monet_AI1013_001.jpg',
103
  '08_Monet_AI1013_001.txt',
104
  'Mai flowers blossom picnic',
105
+ 'C. Monet, Sommertag, 1874',
106
  'en_US/m-ailabs_low#mary_ann',
107
  ],
108
  # 9
 
110
  '09_Blechen_AII823_001.jpg',
111
  '09_Blechen_AII823_001.txt',
112
  'Cascade in Africa',
113
+ 'C. Blechen, Wasserfälle Bei Tivoli, 1832',
114
  'en_US/m-ailabs_low#mary_ann',
115
  ],
116
  # 10
 
118
  '10_Boecklin_967648_NG2-80_001_rsz.jpg',
119
  '10_Boecklin_967648_NG2-80_001.txt',
120
  'Hades ades at it sisland',
121
+ 'A. Böcklin, Toteninsel, 1883',
122
  'en_US/m-ailabs_low#mary_ann',
123
  ],
124
  # 11
 
126
  '11_Liebermann_NG4-94_001.jpg',
127
  '11_Liebermann_NG4-94_001.txt',
128
  'Tavern at the waterfront',
129
+ 'M. Tiebermann, Gartenlokal An Der Havel. Nikolskoe, 1916',
130
  'en_US/m-ailabs_low#mary_ann',
131
  ],
132
  # 12
 
134
  '12_Slevogt_AII1022_001.jpg',
135
  '12_Slevogt_AII1022_001.txt',
136
  'toy sailing yachts pool',
137
+ 'M. Slevogt, Segelboote Auf Der Alster Am Abend, 1905',
138
  'en_US/m-ailabs_low#mary_ann',
139
  ],
140
  ]
 
159
  fram = np.zeros((94, im.shape[1], 3), dtype=np.uint8)
160
  h, w, _ = fram.shape
161
  font = cv2.FONT_HERSHEY_SIMPLEX
162
+ bottomLeftCornerOfText = (4, 74) # OFFSET IN BANNER (240, 74) # w,h
163
  fontScale = 2
164
  fontColor = (255, 255, 255)
165
  thickness = 4
 
171
  fontColor,
172
  thickness,
173
  lineType)
174
+ offset_h = 24
175
  im[offset_h:h+offset_h, :w, :] = (.4 * im[offset_h:h+offset_h, :w, :] + .6 * fram).astype(np.uint8)
176
 
177
  cv2.imwrite('_tmp_banner.png', im)
uc_spk_Landscape2Soundscape_Masterpieces_pics/01_Schick_AII840_001.txt CHANGED
@@ -1 +1 @@
1
- After studying for four years with the legendary Parisian painter Jacques-Louis David, Christian Gottlieb Schick returned to Stuttgart in 1802. That very year, he began painting the portrait of Heinrike Dannecker, the wife of his close friend and mentor, Johann Heinrich Dannecker. The Danneckers' home, known as the "Danneckerei," was more than just a house—it was a hub for art lovers, filled with ancient sculpture replicas. Schick’s portrait of Heinrike wasn’t just any portrait, though. Her relaxed pose, with a clear and confident gaze, reflected a new sense of freedom for women, one that had grown in the wake of the French Revolution. It’s no accident that Heinrike’s outfit subtly nods to the colors of the French flagred, white, and blue. And the bouquet she holds, with bellflowers, roses, buttercups, and clover, stands out vividly against her deep blue dress, hinting at her natural, effortless beauty. Schick later wrote to Dannecker, “I remember struggling with the hand holding the flowers. I made all sorts of funny faces to help, and your wife and I laughed every time it came together. I was so happy painting her portrait.” Heinrike sits on a stone bench that brings to mind ancient ruins, her figure extending elegantly beyond the horizon, framed by soft curves that end with the graceful bend of her foot. Behind her, the landscape stretches into gentle mountain ranges, passing over dark green shrubs and a tranquil river valley. Schick masterfully captured her individuality while infusing a timeless, classical beauty. In this painting, Schick’s dream of blending classical ideals with real life reached a stunning peak. Interestingly, an unfinished version of this portrait—abandoned and trimmed by Schick himself—can still be found in the Staatsgalerie Stuttgart.
 
1
+ After studying for four years with the legendary Parisian painter Jacques-Louis David, Christian Gottlieb Shic returned to Stuttgart in 1802. That year he began painting the portrait of Heinrike Dannecker the wife of his close friend and mentor Johannheinrich Dannecker. The home of the Danneckers known as the Danneckeray become a living hub for art lovers filled with ancient sculpture replicas. Schic portrait of Heinrike wasn’t any portrait as her relaxed pose, appalled to a clear confidenence of gaze reflects a new sense of freedom for the woman, one that arose in the wake of the French Revolution. It’s no accident that Heinrike’s outfit subtly nods to the colors of the French flag red, white, and blue. And the bouquet she holds, with bellflowers, roses, buttercups, and clover, stands out vividly against her deep blue dress, hinting at an effortless beauty. Lady Heinrike sits on a stone reminiscent of ancient pillars, her figure extending elegantly beyond the horizon. Behind her, the landscape ravels horizons and mountain ranges down to a tranquil river valley Interestingly, an unfinished version of this portrait—abandoned and trimmed by Schick himself—can still be found in the Staatsgalerie Stuttgart.