(audio_float, sample_rate, output_path, dither=False)
| 132 | |
| 133 | |
| 134 | def write_wav(audio_float, sample_rate, output_path, dither=False): |
| 135 | num_channels = audio_float.shape[1] if audio_float.ndim > 1 else 1 |
| 136 | audio_float = remove_dc(audio_float) |
| 137 | audio_float = normalize_per_channel(audio_float, headroom_db=0.5) |
| 138 | int_data = float_to_int16(audio_float, dither=dither) |
| 139 | |
| 140 | with wave.open(output_path, "w") as wf: |
| 141 | wf.setnchannels(num_channels) |
| 142 | wf.setsampwidth(2) # 16 bit PCM |
| 143 | wf.setframerate(sample_rate) |
| 144 | wf.writeframes(int_data.tobytes()) |
| 145 | |
| 146 | |
| 147 | def convert_csv_to_wav( |
no test coverage detected