Package: release.debian.org
Severity: normal
User: release.debian....@packages.debian.org
Usertags: unblock

Please unblock package csound

Upstream csound introduces a regression over stretch.  If you're using
the synchronous granular synthesis opcodes and the sample rate of your
samples differs from the sample rate you're playing at, it is
impossible to make things sound right in buster.

So, for one synthesis technique that worked in stretch, you get into situations 
where it doesn't work in buster and there is no work around.

The upstream fix is simple: scale the pointer read rate along with
pitch scaling that upstream already introduced.  #924260 includes
details and a pointer to the upstream issue which includes even more
detailed analysis and upstream's fix.  This is just a backport of the
two upstream patches.  I've confirmed the fix with my DJ software.  I
have received permission to upload an NMU from the maintainer (again
see #924260 ) and will upload once I get a confirmation from the
release team that this looks good.
diff --git a/debian/changelog b/debian/changelog
index 84a4831..41d2499 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,11 @@
+csound (1:6.12.2~dfsg-3.1) unstable; urgency=medium
+
+  * Non-maintainer upload.
+  * Fix diskgrain, syncgrain and syncloop when sample rate of sample
+    differs from orchestra, Closes: 924260
+
+ -- Sam Hartman <hartm...@debian.org>  Thu, 21 Mar 2019 10:31:29 -0400
+
 csound (1:6.12.2~dfsg-3) unstable; urgency=medium
 
   * Fix FTBFS on mips by avoiding a deadlock
diff --git 
a/debian/patches/applied-diskgrain-fix-to-syncgrain-andsyncloop.patch 
b/debian/patches/applied-diskgrain-fix-to-syncgrain-andsyncloop.patch
new file mode 100644
index 0000000..d5f3033
--- /dev/null
+++ b/debian/patches/applied-diskgrain-fix-to-syncgrain-andsyncloop.patch
@@ -0,0 +1,58 @@
+From: veplaini <victor.lazzar...@nuim.ie>
+Date: Mon, 11 Mar 2019 09:11:40 +0000
+Subject: applied diskgrain fix to syncgrain andsyncloop
+
+---
+ Opcodes/syncgrain.c | 11 ++++++-----
+ 1 file changed, 6 insertions(+), 5 deletions(-)
+
+diff --git a/Opcodes/syncgrain.c b/Opcodes/syncgrain.c
+index cb0b2bd..1dc1973 100644
+--- a/Opcodes/syncgrain.c
++++ b/Opcodes/syncgrain.c
+@@ -96,15 +96,16 @@ static int32_t syncgrain_process(CSOUND *csound, syncgrain 
*p)
+     int32_t     numstreams = p->numstreams, olaps = p->olaps;
+     int32_t     count = p->count, j, newstream;
+     int32_t     datasize = p->datasize, envtablesize = p->envtablesize;
++    MYFLT      pscale =  p->sfunc->gen01args.sample_rate/CS_ESR;
+ 
+-    pitch  = *p->pitch * p->sfunc->gen01args.sample_rate/CS_ESR;
++    pitch  = *p->pitch * pscale;
+     fperiod = FABS(p->sfunc->gen01args.sample_rate/(*p->fr));
+     //if (UNLIKELY(fperiod  < 0)) fperiod = -fperiod;
+     amp =    *p->amp;
+     grsize = p->sfunc->gen01args.sample_rate * *p->grsize;
+     if (UNLIKELY(grsize<1)) goto err1;
+     envincr = envtablesize/grsize;
+-    prate = *p->prate;
++    prate = *p->prate * pscale;
+ 
+     if (UNLIKELY(offset)) memset(output, '\0', offset*sizeof(MYFLT));
+     if (UNLIKELY(early)) {
+@@ -249,7 +250,7 @@ static int32_t syncgrainloop_process(CSOUND *csound, 
syncgrainloop *p)
+     int32_t     loopsize;
+     int32_t     firsttime = p->firsttime;
+     MYFLT   sr = p->sfunc->gen01args.sample_rate;
+-
++    MYFLT pscale = sr/CS_ESR;
+     /* loop points & checks */
+     loop_start = (int32_t) (*p->loop_start*sr);
+     loop_end = (int32_t) (*p->loop_end*sr);
+@@ -260,7 +261,7 @@ static int32_t syncgrainloop_process(CSOUND *csound, 
syncgrainloop *p)
+     /*csound->Message(csound, "st:%d, end:%d, loopsize=%d\n",
+                               loop_start, loop_end, loopsize);     */
+ 
+-    pitch  = *p->pitch * sr/CS_ESR;;
++    pitch  = *p->pitch * pscale;
+     fperiod = FABS(sr/(*p->fr));
+     //if (UNLIKELY(fperiod  < 0)) fperiod = -fperiod;
+     amp =    *p->amp;
+@@ -268,7 +269,7 @@ static int32_t syncgrainloop_process(CSOUND *csound, 
syncgrainloop *p)
+     if (UNLIKELY(grsize<1)) goto err1;
+     if (loopsize <= 0) loopsize = grsize;
+     envincr = envtablesize/grsize;
+-    prate = *p->prate;
++    prate = *p->prate * pscale;
+ 
+     if (UNLIKELY(offset)) memset(output, '\0', offset*sizeof(MYFLT));
+     if (UNLIKELY(early)) {
diff --git a/debian/patches/diskgrain-prate-scaling.patch 
b/debian/patches/diskgrain-prate-scaling.patch
new file mode 100644
index 0000000..9f21a6e
--- /dev/null
+++ b/debian/patches/diskgrain-prate-scaling.patch
@@ -0,0 +1,30 @@
+From: veplaini <victor.lazzar...@nuim.ie>
+Date: Sat, 9 Mar 2019 14:03:22 +0000
+Subject: diskgrain prate scaling
+
+---
+ Opcodes/syncgrain.c | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/Opcodes/syncgrain.c b/Opcodes/syncgrain.c
+index d7c461e..cb0b2bd 100644
+--- a/Opcodes/syncgrain.c
++++ b/Opcodes/syncgrain.c
+@@ -455,7 +455,7 @@ static int32_t filegrain_init(CSOUND *csound, filegrain *p)
+     p->pscale = p->sr/CS_ESR;
+ 
+     if (*p->ioff >= 0)
+-      sf_seek(p->sf,*p->ioff * CS_ESR, SEEK_SET);
++      sf_seek(p->sf,*p->ioff * p->sr, SEEK_SET);
+ 
+     if (LIKELY(sf_read_MYFLT(p->sf,buffer,p->dataframes*p->nChannels/2) != 
0)) {
+       p->read1 = 1;
+@@ -518,7 +518,7 @@ static int32_t filegrain_process(CSOUND *csound, filegrain 
*p)
+     if (UNLIKELY(grsize<1)) goto err1;
+     if (grsize > hdataframes) grsize = hdataframes;
+     envincr = envtablesize/grsize;
+-    prate = *p->prate;
++    prate = *p->prate * p->pscale;
+ 
+     if (UNLIKELY(offset)) memset(output, '\0', offset*sizeof(MYFLT));
+     if (UNLIKELY(early)) {
diff --git a/debian/patches/series b/debian/patches/series
index 2af9652..8d460a0 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -3,3 +3,5 @@ fix-n-and-m-in-score-strings.patch
 debian-specific/lua-link.diff
 ctcsound-import-the-SOVERSIONed-library.patch
 csPerfThread-stop-the-recording-thread-before-the-perf-th.patch
+diskgrain-prate-scaling.patch
+applied-diskgrain-fix-to-syncgrain-andsyncloop.patch

To compare two paths outside a working tree:
usage: git diff [--no-index] <path> <path>





unblock csound/1:6.12.2~dfsg-3.1

-- System Information:
Debian Release: buster/sid
  APT prefers unstable-debug
  APT policy: (500, 'unstable-debug'), (500, 'testing'), (500, 'stable'), (200, 
'unstable')
Architecture: amd64 (x86_64)

Kernel: Linux 4.19.0-1-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 /bin/dash
Init: systemd (via /run/systemd/system)
LSM: AppArmor: enabled

Reply via email to