aubio  0.4.9
Typedefs | Functions
sink.h File Reference

Media sink to write blocks of consecutive audio samples to file. More...

Go to the source code of this file.

Typedefs

typedef struct _aubio_sink_t aubio_sink_t
 media sink object
 

Functions

aubio_sink_tnew_aubio_sink (const char_t *uri, uint_t samplerate)
 create new aubio_sink_t More...
 
uint_t aubio_sink_preset_samplerate (aubio_sink_t *s, uint_t samplerate)
 preset sink samplerate More...
 
uint_t aubio_sink_preset_channels (aubio_sink_t *s, uint_t channels)
 preset sink channels More...
 
uint_t aubio_sink_get_samplerate (const aubio_sink_t *s)
 get samplerate of sink object More...
 
uint_t aubio_sink_get_channels (const aubio_sink_t *s)
 get channels of sink object More...
 
void aubio_sink_do (aubio_sink_t *s, fvec_t *write_data, uint_t write)
 write monophonic vector of length hop_size to sink More...
 
void aubio_sink_do_multi (aubio_sink_t *s, fmat_t *write_data, uint_t write)
 write polyphonic vector of length hop_size to sink More...
 
uint_t aubio_sink_close (aubio_sink_t *s)
 close sink More...
 
void del_aubio_sink (aubio_sink_t *s)
 close sink and cleanup memory More...
 

Detailed Description

Media sink to write blocks of consecutive audio samples to file.

To read from file, use aubio_source_t.

Depending on how aubio was compiled, the following sinks will be available.

When creating a new sink using new_aubio_sink, the new function of each of the compiled-in sinks will be attempted, in the following order, until one of them gets successfully created. If all sinks returned NULL, new_aubio_sink will return NULL.

sink_apple_audio : ExtAudioFileRef

This sink uses CoreAudio Extended Audio File Services to write 16-bits encoded WAV files.

sink_sndfile : libsndfile

This sink uses libsndfile to write 16-bits encoded WAV files.

sink_wavwrite : native WAV write

A simple sink to write 16-bits PCM RIFF encoded WAV files.

Definition in file sink.h.

Function Documentation

◆ aubio_sink_close()

uint_t aubio_sink_close ( aubio_sink_t s)

close sink

Parameters
ssink object, created with new_aubio_sink
Returns
0 on success, non-zero on failure
Examples:
io/test-sink.c.

◆ aubio_sink_do()

void aubio_sink_do ( aubio_sink_t s,
fvec_t write_data,
uint_t  write 
)

write monophonic vector of length hop_size to sink

Parameters
ssink, created with new_aubio_sink
write_datafvec_t samples to write to sink
writenumber of frames to write
Examples:
io/test-sink.c, synth/test-sampler.c, and synth/test-wavetable.c.

◆ aubio_sink_do_multi()

void aubio_sink_do_multi ( aubio_sink_t s,
fmat_t write_data,
uint_t  write 
)

write polyphonic vector of length hop_size to sink

Parameters
ssink, created with new_aubio_sink
write_datafmat_t samples to write to sink
writenumber of frames to write
Examples:
io/test-sink.c.

◆ aubio_sink_get_channels()

uint_t aubio_sink_get_channels ( const aubio_sink_t s)

get channels of sink object

Parameters
ssink object, created with new_aubio_sink
Returns
number of channels
Examples:
io/test-sink.c.

◆ aubio_sink_get_samplerate()

uint_t aubio_sink_get_samplerate ( const aubio_sink_t s)

get samplerate of sink object

Parameters
ssink object, created with new_aubio_sink
Returns
samplerate, in Hz
Examples:
io/test-sink.c.

◆ aubio_sink_preset_channels()

uint_t aubio_sink_preset_channels ( aubio_sink_t s,
uint_t  channels 
)

preset sink channels

Parameters
ssink, created with new_aubio_sink
channelsnumber of channels to preset the sink to
Returns
0 on success, 1 on error

Preset the samplerate of the sink. The file should have been created using a samplerate of 0.

The file will be opened only when both samplerate and channels have been set.

Examples:
io/test-sink.c.

◆ aubio_sink_preset_samplerate()

uint_t aubio_sink_preset_samplerate ( aubio_sink_t s,
uint_t  samplerate 
)

preset sink samplerate

Parameters
ssink, created with new_aubio_sink
sampleratesamplerate to preset the sink to, in Hz
Returns
0 on success, 1 on error

Preset the samplerate of the sink. The file should have been created using a samplerate of 0.

The file will be opened only when both samplerate and channels have been set.

Examples:
io/test-sink.c.

◆ del_aubio_sink()

void del_aubio_sink ( aubio_sink_t s)

close sink and cleanup memory

Parameters
ssink object, created with new_aubio_sink
Examples:
io/test-sink.c, synth/test-sampler.c, and synth/test-wavetable.c.

◆ new_aubio_sink()

aubio_sink_t* new_aubio_sink ( const char_t uri,
uint_t  samplerate 
)

create new aubio_sink_t

Parameters
urithe file path or uri to write to
sampleratesample rate to write the file at
Returns
newly created aubio_sink_t

Creates a new sink object.

If samplerate is set to 0, the creation of the file will be delayed until both aubio_sink_preset_samplerate and aubio_sink_preset_channels have been called.

Examples:
io/test-sink.c, synth/test-sampler.c, and synth/test-wavetable.c.