Dionyssos commited on
Commit
4b59bb9
·
1 Parent(s): d2ffdd6

fx non-periodicity of sound background

Browse files
README.md CHANGED
@@ -21,6 +21,7 @@ tags:
21
 
22
  # Affective TTS - SoundScape
23
  - [SHIFT TTS tool](https://github.com/audeering/shift)
 
24
  - Soundscapes `e.g. trees, water, leaves,`, generation via [AudioGen](https://huggingface.co/dkounadis/artificial-styletts2/discussions/3)
25
  - `landscape2soundscape.py` shows how to overlay TTS & Soundscape to Images and create videos
26
  - `134` TTS Voices - Affective / Non-affective mode for every voice
@@ -130,6 +131,17 @@ From an image and text create a video:
130
  python tts.py --text sample.txt --image assets/image_from_T31.jpg
131
  ```
132
 
 
 
 
 
 
 
 
 
 
 
 
133
 
134
  # Live Demo - Paplay
135
 
 
21
 
22
  # Affective TTS - SoundScape
23
  - [SHIFT TTS tool](https://github.com/audeering/shift)
24
+ - Analysis of Emotionality [Issue #1](https://huggingface.co/dkounadis/artificial-styletts2/discussions/2)
25
  - Soundscapes `e.g. trees, water, leaves,`, generation via [AudioGen](https://huggingface.co/dkounadis/artificial-styletts2/discussions/3)
26
  - `landscape2soundscape.py` shows how to overlay TTS & Soundscape to Images and create videos
27
  - `134` TTS Voices - Affective / Non-affective mode for every voice
 
131
  python tts.py --text sample.txt --image assets/image_from_T31.jpg
132
  ```
133
 
134
+ ## Landscape 2 Soundscape
135
+
136
+ <a href="https://www.youtube.com/watch?v=FCYS29OrA1s" rel='01_Schick_AII840_001.jpg'>![01_Schick_AII840_001](uc_spk_Landscape2Soundscape_Masterpieces_pics/01_Schick_AII840_001.jpg)
137
+
138
+
139
+
140
+ ```python
141
+ # Loads image & text & sound-scene text and creates .mp4
142
+ python landscape2soundscape.py
143
+ ```
144
+
145
 
146
  # Live Demo - Paplay
147
 
api.py CHANGED
@@ -45,24 +45,40 @@ def _shift(x):
45
  def overlay(x, scene=None):
46
  if scene is not None:
47
 
48
- n_repeat = len(x) // ((SOUNDSCAPE_DURATION + 1) * 24000)
49
- sound_background = []
50
- for _ in range(n_repeat):
51
- print(f'AudioCraft: {_} of {n_repeat}', end='\r')
52
- x = sound_generator.generate(
53
- [scene]
54
- )[0].detach().cpu().numpy()[0, :]
55
- x = audresample.resample(x,
56
- original_rate=sound_generator.sample_rate, # 16000
57
- target_rate=24000)[0, :]
58
- sound_background.append(x)
59
- sound_background = np.concatenate(sound_background)
60
-
61
- for d in range(10):
62
- # roll long audio to concentrate the peaks
63
- sound_background = _shift(sound_background)
64
- print(f'\n====SOUND BACKGROUND SHAPE\n{sound_background.shape=}{np.abs(sound_background.max())=}\n{x.shape=}\n- - - -')
65
- x = .9 * x + .1 * sound_background[:len_speech]
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
66
  else:
67
  print('sound_background = None')
68
  return x
 
45
  def overlay(x, scene=None):
46
  if scene is not None:
47
 
48
+ # generate 4
49
+ print('Generating AudioCraft')
50
+ back = [sound_generator.generate(
51
+ [scene]
52
+ )[0].detach().cpu().numpy()[0, :] for _ in range(4)]
53
+
54
+ print([j.shape for j in back], len(back), 'BACK')
55
+
56
+ # upsample to 24kHZ of StyleTTS
57
+ print('Resampling')
58
+ back = [audresample.resample(i,
59
+ original_rate=sound_generator.sample_rate, # 16000
60
+ target_rate=24000
61
+ )[0, :] for i in back]
62
+ print('Cloning backgrounds')
63
+ # clone/elongate by 4x
64
+ back = [(_shift(np.concatenate([single_gen] * 4))) for single_gen in back]
65
+
66
+
67
+ # long ~30s
68
+ back = np.concatenate(back)
69
+ for _ in range(4):
70
+ back = _shift(back)
71
+
72
+ # clone to exact len of TTS
73
+ n_repeat = len(x) // back.shape[0] + 2
74
+
75
+ # Additional Repeat - Reach full length of TTS
76
+ print(f'Additional Repeat {n_repeat=}')
77
+ back = np.concatenate(n_repeat * [back])
78
+ back = _shift(back)
79
+ print(f'\n====SOUND BACKGROUND SHAPE\n{back.shape=}',
80
+ f'{np.abs(back.max())=}\n{x.shape=}')
81
+ x = .9 * x + .1 * back[:len(x)]
82
  else:
83
  print('sound_background = None')
84
  return x
landscape2soundscape.py CHANGED
@@ -45,9 +45,9 @@ DESCRIPTIONS = [
45
  [
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
53
  [
@@ -87,7 +87,7 @@ DESCRIPTIONS = [
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
93
  [
@@ -103,7 +103,7 @@ DESCRIPTIONS = [
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
109
  [
@@ -119,7 +119,7 @@ DESCRIPTIONS = [
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
125
  [
@@ -127,7 +127,7 @@ DESCRIPTIONS = [
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
133
  [
 
45
  [
46
  '01_Schick_AII840_001.jpg', # image
47
  '01_Schick_AII840_001.txt', # text
48
+ 'statue in shire ruisseau.', # audiocraft
49
  'G. Schick, Bildnis der Heinrike Dannecker, 1802', # cv2 puttext title
50
+ 'en_US/m-ailabs_low#judy_bieber', #'en_US/m-ailabs_low#mary_ann',
51
  ],
52
  # 2
53
  [
 
87
  '06_Menzel_AI900_001.txt',
88
  'Olive Seville',
89
  'A. Menzel, Bauplatz mit Weiden, 1846',
90
+ 'en_US/cmu-arctic_low#aup',
91
  ],
92
  # 7
93
  [
 
103
  '08_Monet_AI1013_001.txt',
104
  'Mai flowers blossom picnic',
105
  'C. Monet, Sommertag, 1874',
106
+ 'en_US/cmu-arctic_low#axb',
107
  ],
108
  # 9
109
  [
 
119
  '10_Boecklin_967648_NG2-80_001.txt',
120
  'Hades ades at it sisland',
121
  'A. Böcklin, Toteninsel, 1883',
122
+ 'en_US/cmu-arctic_low#jmk',
123
  ],
124
  # 11
125
  [
 
127
  '11_Liebermann_NG4-94_001.txt',
128
  'Tavern at the waterfront',
129
  'M. Tiebermann, Gartenlokal An Der Havel. Nikolskoe, 1916',
130
+ 'en_US/cmu-arctic_low#ljm',
131
  ],
132
  # 12
133
  [
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 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.
 
1
+ After studying for four years with the legendary Parisian painter Jacques-Louis David, Christian Gottlieb Shick returned to Stuttgart in 1802. That year he began painting the portrait of Heinrike, the wife of his close friend and mentor Johannes Heinrich Dannecker. The home of the Danneckers was 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 ortrait—abandoned and trimmed by Shick himself—can still be found in the Staatsgalerie Stuttgart.