mirror of
https://github.com/vale981/openAV-Luppp
synced 2025-03-04 16:51:37 -05:00
-Audio being pitch-shifted, algorithm needs tuning to keep pitch steady.
This commit is contained in:
parent
b45f635a12
commit
163a4b7a28
3 changed files with 20 additions and 8 deletions
|
@ -24,8 +24,6 @@ static void gmastertrack_button_callback(Fl_Widget *w, void *data) {
|
|||
if ( data )
|
||||
track = *(int*)data;
|
||||
|
||||
cout << "Button " << track << " " << w->label() << " clicked" << endl;
|
||||
|
||||
if ( strcmp( w->label(), "Metro" ) == 0 )
|
||||
{
|
||||
Avtk::Button* b = (Avtk::Button*)w;
|
||||
|
|
|
@ -29,7 +29,7 @@ Gui::Gui() :
|
|||
{
|
||||
window.color(FL_BLACK);
|
||||
window.label("Luppp 5");
|
||||
window.callback( close_cb, 0 );
|
||||
//window.callback( close_cb, 0 );
|
||||
|
||||
Avtk::Image* header = new Avtk::Image(0,0,600,36,"header.png");
|
||||
|
||||
|
|
|
@ -61,19 +61,37 @@ void Looper::process(int nframes, Buffers* buffers)
|
|||
float* in = buffers->audio[Buffers::MASTER_INPUT];
|
||||
float* out = buffers->audio[Buffers::MASTER_OUTPUT];
|
||||
|
||||
float playbackSpeed = endPoint / ( float(numBeats) * fpb );
|
||||
// invert the change due to speed, and pitch-shift it back to normal :D
|
||||
float deltaPitch = 12 * log ( playbackSpeed ) / log (2);
|
||||
semitoneShift = -deltaPitch;
|
||||
|
||||
if (track == 0)
|
||||
{
|
||||
// log pitch-shift rates
|
||||
char buffer [50];
|
||||
sprintf (buffer, "Looper, pbs=%f, dP=%f", playbackSpeed, deltaPitch );
|
||||
EventGuiPrint e( buffer );
|
||||
writeToGuiRingbuffer( &e );
|
||||
}
|
||||
|
||||
if ( state == STATE_PLAYING )
|
||||
{
|
||||
for(int i = 0; i < nframes; i++)
|
||||
{
|
||||
if ( playPoint < endPoint )
|
||||
{
|
||||
tmpBuffer[i] += sample[playPoint];
|
||||
tmpBuffer[i] = sample[playPoint];
|
||||
}
|
||||
// always update playPoint, even when not playing sound.
|
||||
// it updates the UI of progress
|
||||
playPoint++;
|
||||
}
|
||||
|
||||
|
||||
// not pitch-shift the audio in the buffer
|
||||
pitchShift( nframes, &tmpBuffer[0], out);
|
||||
|
||||
float prog = (float(playPoint) / (fpb*numBeats));
|
||||
|
||||
/*
|
||||
|
@ -96,10 +114,6 @@ void Looper::process(int nframes, Buffers* buffers)
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
// not pitch-shift the audio in the buffer
|
||||
pitchShift( nframes, &tmpBuffer[0], out);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue