LMMS / lmms

Cross-platform music production software
https://lmms.io
GNU General Public License v2.0
8.01k stars 997 forks source link

Zero-length beat notes end too soon #2074

Closed musikBear closed 11 months ago

musikBear commented 9 years ago

a Q in forum made me do some experiments with B&B and audio-loops over 1-2 bars (typical commercial percussion loops, f.i) They are actual quite difficult to get to play right and loop right Only way i can get this somewhat working, is to use very long notes, but then the 'only-play-from-note-start' cravat kicks in Could the green no-length-notes in BB have a logic, where they always played exactly for the duration of the setting in AFP, then perfect looping could be easy for the user

tresf commented 9 years ago

Zero-length notes play a sample until completion. Why isn't that working for you?

musikBear commented 9 years ago

Why isn't that working for you?

Good question - I also thought so , but after i tested, it only plays for one bar. Try latin_guitar01.ogg. That samples length is ~3.2 bar in length A green no-length-note play this sample for 1 bar, then cuts off To reproduce you need piano-roll loop-points 0..4 bar, in order to force the playhead past the one bar vertical, but the no-length-note stops playing It surprised me too 8|

musikBear commented 9 years ago

Have anyone re-tested this behavior, as described? If no-length-notes are supposed always to play the whole sample, there is a bug (1.1.3 x32) demo: https://lmms.io/lsp/?action=show&file=6948

tresf commented 9 years ago

No, no one has re-tested this. Perhaps the warm weather in the northern hemisphere combined with academia has the helpers busy with other endeavors. :sun_with_face:

Wallacoloo commented 9 years ago

@musikBear I just tested the behavior. By the way, for anyone reading this not knowing what AFP stands for (me, previously), it's the "Audio File Processor" - the sampler that is implicitly instantiated when you drag a sample into the instrument track list.

I opened the Beat/Bassline editor, dragged latin/latin_guitar01.ogg into it and created a note on the first beat. Playing the pattern resulted in the sample being played for just UNDER a full bar before being silenced.

Lowering the tempo after doing this results in the already instantiated notes still playing for the same actual duration (i.e. same number of seconds, but now for fewer beats). New instruments and notes are ALSO affected, playing for exactly the same duration as the previous notes and not synced with the tempo. This suggests to me that the duration of zero-length notes is not based on the tempo - it's probably a fixed number of samples or seconds.

musikBear commented 9 years ago

@Wallacoloo Thanks for confirming its a bug, so il post a new ticket

tresf commented 9 years ago

Thanks Colin. Sounds like it bares some resemblance to #1592.

-Tres

Spekular commented 9 years ago

I'm not sure if it helps but I can confirm this on the current master. Just as wallacoloo said, it stops just under one bar.

musikBear commented 8 years ago

I feel i have to add a new comment to this, because i yesterday was looking more closely on sample-track, and i discovered that sample-track has features that up to now is not documented in the wiki, and those features fully fill the need/ wishes for looping samples. Not only does sample-track allow seamless looping of short samples, sample-track will even remove silence from the loop-sample, and then re-shape the sample to 100% perfect looping! I was astonished to see this behaviour from one of the imo least useable features in lmms. To reproduce: Set BMP to 50 Insert an empty sample-track-block Drag the sample Beats| 909beat01.ogg into the empty block sampletracksetup play the sample Obs the silent piece at the end (marked yellow stop playback spin BPM forward and watch the sample closely. At 61 BPM it suddenly changes length, and fit perfectly in the bar If you copy the current sample to the 2. bar, there will be 100 correct looping A way to connect to a mixer-channel is however much needed, so all sample-track does not goes to Master-channel. eg #1471 "FX Mixer Support"

tresf commented 8 years ago

You're posting off-topic content, it's poorly written and it's TL;DR. Please keep your posts clear, on-topic and concise.

Please take better care on our tracker. This is a warning. Further abuse will receive a final warning followed with corrective action.

zonkmachine commented 7 years ago

This suggests to me that the duration of zero-length notes is not based on the tempo - it's probably a fixed number of samples or seconds.

It seem to depend on the settings of the envelope even though it's off. The release doesn't count and the decay counts until it reaches sustain level. Either that or until the sample ends if loop isn't enbled. With DEL + ATT + HOLD + DEC all the way up and SUST down you get about 40 seconds of playing, and that's maximum time for a sample played via the AFP. The sample basically stops playing when the sustain level is reached. This is the same issue, or similar, as https://github.com/LMMS/lmms/issues/2255 and https://github.com/LMMS/lmms/issues/1592.

zonkmachine commented 7 years ago

The sample basically stops playing when the sustain level is reached.

m_pahdFrames

zonkmachine commented 7 years ago

https://github.com/LMMS/lmms/issues/3086 may depend on this being fixed.

PhysSong commented 7 years ago

These 'no-length' notes makes (currently disabled)MIDI export more complicated. A 'no-length' note actually has minus length and implementing MIDI export depends on processing such notes.

tresf commented 7 years ago

These 'no-length' notes makes (currently disabled)MIDI export more complicated

Right because no-length is supposed to play the instrument all the way through which can vary based on sample length, envelope, etc.

zonkmachine commented 7 years ago

Since we have a note that isn't in the midi standard we need to improvise. The easiest solution is to give notes with negative length a positive value, like a full measure. We could also offer an export dialogue with setting for note length on negative value.

musikBear commented 7 years ago

Since we have a note that isn't in the midi standard we need to improvise

Is the sample length-value available in the class? If so it could be an idea to use the actual sample-length to insert a note with that length. This would also depend on BPM setting, so that value is also needed for the class (yes i know i could look in the code-base, but i have no idea where to look

tresf commented 7 years ago

it could be an idea to use the actual sample-length to insert a note with that length.

It's more work, but I tend to agree with this approach in general.

PhysSong commented 7 years ago

it could be an idea to use the actual sample-length to insert a note with that length.

I agree. Then how about synth without envelope(usually with positive length notes)? Or even AudioFileProcessor with automated start/end point?

PhysSong commented 7 years ago

One moer point: Note with minus length can even exist outside the BB track. Does it make sense?

zonkmachine commented 7 years ago

Does it make sense?

Yes. You can drag a BBTrack into the song editor. Edit:Probably not

tresf commented 7 years ago

Does it make sense?

Loaded question. :)

Yes, it's possible, so we'll need to support it. No, the functionality of it all is unintuitive and mostly accidental.

PhysSong commented 7 years ago

FL studio has similar "Infinite-length" notes. In the midi export of FL, such notes end when other notes start.

DomClark commented 5 years ago

The zero-length notes are supposed to last for the duration of the sample in the case of AudioFileProcessor, but in fact last for the length of the volume envelope, whether it is enabled or not. The actual length of zero-length notes is computed in InstrumentTrack::beatLen: https://github.com/LMMS/lmms/blob/f79c2929a5b9baa81279d016341a01bf160eaa3c/src/tracks/InstrumentTrack.cpp#L464-L475 AudioFileProcessor doesn't override Instrument::beatLen correctly; its method is instead named AudioFileProcessor::getBeatLen. Thus the default behaviour of the envelope length is used.

musikBear commented 5 years ago

but in fact last for the length of the volume envelope, whether it is enabled or not

That is a good find! -And it explains the odd behavior! It could be 'ok', if the length responded to the activated envelope, in fact -it has to, but restricted to non-activated envelope-length, is a bug

zonkmachine commented 4 years ago

I can confirm that fixing the name of the function in afp pretty much fixes this. It will play for the duration of the sample. It will not include looping and ping-pong as expected. It's hard with any of the looping modes to know what would be the proper length. Perhaps the duration of the rest of the beat?

diff --git a/plugins/audio_file_processor/audio_file_processor.cpp b/plugins/audio_file_processor/audio_file_processor.cpp
index 9459eff..6e56b96 100644
--- a/plugins/audio_file_processor/audio_file_processor.cpp
+++ b/plugins/audio_file_processor/audio_file_processor.cpp
@@ -299,7 +299,7 @@ QString audioFileProcessor::nodeName( void ) const

-int audioFileProcessor::getBeatLen( NotePlayHandle * _n ) const
+int audioFileProcessor::beatLen( NotePlayHandle * _n ) const
 {
        const float freq_factor = BaseFreq / _n->frequency() *
                        Engine::mixer()->processingSampleRate() / Engine::mixer()->baseSampleRate();
diff --git a/plugins/audio_file_processor/audio_file_processor.h b/plugins/audio_file_processor/audio_file_processor.h
index d17be14..f52f21b 100644
--- a/plugins/audio_file_processor/audio_file_processor.h
+++ b/plugins/audio_file_processor/audio_file_processor.h
@@ -57,7 +57,7 @@ public:

        virtual QString nodeName() const;

-       virtual int getBeatLen( NotePlayHandle * _n ) const;
+       virtual int beatLen( NotePlayHandle * _n ) const;

        virtual f_cnt_t desiredReleaseFrames() const
        {
zonkmachine commented 4 years ago

FL studio has similar "Infinite-length" notes. In the midi export of FL, such notes end when other notes start.

Does those notes stop the previous note playing also in FL? So if I start a beat loop starting it again wouldn't overlap the previous one playing but stop it and start over again?

musikBear commented 4 years ago

FL studio has similar "Infinite-length" notes. In the midi export of FL, such notes end when other notes start.

FLs has then two method for ending notes with other note. The other being 'cut-yourself', witch is important to get in lmms too. Fast notes 'arpeggio-type' results in dis-harmonics when notes has reverb, or just a longish release

zonkmachine commented 1 year ago

@DomClark It would be nice to get this fixed. I've tested it again and it looks like your suggested change could be all that is needed. Do you want to look at this again?

DomClark commented 1 year ago

Sure. I would be tempted to tag it as a good first issue, but since it would be nice to fix it in time for #6864, I will start work on it now.