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

Add normalization to sox call. #23

Merged
merged 2 commits into from
Mar 29, 2021
Merged
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
4 changes: 2 additions & 2 deletions autosub/audioProcessing.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ def convert_samplerate(audio_path, desired_sample_rate):
numpy buffer: audio signal stored in numpy array
"""

sox_cmd = "sox {} --type raw --bits 16 --channels 1 --rate {} --encoding signed-integer --endian little --compression 0.0 --no-dither - ".format(
sox_cmd = "sox {} --type raw --bits 16 --channels 1 --rate {} --encoding signed-integer --endian little --compression 0.0 --no-dither norm -3.0 - ".format(
quote(audio_path), desired_sample_rate)
try:
output = subprocess.check_output(
Expand All @@ -45,4 +45,4 @@ def convert_samplerate(audio_path, desired_sample_rate):
raise OSError(e.errno, "SoX not found, use {}hz files or install it: {}".format(
desired_sample_rate, e.strerror))

return np.frombuffer(output, np.int16)
return np.frombuffer(output, np.int16)