Files: mincer.h, mincer.c

Phase-locked vocoder.
Mincer is a phase-locked vocoder. It has the ability to play back an audio file loaded into an ftable like a sampler would. Unlike a typical sampler, mincer allows time and pitch to be controlled separately.


sp_mincer_create(sp_mincer **mincer)
sp_mincer_init(sp_data *sp, sp_mincer *mincer, sp_ftbl *ft, int winsize)
sp_mincer_compute(sp_data *sp, sp_mincer *mincer, SPFLOAT *dummy, SPFLOAT *out)
sp_mincer_destroy(sp_mincer **mincer)

Mandatory Parameters

ft: ftable containing an audio file.
(Recommended value: N/A)
winsize: FFT window size. Should be a power of 2.
(Recommended value: 2048)

Optional Parameters

time: Position in time. When non-changing it will do a spectral freeze of a the current point in time.
(Default value: 0)
amp: Amplitude.
(Default value: 1)
pitch: Pitch ratio. A value of. 1 normal, 2 is double speed, 0.5 is halfspeed, etc.
(Default value: 1)


out: Signal output.

Example Code

#include <stdlib.h>
#include <stdio.h>
#include <time.h>
#include "soundpipe.h"

typedef struct {
    sp_mincer *mincer;
    sp_ftbl *ft; 
    sp_randi *randi;
} UserData;

void process(sp_data *sp, void *udata) {
    UserData *ud = udata;
    SPFLOAT osc = 0, mincer = 0, randi = 0;
    sp_randi_compute(sp, ud->randi, NULL, &randi);
    ud->mincer->time = randi;
    ud->mincer->amp = 1;
    ud->mincer->pitch = 1;
    sp_mincer_compute(sp, ud->mincer, NULL, &mincer);
    sp->out[0] = mincer;

int main() {
    UserData ud;
    sp_data *sp;
    sp_srand(sp, 1234567);

    /* allocates loads an audio file into a ftable */
    sp_ftbl_loadfile(sp, &ud.ft, "oneart.wav");


    sp_mincer_init(sp, ud.mincer, ud.ft, 16384);
    sp_randi_init(sp, ud.randi);
    ud.randi->min = 0;
    ud.randi->max = 1;
    ud.randi->cps = 1;

    sp->len = 44100 * 5;
    sp_process(sp, &ud, process);


    return 0;