neuralworm commited on
Commit
83de385
·
verified ·
1 Parent(s): 39047c3

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -1
app.py CHANGED
@@ -65,7 +65,14 @@ def generate_vinyl_sound(noise_ratio, lowcut, highcut, duration, pop_rate, rpm,
65
 
66
 
67
  def convert_to_wav(data, sample_rate):
68
- # ... (This function remains the same) ...
 
 
 
 
 
 
 
69
 
70
 
71
  def play_and_download_sound(noise_ratio, lowcut, highcut, duration, pop_rate, rpm, rumble_level, hiss_level):
 
65
 
66
 
67
  def convert_to_wav(data, sample_rate):
68
+ # Normalize to between -1 and 1
69
+ data /= np.max(np.abs(data))
70
+
71
+ # Save to a temporary .wav file
72
+ temp_file = tempfile.mktemp(suffix=".wav")
73
+ sf.write(temp_file, data, sample_rate)
74
+
75
+ return temp_file
76
 
77
 
78
  def play_and_download_sound(noise_ratio, lowcut, highcut, duration, pop_rate, rpm, rumble_level, hiss_level):