-
-
Notifications
You must be signed in to change notification settings - Fork 1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Presets are glitchy in library but sound good in B+B editor #2434
Comments
@tresf , no I don't think so. If I open LMMS and play sound that don't have any arpeggio then it already sounds bad. |
@tresf perhaps a comprehensive post for everything that has to do with preview? imo preview needs a re-thinking /workover.
are those i remember right now -if uou are short for time, i can find the tickets where preview is mentioned, and give you a list. I have nothing important today :p |
@karmux please provide exact steps to reproduce, and if possible an audio recording of the glitched presets. |
@Umcaruje, I recorded BitInvader/Bell and Monstro/Phat from library and then from song editor. Steps to reproduce is just to click on sample. |
Reproduced and confirmed for BitInvader/bell.xpf and Monstro/Phat.xpf on Ubuntu 14.04.4 x86_64. Switching the audio interface doesn't seem to matter (tried SDL, alsa and pulseaudio). Steps to reproduce:
|
Can we please get confirmation that this bug is new to the |
New to |
I'll try and bisect this. |
There is a noise hit in the beginning of AngryLead. If you drop it on a track that noise is played isolated without the actual preset... but the noise is about an octave lower. |
Because it's got a plate reverb. There's a transient/glitch being fed into the reverb. I interpret this as the noise belonging to the instrument... So the noise is from setting up the sound from the previous preset. This comment from Fastigium is relevant here then. |
I saw this in 1.0.3 . I only got deep into lb302 though and it could off course be up to things of it's own. |
Interesting observation: for TripleOscillator presets, this bug appears to occur whenever stacking is enabled, even if it's on octave with range 1 (i.e. it plays exactly the same note as it would without stacking). I made a very simple preset that only plays a sine on 1 oscillator, then saved it both without and with stacking. The stackless version previewed fine, the stacked version sounded like crap and gave a waveform like this: I've been hunting through the code for possible causes, but haven't found any so far. It's a complicated beast, and the commits that introduced it are so huge that it doesn't help much in pinpointing. I can confirm that the merging of #1088 introduced the issue, but haven't bisected further because this computer compiles so slowly 😴 |
AFAIK, MemoryManager went live with 1.1, so this is also present in stable-1.1, no? P.S. Thanks for the investigation into this. |
@tresf: |
👍 |
Some progress: if I disable the BufferManager by making BufferManager::acquire() a wrapper around MM_ALLOC and BufferManager::release() a wrapper around MM_FREE, the previews are fine again. This suggests that somehow, a single buffer ends up being used in multiple places. Now to find where that happens! |
Yaaaaaar! Found it! PresetPreviewPlayHandle keeps a buffer and shares it with the NotePlayHandle it creates. However, when stacking is enabled, that NotePlayHandle releases its buffer and delegates rendering tasks to its subnotes. PresetPreviewPlayHandle still holds a pointer to that released buffer, though, and is attached to an AudioPort, which means that the released buffer is added to the master channel every mixing round. Any PlayHandle or AudioPort may acquire this buffer at any moment and fill it with anything it likes. This causes the crazy distortions as seen on the screenshot above. I first tried to solve it by checking the usesBuffer() method of the NotePlayHandle in PresetPreviewPlayHandle::play(), but this does not solve another bug: a TripleOscillator preset with a release > 0 in its envelope is cut off hard at mouse button release when no stacking or arpeggio is enabled. In pull request #2586 I fixed both bugs by using a different solution. Testing welcome, I do hope I didn't break anything while fixing this 😅 |
@Fastigium , awesome! 👍 Previews sound so clean now 😃 |
@karmux Cool! Thanks for testing! |
@Fastigium et al |
@Fastigium per the below change, should this method eventually be removed? Shall we mark it as such (e.g. void PresetPreviewPlayHandle::play( sampleFrame * _working_buffer )
{
- m_previewNote->play( _working_buffer );
+ // Do nothing; the preview instrument is played by m_previewNote, which
+ // has been added to the mixer
} |
@tresf Unfortunately all PlayHandles are required to implement a play() method per https://github.com/LMMS/lmms/blob/master/include/PlayHandle.h#L99. The problem is at a more conceptual level; PresetPreviewPlayHandle is not used as a PlayHandle anymore in my solution. I don't see a way to keep it in use without coupling it more closely with NotePlayHandle, and that seems Bad Practice. To really fix this conceptually, PresetPreviewPlayHandle's functionality should probably be moved into PreviewTrackContainer somehow. That's not an entirely trivial operation, though. |
BitInvader/Bell, LB302/AngryLead, Monstro/Phat - these sound really bad under My Presets. Most of the presets sound glitchy (and with much more volume) under My Presets but sound completely clean in B+B editor or while playing. LMMS master with SDL or Pulseaudio on Kubuntu 15.04.
The text was updated successfully, but these errors were encountered: