Closed leskerr closed 7 months ago
I captured trace images to show the delay.
Trace 1: Showing dit on key, the sounder drive output, and the 'click' and 'clack' from the speaker. (50ms/Div)
Trace 2: Showing key down to 'click' from the speaker. (50ms/Div)
Trace 3: Showing key up to 'clack' from the speaker. (50ms/Div)
Trace 4: Showing key down to sounder drive output. (1ms/Div)
Traces 1, 2, and 3 show that the speaker 'click' lags the key down by ~125ms (as indicated by Les) and the speaker 'clack' lags the key up by ~100ms.
Trace 4 shows that the sounder drive lags the key by ~7ms. It also shows the key bounce on the key down. On this particular key the bounce is complete after 4.5ms.
Image of the 'click' and 'clack' waveforms.
Image 1: Click waveform
Image 2: Clack waveform
These show that the 'click' and 'clack' sound files have 12ms-13ms of unneeded lead-in. This doesn't account for the entire 125ms delay, but removing it should reduce the delay.
I would like to improve this to the point it is usable - as I use MKOB with a key (only) and the 'simulated sounder' with headphones to listen to, and practice Morse in the late evening.
I love the sound of my sounder(s) - but they permeate the house, and I simply can't use them late at night. Using the simulated sounder allows me to turn down the volume or to put headphones/earphones on.
After removing the 'dead' space at the beginnings of the 'click' and 'clack' audio files I now get this:
Showing that the delay was reduced. We still have work to do, but this reduces 10ms of it.
Those traces are very cool!
I once tried trimming off the beginning of the audio waveforms like you did, and decided it was a bad idea. It alters the sound of the clicks and clacks to the point of making them unnatural and unpleasing (to my ear, at least). What you're hearing at the beginning isn't really superfluous, it represents the initial movement of the sounder's lever before it hits the stop and makes the 'click' or 'clack'.
I also experimented with artificial 'click' and 'clack' waveforms that had very quick rise times, but they sounded terrible.
@leskerr although I couldn't hear the difference, I will trust your ear and I'll undo my change to those files.
Thanks @AESilky. I hate to make you undo stuff, but that's what Git is so good at.
@jchausler I can easily run the same with the 2.5 version. I was planning to do that, but ran out of time last night/this morning.
In addition to avoiding the noise, using the computer audio allows me to just use my 'key cable' to attach my stand-alone key to the computer while I sit on the sofa. No power or bulk of the sounder.
I spent many, many, years using Tek scopes and was also the resident goto person when we first got a brand new HP digital storage scope (others had a hard time getting used to the fact that it would continue to show the trace even when the circuit was turned off). However, I couldn't really justify the price of a Tek 4 channel, 100mhz storage scope for my home/hobby use.
As @jchausler suggested and I had planned on - here are traces from MKOB 2.5.
Trace 1B: Key 'dit' with sounder drive and speaker output. 50ms/div
Trace 2B: Key down to sounder and speaker 'click' output. 50ms/div
Trace 3B: Key up to sounder and speaker 'clack' output. 50ms/div
Trace 4B: Key (showing bounce) to sounder drive. 1ms/div
Trace 5B: 'H' from a bug. 50ms/div
This shows that on MKOB 2.5:
This is really interesting stuff! The 42ms lag is way too long for comfortable sending, in my opinion. I've already noticed that with MorseKOB 2.5 and been bothered by it.
The last time I had good audio performance was with Windows XP. When Microsoft came out with Vista, the audio stopped working. I had to switch to DirectSound, and it's never been the same since.
It would be very interesting to get the same traces with XP. I may have an old computer somewhere that still has XP on it, but I think I gave it to a friend. To disable DirectSound, you need to go to the Tools > Debug screen in MorseKOB and uncheck the DirectSound option (which is normally enabled by default every time you start the program).
Low latency audio has been the # 1 challenge ever since I started working on Morse software.
I want to make sure I'm correct in thinking that the latency is mostly a problem when you are sending (or practicing) with a key and using the computer audio (simulated sounder). If you are just listening to code the latency doesn't matter (within reason).
However, I can see it becoming an issue (outside of sending) if the latency between playing a click and a clack becomes too great when you are listening to some higher speed code.
I should put a microphone at the physical sounder and get that as the 4th trace. That way we can see the true audio output from the sounder and not just the sounder drive signal. I should also do a trace with a KOB, such that there isn't any MKOB induced delay in the sounder.
I want to make sure I'm correct in thinking that the latency is mostly a problem when you are sending (or practicing) with a key and using the computer audio (simulated sounder). If you are just listening to code the latency doesn't matter (within reason).
However, I can see it becoming an issue (outside of sending) if the latency between playing a click and a clack becomes too great when you are listening to some higher speed code.
That's right. It's only a problem when sending. When you're listening, the latency is irrelevant, even at higher speeds. There's no additional latency between the click and the clack, as far as I know. There's just a delay in getting the sound engine started after it's been idle for some period of time.
This is fixed now. I moved the activation of the sound/sounder into the key processing, immidiately after the key close/open is detected. It was being done later, which included the key de-bounce time and well as some additional processing, thereby causing the delay.
Outstanding! I may not get a chance to try this, but I'm delighted to hear that it's been fixed. Good work!
~Les
On Wed, Mar 13, 2024 at 6:06 PM Ed Silky @.***> wrote:
This is fixed now. I moved the activation of the sound/sounder into the key processing, immidiately after the key close/open is detected. It was being done later, which included the key de-bounce time and well as some additional processing, thereby causing the delay.
— Reply to this email directly, view it on GitHub https://github.com/MorseKOB/PyKOB/issues/158#issuecomment-1996211261, or unsubscribe https://github.com/notifications/unsubscribe-auth/APHISTIX2L5AFOXPWJ22ACLYYDZ2TAVCNFSM4SVEXLU2U5DIOJSWCZC7NNSXTN2JONZXKZKDN5WW2ZLOOQ5TCOJZGYZDCMJSGYYQ . You are receiving this because you were mentioned.Message ID: @.***>
The simulated sounder lags behind the key by ~125ms when using a Key & Sounder interface. This much delay makes it very difficult to send on a bug. Ideally it would be 15ms or less.