Compare commits

...

2 Commits

Author SHA1 Message Date
3b1b92ba45 fix: adjust pitch (fix pitch direction) 2026-03-28 04:42:46 +01:00
6c5ac60ccb fix: adjust pitch, not just speed 2026-03-28 04:39:19 +01:00
3 changed files with 8 additions and 1 deletions

1
.gitignore vendored
View File

@@ -12,3 +12,4 @@
app/src/main/obj/
.cxx
/txts
/data

View File

@@ -231,7 +231,9 @@ void PlaybackEngine::musicFeedThread() {
}
if(haveTimeRatio.load()) {
stretcher.setTimeRatio(timeRatio.load());
double ratio = timeRatio.load();
stretcher.setTimeRatio(ratio);
stretcher.setPitchScale(1.0 / ratio);
haveTimeRatio.store(false);
}
@@ -313,6 +315,7 @@ void PlaybackEngine::musicFeedThread() {
// next iteration will play silence
closeMusicFile();
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
mPlayer->stopAudio();
continue;
@@ -322,6 +325,7 @@ void PlaybackEngine::musicFeedThread() {
LOGI("finished reading mp3 file (MPG123_DONE)");
closeMusicFile();
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
mPlayer->stopAudio();
continue;

View File

@@ -259,6 +259,8 @@ public class LstForegroundService extends Service implements SensorEventListener
stepDetector.filter(event.timestamp, event.values);
// collect accelerometer recording - adjust timebase to 0.0 sec beginning
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