Package: timidity
Version: 2.14.0-8
Followup-For: Bug #578859
Dear Maintainer,
Attached is a patch that allows timidity to play via JACK output in
v2.14.0-8. This feature was lost at some point in the last few years
(at least as far back as 2014). When timidity is broken, attempting to
use it produces error messages as noted below. After the attached patch
is applied, Rosegarden makes noise as expected. Oddly, this patch seems
to fix output for both JACK and ALSA outputs, but it's not clear why,
and further investigation or confirmation would be appreciated.
This patch was copied from ArchLinux and this repository:
- [https://bugs.archlinux.org/task/40906]
- [https://github.com/archlinux/svntogit-
community/blob/6078ccb4fcb32cb2c6b50dd6b79bbce49b173435/trunk/timidity-
jack.patch]
I have not investigated why it works or how it was identified, the
original blog is dead and not stored on the Wayback Machine:
[http://blog.163.com/jiams_wang/blog/static/3033914920138120746567]
Test Case:
1. Install the packages qjackctl, timidity, rosegarden, and
fluid-soundfont-gm.
2. Run the attached rosegarden-with-jack script to start each of the
tools needed to play music via Rosegarden over JACK.
3. Verify that when Rosegarden tries to connect to timidity, that the
timidity process starts printing output containing the line "Couldn't
start JACK device (`j')".
,----
| $ timidity -Oj -iA
| jack_client_new: deprecated
| TiMidity starting in ALSA server mode
| Opening sequencer port: 129:0 129:1 129:2 129:3
| Couldn't start JACK device (`j')
`----
4. Play the attached demo file, and verify that no sounds are played.
5. Run the attached rosegarden-with-alsa script that starts each of the
tools needed to play music via Rosegarden over ALSA.
6. Play the attached demo file, and verify that sounds are played only
after quitting Rosegarden.
7. Apply the patch.
8. Verify that Rosegarden can play sounds when playing the demo file and
when adding notes to a track.
-- System Information:
Debian Release: 10.4
APT prefers stable-updates
APT policy: (500, 'stable-updates'), (500, 'stable')
Architecture: amd64 (x86_64)
Kernel: Linux 4.19.0-9-amd64 (SMP w/4 CPU cores)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8),
LANGUAGE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /usr/bin/dash
Init: systemd (via /run/systemd/system)
LSM: AppArmor: enabled
Versions of packages timidity depends on:
ii libao4 1.2.2+20180113-1
ii libasound2 1.1.8-1
ii libc6 2.28-10
ii libflac8 1.3.2-3
ii libice6 2:1.0.9-2
ii libjack0 [libjack-0.125] 1:0.125.0-3
ii libncurses6 6.1+20181013-2+deb10u2
ii libogg0 1.3.2-1+b1
ii libpng16-16 1.6.36-6
ii libsm6 2:1.2.3-1
ii libspeex1 1.2~rc1.2-1+b2
ii libtinfo6 6.1+20181013-2+deb10u2
ii libvorbis0a 1.3.6-2
ii libvorbisenc2 1.3.6-2
ii libx11-6 2:1.6.7-1
ii libxaw7 2:1.0.13-1+b2
ii libxext6 2:1.3.3-1+b2
ii libxmu6 2:1.1.2-2+b3
ii libxt6 1:1.1.5-1+b3
ii lsb-base 10.2019051400
ii zlib1g 1:1.2.11.dfsg-1
Versions of packages timidity recommends:
ii fluid-soundfont-gm 3.1-5.1
Versions of packages timidity suggests:
pn fluid-soundfont-gs <none>
pn freepats <none>
pn pmidi <none>
pn timidity-daemon <none>
--- timidity-2.14.0.orig/timidity/jack_a.c 2020-09-05 11:47:43.562415021
-0500
+++ timidity-2.14.0/timidity/jack_a.c 2020-09-05 11:45:38.642526757 -0500
@@ -267,6 +267,7 @@
{
jack_client_t *client;
- client = jack_client_new(TIMIDITY_JACK_CLIENT_NAME);
+ client = jack_client_open(TIMIDITY_JACK_CLIENT_NAME,
+ (jack_options_t)0, NULL);
if (! client)
return 0;
jack_client_close(client);
@@ -283,7 +284,8 @@
memset(ctx, 0, sizeof(*ctx));
- ctx->client = jack_client_new(TIMIDITY_JACK_CLIENT_NAME);
+ ctx->client = jack_client_open(TIMIDITY_JACK_CLIENT_NAME,
+ (jack_options_t)0, NULL);
if (! ctx->client)
return -1;
@@ -509,6 +511,7 @@
pthread_cond_wait(&ctx->cond, &ctx->lock);
}
/* fallthrough */
+ case PM_REQ_PLAY_START:
case PM_REQ_DISCARD:
ctx->running = 0;
ringbuf_clear(&ctx->rbuf);
#! /usr/bin/env bash
#
# Start Rosegarden with sound support.
#
systemctl --user stop pulseaudio.socket
systemctl --user stop pulseaudio.service
qjackctl --start &
qj=$!
sleep 5
timidity -iA -Oj &
tim=$!
sleep 5
rosegarden
kill $tim
sleep 1
kill $qj
systemctl --user start pulseaudio.service
systemctl --user start pulseaudio.socket
#! /usr/bin/env bash
systemctl --user stop pulseaudio.socket
systemctl --user stop pulseaudio.service
timidity -iA -oA &
tim=$!
sleep 5
rosegarden
sleep 5
kill $tim
sleep 1
systemctl --user start pulseaudio.service
systemctl --user start pulseaudio.socket