fix: adjust pitch, not just speed
This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@@ -12,3 +12,4 @@
|
|||||||
app/src/main/obj/
|
app/src/main/obj/
|
||||||
.cxx
|
.cxx
|
||||||
/txts
|
/txts
|
||||||
|
/data
|
||||||
@@ -231,7 +231,9 @@ void PlaybackEngine::musicFeedThread() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if(haveTimeRatio.load()) {
|
if(haveTimeRatio.load()) {
|
||||||
stretcher.setTimeRatio(timeRatio.load());
|
double ratio = timeRatio.load();
|
||||||
|
stretcher.setTimeRatio(ratio);
|
||||||
|
stretcher.setPitchScale(ratio);
|
||||||
haveTimeRatio.store(false);
|
haveTimeRatio.store(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -313,6 +315,7 @@ void PlaybackEngine::musicFeedThread() {
|
|||||||
// next iteration will play silence
|
// next iteration will play silence
|
||||||
closeMusicFile();
|
closeMusicFile();
|
||||||
stretcher.setTimeRatio(1.0); // buffer size for playing silence is computed from 'playbackRate', so reset timeRatio
|
stretcher.setTimeRatio(1.0); // buffer size for playing silence is computed from 'playbackRate', so reset timeRatio
|
||||||
|
stretcher.setPitchScale(1.0);
|
||||||
stretcher.process(buf_ptr, 0, true); // set end of playback
|
stretcher.process(buf_ptr, 0, true); // set end of playback
|
||||||
mPlayer->stopAudio();
|
mPlayer->stopAudio();
|
||||||
continue;
|
continue;
|
||||||
@@ -322,6 +325,7 @@ void PlaybackEngine::musicFeedThread() {
|
|||||||
LOGI("finished reading mp3 file (MPG123_DONE)");
|
LOGI("finished reading mp3 file (MPG123_DONE)");
|
||||||
closeMusicFile();
|
closeMusicFile();
|
||||||
stretcher.setTimeRatio(1.0); // buffer size for playing silence is computed from 'playbackRate', so reset timeRatio
|
stretcher.setTimeRatio(1.0); // buffer size for playing silence is computed from 'playbackRate', so reset timeRatio
|
||||||
|
stretcher.setPitchScale(1.0);
|
||||||
stretcher.process(buf_ptr, 0, true); // set end of playback
|
stretcher.process(buf_ptr, 0, true); // set end of playback
|
||||||
mPlayer->stopAudio();
|
mPlayer->stopAudio();
|
||||||
continue;
|
continue;
|
||||||
|
|||||||
@@ -259,6 +259,8 @@ public class LstForegroundService extends Service implements SensorEventListener
|
|||||||
stepDetector.filter(event.timestamp, event.values);
|
stepDetector.filter(event.timestamp, event.values);
|
||||||
// collect accelerometer recording - adjust timebase to 0.0 sec beginning
|
// collect accelerometer recording - adjust timebase to 0.0 sec beginning
|
||||||
recording.add(new SensorData(event.timestamp - recordingStartTime, event.values));
|
recording.add(new SensorData(event.timestamp - recordingStartTime, event.values));
|
||||||
|
// TODO: acquires at 8 ms intervals ... 125 Hz?!
|
||||||
|
// TODO: must compute actual sampling rate. and either downsample, or adapt the IIR filter parameters. (& length??) - easier to resample.
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
Reference in New Issue
Block a user