/usr/share/doc/libsndobj-dev/examples/transpose.cpp is in libsndobj-dev 2.6.6.1-3.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 | #include <SndObj/AudioDefs.h>
#include <stdio.h>
void Usage(char* progr);
int
main(int argc, char** argv){
float dur, pitch;
int formants;
if(argc == 4){
dur = (float) atof(argv[1]);
pitch = (float) atof(argv[2]);
formants = atoi(argv[3]);
}
else {
Usage(argv[0]);
exit(1);
}
#ifndef MACOSX
SndRTIO output(1, SND_OUTPUT);
SndRTIO input(1, SND_INPUT);
#else
SndCoreAudio io(1);
#define input io
#define output io
#endif
HammingTable window(1024, 0.54f);
SndIn in(&input);
PVA anal(&window, &in);
PVTransp trans(&anal, pitch,formants);
PVS synth(&window, &trans);
output.SetOutput(1, &synth);
int end = (int)(dur*DEF_SR/DEF_VECSIZE);
for(int i=0; i<end; i++){
input.Read();
in.DoProcess();
anal.DoProcess();
trans.DoProcess();
synth.DoProcess();
output.Write();
}
return 0;
}
void Usage(char* progr) {
cout << progr << " dur(s) pitch formants\n";
cout << " where pitch is the transposition factor\n";
cout << " and formants => 1=keep formants 0=ignore formants\n";
}
|