balthou commited on
Commit
3ffc2f6
·
1 Parent(s): ebfe618

remove audio generation

Browse files
Files changed (2) hide show
  1. core.py +1 -14
  2. core_audio.py +13 -0
core.py CHANGED
@@ -69,18 +69,6 @@ def extract_profile(img: np.ndarray, context={}) -> Curve:
69
  )
70
 
71
 
72
- def create_audio(img, context={}):
73
- audio_length_seconds = 0.5
74
- time_axis = np.linspace(0, audio_length_seconds,
75
- int(audio_length_seconds*44100))
76
- modulation = np.interp(time_axis, np.linspace(
77
- 0., 1., img.shape[0]), img[:, 0, 0])
78
- frequency = 440 * (1 + context.get('freq', 0)/100.)
79
- audio_1 = (np.sin(2 * np.pi * frequency * time_axis))
80
- audio_2 = (modulation*np.sin(2 * np.pi * 300 * time_axis))
81
- return audio_1, audio_2
82
-
83
-
84
  # -------------------
85
  # Pipeline definition
86
  # -------------------
@@ -92,8 +80,7 @@ def tutorial_pipeline():
92
  out_bnw = change_color(inp)
93
  out_image = compare_by_splitting(out_geometry, out_bnw)
94
  out_profile = extract_profile(out_image)
95
- audio_1, audio_2 = create_audio(out_image)
96
- return [[inp, out_geometry], [out_profile, out_image], [audio_1, audio_2]]
97
 
98
  # -----------------------------------------------------------------------------------------
99
  # Other layout you can try! None will create an empty space.
 
69
  )
70
 
71
 
 
 
 
 
 
 
 
 
 
 
 
 
72
  # -------------------
73
  # Pipeline definition
74
  # -------------------
 
80
  out_bnw = change_color(inp)
81
  out_image = compare_by_splitting(out_geometry, out_bnw)
82
  out_profile = extract_profile(out_image)
83
+ return [[inp, out_geometry], [out_profile, out_image]]
 
84
 
85
  # -----------------------------------------------------------------------------------------
86
  # Other layout you can try! None will create an empty space.
core_audio.py ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import numpy as np
2
+
3
+
4
+ def create_audio(img, context={}):
5
+ audio_length_seconds = 0.5
6
+ time_axis = np.linspace(0, audio_length_seconds,
7
+ int(audio_length_seconds*44100))
8
+ modulation = np.interp(time_axis, np.linspace(
9
+ 0., 1., img.shape[0]), img[:, 0, 0])
10
+ frequency = 440 * (1 + context.get('freq', 0)/100.)
11
+ audio_1 = (np.sin(2 * np.pi * frequency * time_axis))
12
+ audio_2 = (modulation*np.sin(2 * np.pi * 300 * time_axis))
13
+ return audio_1, audio_2