Zrythm
a highly automated and intuitive digital audio workstation
Loading...
Searching...
No Matches
stretcher.h
Go to the documentation of this file.
1// SPDX-FileCopyrightText: © 2019-2020 Alexandros Theodotou <alex@zrythm.org>
2// SPDX-License-Identifier: LicenseRef-ZrythmLicense
3
10#ifndef __AUDIO_STRETCHER_H__
11#define __AUDIO_STRETCHER_H__
12
13#include <cstddef>
14#include <sys/types.h>
15
16#include "utils/types.h"
17
18#include <rubberband/rubberband-c.h>
19
38
42typedef struct Stretcher
43{
44 StretcherBackend backend;
45
47 RubberBandState rubberband_state;
48
49 unsigned int samplerate;
50 unsigned int channels;
51
52 bool is_realtime;
53
59 unsigned int block_size;
60} Stretcher;
61
75 unsigned int samplerate,
76 unsigned int channels,
77 double time_ratio,
78 double pitch_ratio,
79 bool realtime);
80
93ssize_t
95 Stretcher * self,
96 float * in_samples_l,
97 float * in_samples_r,
98 size_t in_samples_size,
99 float * out_samples_l,
100 float * out_samples_r,
101 size_t out_samples_wanted);
102
106unsigned int
108
109void
110stretcher_set_time_ratio (Stretcher * self, double ratio);
111
123ssize_t
125 Stretcher * self,
126 float * in_samples,
127 size_t in_samples_size,
128 float ** _out_samples);
129
133void
135
140#endif
ssize_t stretcher_stretch_interleaved(Stretcher *self, float *in_samples, size_t in_samples_size, float **_out_samples)
Perform stretching.
ssize_t stretcher_stretch(Stretcher *self, float *in_samples_l, float *in_samples_r, size_t in_samples_size, float *out_samples_l, float *out_samples_r, size_t out_samples_wanted)
Perform stretching.
unsigned int stretcher_get_latency(Stretcher *self)
Get latency in number of samples.
StretcherBackend
Definition stretcher.h:27
Stretcher * stretcher_new_rubberband(unsigned int samplerate, unsigned int channels, double time_ratio, double pitch_ratio, bool realtime)
Create a new Stretcher using the rubberband backend.
void stretcher_free(Stretcher *self)
Frees the resampler.
@ STRETCHER_BACKEND_SBSMS
SBSMS - Subband Sinusoidal Modeling Synthesis.
@ STRETCHER_BACKEND_PAULSTRETCH
Paulstretch.
@ STRETCHER_BACKEND_RUBBERBAND
Lib rubberband.
Stretcher interface.
Definition stretcher.h:43
RubberBandState rubberband_state
For rubberband API.
Definition stretcher.h:47
unsigned int block_size
Size of the block to process in each iteration.
Definition stretcher.h:59
Custom types.