lmms icon indicating copy to clipboard operation
lmms copied to clipboard

SimpleAudioProcessor - Sync sample position to song position when continuing playback between notes

Open ribbon-otter opened this issue 3 years ago • 11 comments

Enhancement Summary

I want to hear the same thing each time I listen to my song. For example, if my sample is a spoken sentence, I want the same word to be spoken on a particular note each time I play the song. Currently, this is impossible. (I discovered this limitation when attempting to make one of those 'auto-tuned meme songs' from a spoken audio sample)

When the "continue playback between notes" mode is engaged, currently, each time a note is played, the SimpleAudioProcessor continues playback from where ever it left off. This means a different part of the sample is played for the same note of different replays of the song. The sample and the song fall out of sync.

In my opinion, ideally, the position in the sample would be calculated by adding the lengths of all the notes that have already played in the song. Thus, the same part of the sample would play on each playback.

If this is too complex, we could instead just reset playback position when restarting the song from the beginning. It would be annoying to have to listen to the entire song every time to hear the 'real' version, but it would be better than the current situation where what part of the sample is mapped to each note is effectively random.

I really appreciate all the hardwork you developers do for free. LMMS has significantly improved even in the few years I have been using it.

ribbon-otter avatar Aug 08 '22 20:08 ribbon-otter

Found a UI hack, kind of annoying but its possible without a code change...

"continue playback across notes" internally is called "stutter", it resets the stutter point to zero when stutter is turned on and off.

Every button in automatable in LMMS, even this one that does not look like a button.

so...

Add an automation track.

Hold down Ctrl + Drag and drop the "continue playback across notes" button onto the automation track.

The automation editor title should end with ">Stutter" when you have done it properly.

The automation editor will now only let you choose between 1 and 0 for any point in time, if you toggle it between on and off and on again, it resets the sample position to the start. N.B. the GUI is not updated until it plays but it does seem to work.

If your sample plays from the very first tick of the song you need to insert some silence at the start of the song for the automation track off/on , since it requires a toggle to reset

Hope this helps, and thank you sir, I just discovered a cool new trick!

teknopaul avatar Nov 16 '23 19:11 teknopaul

I think long term: all Instruments need a reset() method that is called when the UI resets the song to position zero

teknopaul avatar Nov 16 '23 19:11 teknopaul

N.B. same trick works whenever automation forces a change in the "Start of sample" knob. Requires a change so must go up down.

The automation track for "Start of sample" is a float, so you can program a jump to any point in the sample. with stutter on at any point in the song.

teknopaul avatar Nov 16 '23 19:11 teknopaul

oh wow, thank you. that is a good hack.

ribbon-otter avatar Nov 16 '23 19:11 ribbon-otter

yeah I wish I knew this myself before! Often I have the same vox in multiple tracks so I can have different start points.

teknopaul avatar Nov 16 '23 22:11 teknopaul

Can we close this issue? I was thinking how could we automate this better? but having float precision control of start point for each time you play a note seems like all you ever need? Even if the UI is a bit clunky, I think it resolves "hear the same thing each time I listen to my song"

teknopaul avatar Nov 16 '23 22:11 teknopaul

yes. I think so.

ribbon-otter avatar Nov 16 '23 22:11 ribbon-otter

I found this in the code too, even easier....

// Magic key - a frequency < 20 (say, the bottom piano note if using
// a A4 base tuning) restarts the start point. The note is not actually
// played.

i.e. just play the bottom note to restart

teknopaul avatar Nov 17 '23 18:11 teknopaul

voxpop

Had a better idea: I created an InstrumentTrack today that can load cue files generated in Audacity, this enables up to 99 cue points in a voice track which can then be triggered directly using piano roll, or the Automation method if that is preferred. Each que point can have and end point and text associated with it too.

in feature/voxpop on my fork

teknopaul avatar Nov 19 '23 02:11 teknopaul

voxpop-screenshot

teknopaul avatar Nov 19 '23 02:11 teknopaul

I think having ability to select cue point for a vocal sample in the piano roll will turn out to be better workflow

teknopaul avatar Nov 19 '23 02:11 teknopaul