rnnoise unknown RNN-based noise suppressor.

Loading...
Searching...
No Matches
rnnoise.h
1/* Copyright (c) 2018 Gregor Richards
2 * Copyright (c) 2017 Mozilla */
3/*
4 Redistribution and use in source and binary forms, with or without
5 modification, are permitted provided that the following conditions
6 are met:
7
8 - Redistributions of source code must retain the above copyright
9 notice, this list of conditions and the following disclaimer.
10
11 - Redistributions in binary form must reproduce the above copyright
12 notice, this list of conditions and the following disclaimer in the
13 documentation and/or other materials provided with the distribution.
14
15 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
16 ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
17 LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
18 A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR
19 CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
20 EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
21 PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
22 PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
23 LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
24 NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26*/
27
28#ifndef RNNOISE_H
29#define RNNOISE_H 1
30
31#include <stdio.h>
32
33#ifdef __cplusplus
34 extern "C" {
35#endif
36
37#ifndef RNNOISE_EXPORT
38# if defined(WIN32)
39# if defined(RNNOISE_BUILD) && defined(DLL_EXPORT)
40# define RNNOISE_EXPORT __declspec(dllexport)
41# else
42# define RNNOISE_EXPORT
43# endif
44# elif defined(__GNUC__) && defined(RNNOISE_BUILD)
45# define RNNOISE_EXPORT __attribute__ ((visibility ("default")))
46# else
47# define RNNOISE_EXPORT
48# endif
49#endif
50
51 typedef struct DenoiseState DenoiseState;
52 typedef struct RNNModel RNNModel;
53
57RNNOISE_EXPORT int rnnoise_get_size();
58
62RNNOISE_EXPORT int rnnoise_get_frame_size();
63
71RNNOISE_EXPORT int rnnoise_init(DenoiseState *st, RNNModel *model);
72
80RNNOISE_EXPORT DenoiseState *rnnoise_create(RNNModel *model);
81
87RNNOISE_EXPORT void rnnoise_destroy(DenoiseState *st);
88
94RNNOISE_EXPORT float rnnoise_process_frame(DenoiseState *st, float *out, const float *in);
95
102RNNOISE_EXPORT RNNModel *rnnoise_model_from_buffer(const void *ptr, int len);
103
104
111RNNOISE_EXPORT RNNModel *rnnoise_model_from_file(FILE *f);
112
118RNNOISE_EXPORT RNNModel *rnnoise_model_from_filename(const char *filename);
119
125RNNOISE_EXPORT void rnnoise_model_free(RNNModel *model);
126
127#ifdef __cplusplus
128}
129#endif
130
131#endif