Coder Social home page Coder Social logo

Comments (5)

iver56 avatar iver56 commented on August 23, 2024

Some things to check:

  1. sounds_path should refer to a folder, not a file

  2. If the clean file is all silence, then the output will also be all silence, since the level of the added noise is relative to the amount of signal

If this does not help, can you please share the audio files to help reproduce the issue?

from audiomentations.

iver56 avatar iver56 commented on August 23, 2024

@scasasso Are you still having this issue? Did you do more digging based on my comment above?

from audiomentations.

iver56 avatar iver56 commented on August 23, 2024

I added a note to the AddBackgroundNoise docstring. Closing this issue now due to lack of response. Let's reopen this if it's a bug that can be reproduced and should be fixed.

from audiomentations.

laoyin avatar laoyin commented on August 23, 2024

Some things to check:

  1. sounds_path should refer to a folder, not a file
  2. If the clean file is all silence, then the output will also be all silence, since the level of the added noise is relative to the amount of signal

If this does not help, can you please share the audio files to help reproduce the issue?

BAC009S0002W0122.wav.zip

@iver56

import numpy as np
import time
import os
from scipy.io import wavfile
from audiomentations import (
    AddGaussianNoise,
    TimeStretch,
    PitchShift,
    Shift,
    Normalize,
    FrequencyMask,
    TimeMask,
    AddGaussianSNR,
    Resample,
    ClippingDistortion,
    AddBackgroundNoise,
    AddShortNoises,
    PolarityInversion,
    Gain,
    Mp3Compression,
    LoudnessNormalization,
    Trim,
    LowPassFilter,
    HighPassFilter,
    BandPassFilter,
    ApplyImpulseResponse,
    Reverse,
)
from audiomentations.core.audio_loading_utils import load_sound_file
from audiomentations.core.transforms_interface import (
    MultichannelAudioNotSupportedException,
)
import librosa

noise_path = '/home/yinxingpan/audio_mentation/bg_noises'

augment = AddBackgroundNoise(
    sounds_path=noise_path,
    p=1
)



def read_raw_audio(audio, sample_rate=16000):
    wave, _ = librosa.load(os.path.expanduser(audio), sr=sample_rate)
    return wave


my_audio = read_raw_audio("abc.wav")

my_audio_with_noise = augment(my_audio, 16000)

wavfile.write("abc1.wav", rate=16000, data=my_audio_with_noise)

from audiomentations.

iver56 avatar iver56 commented on August 23, 2024

@laoyin are you having this issue with AddBackgroundNoise as well? I see you added a speech recording and some code. Can you give me a bit more context?

from audiomentations.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.