LMMS / lmms

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

OpulenZ stuck playing tone after Stop Loop Play #2529

Open Leif-W opened 8 years ago

Leif-W commented 8 years ago

Using LMMS 1.1.3 on Windows 7 x64 (all updates)

  1. Removed all other instruments from default Song Editor
  2. Added OpulenZ instrument
  3. Put a few notes in Piano Roll
  4. Set loop points (4) and enabled them, hit play
  5. Fiddled around with OpulenZ settings, all working fine
  6. Fiddled with Global automation of Pitch on OpulenZ, didn't seem to have any effect?
  7. Decided to hit STOP button for some silence
  8. A constant tone (sine-wave I think), continues to play afterwards
  9. Must mute or set OpulenZ volume to 0 for silence, but tone continues if unmuted or volume increased
  10. Must delete OpulenZ instrument to make it stop

Not entirely sure which fiddled bits are relevant to reproducing problem

musikBear commented 8 years ago

Fiddled with Global automation of Pitch on OpulenZ, didn't seem to have any effect?

You only hear global automation in song-editor playback, and it works.

A constant tone (sine-wave I think), continues to play afterwards

I cant get that, at this re-test-pos.

i guess that you have made changes to arp during playback? That was a bug in 1.1.3 if i remember correct. If a key was hold and arp simultaneous was change, the note would hang, until it again was manually pressed. In zonkmascines distro i dont have this

softrabbit commented 8 years ago

I think you're seeing one or two things that are fixed in the master branch, commit 925122545ec2b975809fd0ba48202e862de71265.

(8) The voice allocation leaves one voice unplayed, but some parameter changes make a sound. And as there isn't a note associated with the voice, it never gets turned off.

And then there's the "feature" of maximum length decay/release for the envelope going on forever under the right circumstances, which I'm pretty sure is a part of faithful emulation of the original OPL2 chip. But that is easily silenced by turning the envelope times down.

(6) Notes don't respond to bending after release in the stable version you're running. Or, as @musikBear suggested, you're playing the piano roll, which means any automation tracks aren't processed. That might be an entire valid bug in itself.

Leif-W commented 8 years ago

Ah, I see now, modifying the Arpeggio whilst in play, then subsequently hitting stop, did indeed trigger the problem. I did not touch any keys or add/remove any notes during play, just the piano roll playing in loop, modify arpeggio, then stop.

Previous versions of LMMS allowed me to click a control on an instrument panel and modify a global automation, which would then spin the knobs around in real time, while looping.

I do this when trying to quickly familiarize myself with the capabilities of a given instrument (in this case, OpulenZ is new since I last updated LMMS). I'll set loop points to an empty segment of the piano roll of an instrument, try out a few things, then settle upon an instrument (save that config for later use), and note patterns, etc.

Although the secondary "bug" I may have pointed out wasn't the primary reason for this report, it may be valid to pursue separately, unless it's already duplicated elsewhere. My primary concern of the "stuck" note seems to be a duplicate fixed in Master (which I have no ability to easily compile for Windows).

Thank you both for the clarifications. I'll look forward to a new release, and downgrade for the moment to a version without this specific problem. Unless there's a beta build or nightly build somewhere.

zonkmachine commented 7 years ago

@Leif-W Hello! Can you test the latest development release lmms-1.2.0-rc2 and see if this issue is still present? https://lmms.io/download/#windows

Leif-W commented 7 years ago

I can still trigger a sustained note after hitting stop. Delete all tracks, add Opulenz (may work with other instrument plugins but I tested with this), enable loop, mark 4 sections, add 1 8/16 note per section, fiddle with Arp settings. At first, stopping just results in a brief period in which the sound decays. But try turning up chord range, direction skip and miss while loop is playing. It's as if something goes into a positive feedback loop and rails a sine signal so the residual sound doesn't decay.

I'd expect hitting STOP means STOP, no residual sounds of any kind. I can live with it if the sounds degrades, but not when it becomes stuck on. It won't shut off or reset by fiddling with anything thereafter. Requires instrument removal or app restart.

musikBear commented 7 years ago

cant reproduce on xp rc2 I tried

Default Opulenz rings out and stay silent when stop or space is pressed

@Leif-W could you upload the project to LSP?

Leif-W commented 7 years ago

You're not the only one. Now I can't seem to reproduce. Using v1.2.0-rc2, all other versions uninstalled, ensured directly was completely removed with rd /s/q C:\Program Files\LMMS. There was no project file. Just started with the default, manually deleted the 4 default "tracks" in song editor, added OpulenZ. At first the error didn't occur, but after a few seconds playing, I had it glitching. Now I can't. ... Ah, after some playing, if I put a low 8/16 note in 3rd bar, I can get it to get stuck on a degraded form of the low note. Earlier today I got it to stick on a higher note. I'll save that as a project and attach. Think it may be the low note, or the juxtaposition of low (C1/C2) and high (C5+) notes that triggers it.

LMMS-Stuck-Sound-After-Stop.zip (App: 7-Zip; Archive format: zip; Compression level: Ultra; Compression method: Deflate64 Dictionary size: 64KB; Word size: 257).

tresf commented 7 years ago

I've noticed if I take focus away from LMMS while using the typing keyboard, I can hit a bug where key-up is never sent to LMMS. It's evident because the keys show as depressed in the instrument window.

I assume this is a different bug?

Leif-W commented 7 years ago

Yes, I can trigger behavior with using mouse only, open LMMS, load my project, open track in piano roll, go to FX panel of instrument, play piano roll, turn on arp, hit stop on piano roll, sometimes it catches on a note and instead of the signal degrading, it sustains itself in a single sound.

softrabbit commented 7 years ago

Put in some code to print out incoming MIDI messages and the internal state of the voice allocation, and it looks to me like the stuck note comes from one note off message never arriving. If that is the case, this bug could affect at least Zyn, Vestige and SF2 Player as well. I tried to get a soundfont note to stick, but no succes so far...

softrabbit commented 7 years ago

If that is the case, this bug could affect at least Zyn, Vestige and SF2 Player as well

...and then I remembered, SF2 Player doesn't get MIDI events in, it creates them internally, which means it doesn't belong in that list. Tried Zyn and got a stuck note. Looks like that was reported ages ago. (https://github.com/LMMS/lmms/issues/1762)

zonkmachine commented 6 months ago

@softrabbit I think I know what's going on with this one.

OpulenZ - Decay Issue.xpf.txt <-- drop .txt, load into lmms and hit the keys.

On maximum release the OPL emulator registered is set up to 0. But 0 as release argument mean no release at all. The operator will be held active. https://moddingwiki.shikadi.net/wiki/OPL_chip#80-95:_Sustain_Level_.2F_Release_Rate

  • bits 0-3: Release Rate. Determines the rate at which the sound disappears after KEY-OFF. The higher the value, the shorter the release. Value of 0 causes the sound not to release at all, it will continue to produce sound at level before KEY-OFF.

It's usable but easy to get mad at if you don't know what's going on. If I'm right it's just how the opl chip works but it should maybe be tamed a bit to spare the user.

zonkmachine commented 6 months ago

There is another issue where you switch FM off while notes are playing. WARNING, this can be loud! The preset above can be used for this. Just turn the volume way down, play some notes and then turn off FM (bottom left) while the notes are decaying.

zonkmachine commented 6 months ago

And then there's the "feature" of maximum length decay/release for the envelope going on forever under the right circumstances, which I'm pretty sure is a part of faithful emulation of the original OPL2 chip. But that is easily silenced by turning the envelope times down.

Right, this was already mentioned. I'm pretty sure that's the issue reported by OP. Maybe it should be documented here: https://docs.lmms.io/user-manual/5-built-in-instruments/5.10-opulenz Other than that I think this can be closed.

Leif-W commented 6 months ago

I won't have access to a computer for an extended period of time so can't test this. But, if pressing a "STOP" button, I expect all sound to stop, not some obscure behavior where I have to fiddle some other knobs, only to set them back manually when I start again. IIRC that was the surprising and confusing behavior. If that is addressed so that STOP === STOP (silence), then I'd call it fixed, otherwise not. Maybe some want the old behavior where stop lingers due to sustain/release or whatever, maybe call that "pause" or something.

zonkmachine commented 6 months ago

Maybe let the default behavior omit the infinite release and have an option to access infinity in a setting somewhere?

DomClark commented 5 months ago

Pressing stop removes all NotePlayHandles and SamplePlayHandles from the mixer. Thus any samples, along with instruments whose processing is driven by NotePlayHandles, will stop immediately. However, for instruments that use an InstrumentPlayHandle, the sound can still continue depending on how the instrument works. Perhaps we could add a stop function to InstrumentPlayHandle/Instrument that could make more of an effort to immediately cut off all notes. With OpulenZ, for a relevant example, it looks like we could reset the emulator by calling CTemuopl::init.

zonkmachine commented 5 months ago

With OpulenZ, for a relevant example, it looks like we could reset the emulator by calling CTemuopl::init.

Yes, but then again maybe someone wants the emulator to be faithful to the OPL2 chip? If we don't want infinite envelope then we don't let the envelope go to 15 (or something along those lines). Maybe a setting. I think this is first and foremost a documentation issue.

tresf commented 5 months ago

With OpulenZ, for a relevant example, it looks like we could reset the emulator by calling CTemuopl::init.

Yes, but then again maybe someone wants the emulator to be faithful to the OPL2 chip? If we don't want infinite envelope then we don't let the envelope go to 15 (or something along those lines). Maybe a setting. I think this is first and foremost a documentation issue.

Eh... Pressing stop should always stop, full stop. 😏. "it's not a bug it's a feature" works until the software misbehaves, and this is undeniably a misbehavior.

Quoting:

Must delete OpulenZ instrument to make it stop

zonkmachine commented 5 months ago

Must delete OpulenZ instrument to make it stop

Right. That's not a good thing I suppose.

softrabbit commented 4 months ago

So, there were a few problems:

  1. A mistake in the voice assignment algorithm, which was fixed in 2015 and hopefully incorporated into some released version at some point.
  2. Another might be MIDI note off commands that go missing when the arpeggiator is used. That hang would IMO best be remedied by just sending an "all notes off" to any MIDI connected plugin when stopping. (OpulenZ doesn't actually honor that ATM, but adding it shouldn't be a big deal (and who knows, maybe it's being sent already...)) Anyway, I couldn't reproduce this problem in the 1.3.0 alpha I have at hand here, so it might be a non-issue by now?
  3. The envelope release not happening if set at maximum length... it's really a bit of a feature when doing FM. If the modulator sticks to the sustain level, the timbre of the sound won't change while the note is released. Other than that, pretty annoying but part of a faithful emulation, I guess.