Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update function create_data #17

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions prepare_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from data_tools import audio_files_to_numpy
from data_tools import blend_noise_randomly, numpy_audio_to_matrix_spectrogram
import numpy as np

import soundfile as sf


def create_data(noise_dir, voice_dir, path_save_time_serie, path_save_sound, path_save_spectrogram, sample_rate,
Expand Down Expand Up @@ -43,11 +43,13 @@ def remove_ds_store(lst):

# To save the long audio generated to disk to QC:
noisy_voice_long = prod_noisy_voice.reshape(1, nb_samples * frame_length)
librosa.output.write_wav(path_save_sound + 'noisy_voice_long.wav', noisy_voice_long[0, :], sample_rate)
sf.write(path_save_sound + 'noisy_voice_long.wav', noisy_voice_long[0, :], sample_rate)

voice_long = prod_voice.reshape(1, nb_samples * frame_length)
librosa.output.write_wav(path_save_sound + 'voice_long.wav', voice_long[0, :], sample_rate)
sf.write(path_save_sound + 'voice_long.wav', voice_long[0, :], sample_rate)

noise_long = prod_noise.reshape(1, nb_samples * frame_length)
librosa.output.write_wav(path_save_sound + 'noise_long.wav', noise_long[0, :], sample_rate)
sf.write(path_save_sound + 'noise_long.wav', noise_long[0, :], sample_rate)

# Squared spectrogram dimensions
dim_square_spec = int(n_fft / 2) + 1
Expand Down
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@ matplotlib
numpy==1.17.2
scipy==1.3.1
sklearn
PySoundFile