Git Product home page Git Product logo

audacity-noise-reduction's Introduction

audacity-noise-reduction

2-pass noise reduction, pulled out of Audacity

Usage

Driver

The following commands will build and run the driver, i.e. the main application.

$ ./build_driver.sh
$ ./build/noisereduction_driver --help

In the directory test there are some examples to test the driver.
They can be run with the corresponding shell script run.sh.
For example:

$ cd test/separate-track-for-profiling/mono
$ ./run.sh

Test

The following command will build and run automated tests.

$ ./test.sh

Clean

The following command will clean the build directory.

$ ./clean.sh

Dependencies

  • CMake
  • libsndfile

Linux

$ sudo apt-get install cmake
$ sudo apt-get install libsndfile-dev

MacOS

$ brew install cmake
$ brew install libsndfile

audacity-noise-reduction's People

Contributors

jakobrobert avatar somewacko avatar tals avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

audacity-noise-reduction's Issues

Provide interface to use buffers instead of files

I think it would be very useful to be able to pass audio buffers as float vectors to the profileNoise and reduceNoise methods instead of loading a track from a file.

For my purposes I required this type of interface and I have adjusted the NoiseReduction class accordingly.

I would like to integrate my changes by integrating my versions of the profileNoise and reduceNoise in addition to the existing ones.

If you agree, let me know.

compile error: fatal error: 'sndfile.h' file not found

clang++ -MT .o/noisereduction/main.o -MD -MP -MF .d/noisereduction/main.Td -std=c++11 -Wall -Wextra -pedantic -DNDEBUG -Ofast -c -o .o/noisereduction/main.o noisereduction/main.cpp
In file included from noisereduction/main.cpp:2:
noisereduction/NoiseReduction.h:10:10: fatal error: 'sndfile.h' file not found
#include <sndfile.h>
^~~~~~~~~~~
1 error generated.
make: *** [Makefile:115: .o/noisereduction/main.o] Error 1

Is POSIX API necessary?

I have realized that functions specific to the POSIX API are used, especially in Utils.cpp for the SndMap class:

#include <sys/stat.h>
#include <sys/mman.h>
#include <sys/types.h>
#include <fcntl.h>
#include <unistd.h>

These functions are available under Linux and Mac OS, but not under Windows. I think this is the main reason why I cannot compile the project under Windows. Because I am a Windows user and only have a Linux VM, I would like to compile the project directly under Windows.

Are these functions really necessary or could they be replaced by some standard library functions? What is the purpose of SndMap in general rather than just giving the the file path to sf_open_virtual() directly?

Extend CLI for new buffer based API

I think with the new buffer based API (see pull request #7) it would also be useful to extend the command line interface (CLI).

My suggestion is to add an optional parameter --profile for the case that the noise signal required for profiling is contained in a separate track rather than being part of the input track. In this case, the time indices t0 and t1 should be ignored.

So you should be able to execute the app as follows:

./bin/noisereduction_driver --input signal_with_noise.wav --profile noise.wav --output signal_clean.wav

If you think this is useful, let me know, I can implement it :)

Problems with compiling and linking using Linux and GCC compiler

Hey @tals

I wanted to integrate my changes as discussed in #5, but I have problems getting the project running.
I am using Linux and the GCC compiler and I have some problems with compiling and linking.
I use the provided Makefile and have just replaced clang/clang++ by gcc / g++.

Compiler Errors

I could successfully fix the compiler errors, which were the following:

I had to rename "types.h" to "Types.h".

I had to the include "cstring" which is required for memmove and memcpy.

I got the error "designator order for field 'SF_INFO::samplerate' does not match declaration order in 'SF_INFO'".
This means there is a problem with the used shortcut definition of structs.
Instead of this:

SF_INFO info = {
        .channels = channels,
        .format = OUTPUT_FORMAT,
        .samplerate = mCtx.info.samplerate,
    };

I need to write it like this:

SF_INFO info = { };
info.channels = channels;
info.format = OUTPUT_FORMAT;
info.samplerate = mCtx.info.samplerate;

Did you have errors like these as well?
If not, I guess that clang is just more tolerant than gcc.
Fortunately, I could fix these compiler errors and get rid of some by adding the flag "-fpermissive" to the Makefile.
But there are still many compiler warnings, many things seem to be against the C++11 standard, so I guess we should do some major clean up.

Linker Errors

Unfortunately, I still have linker problems with libsndfile.
I installed it by the command "sudo apt-get install libsndfile-1-dev".
The linker can find the library, because the error "cannot find -lsndfile" has disappeared.
But still I get linker errors such as "undefined reference to 'sf_open'".
So even though the linker can find libsndfile, it cannot find the individual functions.
Surprisingly, I have the same problems with pthread, e.g.: "undefined reference to 'pthread_once'"

Do you have any idea how to fix that?

Thanks in advance.

Copy dll files using CMake?

Windows expects the dll files for libsndfile to be in the same directory as the executable, linking the lib alone is not sufficient. Therefore, in #12 I have copied the dll files using the batch file.

In my opinion, this is a bit hacky. Do you know, if there is a more elegant way by copying files to the build directory using CMake? This scenario should not be that uncommon, because e.g. in a game you also would have to copy the assets like images, audio files to the build directory.

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.