-
Notifications
You must be signed in to change notification settings - Fork 31
Fix stopping voice keyer messages #276
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
Conversation
Thanks for the hint. According to man page you are right. I do have Sox-14.4.2 here and de facto both version do work. I will change it anyway. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry I missed this.
I've yet to try it but will. I noted the syntax for SoX play
in the commit for play_vk
.
I actually have these lines in my local # play file on the default sound device
# OSS play utility syntax:
#play $1 -q 2>/dev/null
# SoX play utility syntax
play -q $1 |
scripts/play_vk
Outdated
@@ -28,7 +28,7 @@ trap 'kill -s INT $PID' TERM INT | |||
|
|||
# play file on the default sound device in backgroudn, so signals can be catch | |||
# by the 'trap' instruction above | |||
play $1 -q 2>/dev/null & | |||
play -q $1 2>/dev/null & |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Locally I found that redirecting stderr
to /dev/null
was not necessary with the -q
option properly placed. Please test that, Tom.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry I missed this.
Just found the following in 'man play':
"These options can be specified on the command line at any point before the first effect name."
That may explain the behavior. With -q before the file name it is quite more robust. Thanks.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Locally I found that redirecting
stderr
to/dev/null
was not necessary with the-q
option properly placed. Please test that, Tom.
It may be left over from former versions of SoX which left an error message when killed. Just tested it with 'aplay -q' - that would need the redirection.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IIRC, aplay
is the ALSA ply utility.
If we opt to retain play_vk
then all examples should be included but commented. If we choose to specify the play utility in logcfg.dat
then the alternatives can be documented in the man
page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was basing my placement of -q
on the output of play -h
which provides a usage output. Yes it says that gopts can be specified any place before the first effect. Earlier in the output is this line:
Usage summary: [gopts] [[fopts] infile]... [fopts] [effect [effopt]]...
So I presumed it would be best to place the -q
in front of the filename. However, just testing it now I see it is honored in either place on the command line, so disregard my "advice". :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just tested the aplay command. But as agreed let us stay with SoX as 'official' supported.
And sure there has to be more documentation. At the moment it is just to test that the sound gets stopped and rig is going back to RX mode.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am going through the man page and have noted that area as one that will need to be updated.
- avoids leaving zombies after playing the sound - respects VK playtime for auto CQ (start again AFTER end of sound file)
Please test and report back again. If no problems we can add some keywords to allow users to specify the commands to use. |
It does not stop playing on my system (Debian 11 i386). I'm using a plain play_vk script with a single line
Upon Esc "Terminated" is written into the call input field (after the current cursor) and this text can't be cleaned by further Esc's, just by typing it over. Playback continues and terminates normally (not interrupted).
fixes both issues (playback is terminated and there is no extra output). But "play" seems to a bit too generic to me, easy to inflict collateral damage... |
While it may seem that To be absolutely certain, its PID or the script's PID needs to be known to kill the correct process that |
If PID is know then
seems to do the right job. (tested in a terminal) |
Hi Zoli, you need to use the changed play_vk from the PR. It catches the sigterm and in turn kills the play command. Am 09.09.2021 19:22 schrieb Zoltan Csahok ***@***.***>:
It does not stop playing on my system (Debian 11 i386). I'm using a plain play_vk script with a single line
play $1 -q 2>/dev/null
Upon Esc "Terminated" is written into the call input field (after the current cursor) and this text can't be cleaned by further Esc's, just by typing it over. Playback continues and terminates normally (not interrupted).
Looks like pkill only kills the play_vk process itself, but the actual play command keeps running.
Replacing the pkill with
pkill -SIGTERM -n play 2>/dev/null
fixes both issues (playback is terminated and there is no extra output). But "play" seems to a bit too generic to me, easy to inflict collateral damage...
—You are receiving this because you authored the thread.Reply to this email directly, view it on GitHub, or unsubscribe.Triage notifications on the go with GitHub Mobile for iOS or Android.
|
If I understand things, |
It is difficult to get the pid of a process started by system(). Therefore we use the pkill command. There is one switch to kill only the last started command by pkill - i just do not remember...Am 09.09.2021 19:54 schrieb Zoltan Csahok ***@***.***>:
If PID is know then
pkill -9 -P <PID>
seems to do the right job. (tested in a terminal)
—You are receiving this because you authored the thread.Reply to this email directly, view it on GitHub, or unsubscribe.Triage notifications on the go with GitHub Mobile for iOS or Android.
|
It's the |
OK, with the new |
I will prepare more documentation in next time. I just needed a confirmation for correct function before continuing in these direction.To be honest the play_vk is not really needed - the mechanism can work with scripts or with plain binary programs (e.g. play). More on that later (using just my phone for that conversation is just annoying....)Am 09.09.2021 20:14 schrieb Zoltan Csahok ***@***.***>:
OK, with the new play_vk it does stop indeed, all is fine.
Just users need to be reminded to fix their scripts in case they don't use the distributed ones.
—You are receiving this because you authored the thread.Reply to this email directly, view it on GitHub, or unsubscribe.Triage notifications on the go with GitHub Mobile for iOS or Android.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
added 2 comments
There is a slight delay if I hit F1 and then Escape immediately afterward but this much, much better than we had and than what my hack was. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Zoli, Nate, thanks for the spell check.Atomic_bool is a good idea. I fear the small delay in stopping is difficult to avoid as we are running some threads and real scheduling is controlled by the kernel only.Btw, the delay is shorter than for the cw keying here.Am 10.09.2021 03:36 schrieb Nate Bargmann ***@***.***>:
There is a slight delay if I hit F1 and then Escape immediately afterward but this much, much better than we had and than what my hack was.
—You are receiving this because you authored the thread.Reply to this email directly, view it on GitHub, or unsubscribe.Triage notifications on the go with GitHub Mobile for iOS or Android.
|
Try killing with SIGKILL in
For me it resulted in an immediate stopping. |
Never mind... I must have goofed something in my Try this, hit |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All OK.
@@ -21,13 +21,14 @@ | |||
# An executable copy of 'play_vk' in your contest directory (containing the | |||
# logcfg.dat file) can be adapted and has precedence over the standard install | |||
|
|||
# accept SIGTERM and SIGINT signals and kill play command as soon as possible |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The latest play_vk and code works just fine for me.
Very well. Let me do some fine tuning (comments, better naming, maybe documentation,..) before I merge it in, Should be done in next one or two days. |
The playback command will be executed in the soundlog directory, so we can directly reference the file by name
It was more than the expected one or two days. I took the chance to rewrite most of the audio handling code to cleanup functionality and improve readability. Furthermore the following changes were made.
I would appreciate a review and feedback for the changes so far. Open points to do and to discuss:
|
To complete the started PR and to fix the existing conflicts I did a rebase of the code onto master and split it in two parts.
I will add pull requests for both, link back to these PR for reference and close these PR afterwards. |
These commit gives recording and playing of voice keyer messages and contest soundlogs a thorough overhaul. The code relies on the tools from the SoX package with some sane default settings but allow user configuration of all play and record commands (See also the discussion in PR #276) The default directory for recorded soundlogs was changed to ./soundlogs and are therefor contest specific now. These setting can also be overwritten by a configuration keyword (see man page for details). Co-authored-by: zcsahok <[email protected]>
Start voice keying in an separate process so TLF can look for ESC key and send the play_vk script an TERM signal.
To allow the script to handle that signal the actual sound playing has to be run in background by the added '&'.
You have to adapt the autocq timing as the time the sound is running does no longer add to that time.
Please review and test that sound is stopped and rig switched back to receive mode.