ddfc839Add string-pluck-v1 challenge, solution schema, and scoring toolsJeremy Magland 1# string-pluck-v1: plucked damped string, pickup velocity
9d7f24cDefine the pluck as the static equilibrium under a raised-cosine finger load; w = 6 mm, signal scale 2.4 m/sJeremy Magland 3This is the hello-world challenge of the collection. The model is a linear damped string with fixed ends, released from rest from its static equilibrium under a finger load of finite width. The deliverable is a two second mono wav file containing the transverse velocity of the string at a fixed pickup point. Every quantity below is defined in the continuum, so the true solution is a specific function of time that does not depend on any discretization. A modal series solution is given in the appendix; it converges to the true solution and can be evaluated to machine precision, so this challenge is mainly a test of the submission and scoring pipeline.
5The machine-readable version of this specification is [challenge.json](challenge.json).
7## Model
9Let $u(x, t)$ denote the transverse displacement in meters of the string at position $x \in [0, L]$ and time $t \ge 0$. The string satisfies
11$$
12\frac{\partial^2 u}{\partial t^2} = c^2 \frac{\partial^2 u}{\partial x^2} - 2\sigma_0 \frac{\partial u}{\partial t} + \kappa \frac{\partial^3 u}{\partial x^2 \partial t}, \qquad 0 < x < L, \quad t > 0,
13$$
15with fixed ends
17$$
18u(0, t) = u(L, t) = 0, \qquad t \ge 0,
19$$
21and initial conditions
23$$
24u(x, 0) = u_0(x), \qquad \frac{\partial u}{\partial t}(x, 0) = 0, \qquad 0 \le x \le L.
25$$
9d7f24cDefine the pluck as the static equilibrium under a raised-cosine finger load; w = 6 mm, signal scale 2.4 m/sJeremy Magland 27Here $c$ is the wave speed, $\sigma_0$ is a frequency-independent loss rate, and $\kappa$ is a Kelvin-Voigt viscosity that damps high frequencies faster than low ones.
29The initial shape $u_0$ is the static equilibrium of the string under a transverse load of finite width centered at the pluck point $x_p$, which is how a finger or plectrum deforms the string before release. The load profile is a raised cosine of half-width $w$,
31$$
32g(x) = \begin{cases} \dfrac{Q}{2w}\left(1 + \cos\dfrac{\pi (x - x_p)}{w}\right), & |x - x_p| \le w, \\[1ex] 0, & \text{otherwise,} \end{cases}
33$$
35and $u_0$ solves the static problem $u_0'' = -g$ on $(0, L)$ with $u_0(0) = u_0(L) = 0$. Here $Q = \int_0^L g\,dx$ is the total load expressed as a slope (force divided by tension), and it is fixed by requiring the pluck height $u_0(x_p) = h$. In closed form,
37$$
38u_0(x) = Q\,\tau(x) + Q\,\kappa(x - x_p), \qquad
39\tau(x) = \begin{cases} x (L - x_p) / L, & x \le x_p, \\ x_p (L - x) / L, & x \ge x_p, \end{cases}
40$$
42$$
9d7f24cDefine the pluck as the static equilibrium under a raised-cosine finger load; w = 6 mm, signal scale 2.4 m/sJeremy Magland 43\kappa(y) = \begin{cases} y\,H(y) - \dfrac{1}{2w}\left[ \dfrac{(y + w)^2}{2} - \dfrac{w^2}{\pi^2}\left(1 + \cos\dfrac{\pi y}{w}\right) \right], & |y| \le w, \\[1ex] 0, & \text{otherwise,} \end{cases}
44\qquad
45Q = \frac{h}{x_p (L - x_p) / L - w\left(\tfrac{1}{4} - \tfrac{1}{\pi^2}\right)},
9d7f24cDefine the pluck as the static equilibrium under a raised-cosine finger load; w = 6 mm, signal scale 2.4 m/sJeremy Magland 48where $H$ is the Heaviside step ($H(y) = 1$ for $y > 0$, else $0$). $\tau$ is the triangle produced by a point load, and $\kappa$ is the correction from spreading the load over the contact region; it vanishes outside $|y| \le w$. Note that $u_0$ is three times continuously differentiable, since $g$ is continuously differentiable, and that $w < x_p < L - w$ so the fixed-end conditions hold.
50## Parameters
52| Symbol | Value | Unit | Meaning |
53| --- | --- | --- | --- |
54| $L$ | 0.65 | m | string length |
55| $c$ | 143 | m/s | wave speed (fundamental $c / 2L = 110$ Hz) |
56| $\sigma_0$ | 3 | 1/s | frequency-independent loss rate |
57| $\kappa$ | 0.004 | m^2/s | Kelvin-Voigt viscosity |
9d7f24cDefine the pluck as the static equilibrium under a raised-cosine finger load; w = 6 mm, signal scale 2.4 m/sJeremy Magland 58| $h$ | 0.002 | m | pluck height $u_0(x_p)$ |
ddfc839Add string-pluck-v1 challenge, solution schema, and scoring toolsJeremy Magland 59| $x_p$ | 0.1625 | m | pluck center ($L/4$) |
9d7f24cDefine the pluck as the static equilibrium under a raised-cosine finger load; w = 6 mm, signal scale 2.4 m/sJeremy Magland 60| $w$ | 0.006 | m | half-width of the finger load |
ddfc839Add string-pluck-v1 challenge, solution schema, and scoring toolsJeremy Magland 61| $x_m$ | 0.54 | m | pickup position |
63All values are exact decimal numbers, not rounded measurements.
65## Output signal
67The audio signal is the transverse velocity of the string at the pickup point,
69$$
70s(t) = \frac{\partial u}{\partial t}(x_m, t), \qquad \text{in m/s}.
71$$
73The deliverable is a wav file with the following properties.
75| Property | Value |
76| --- | --- |
77| channels | 1 |
78| sample rate $f_s$ | 48000 Hz |
79| number of samples $N$ | 96000 (2.0 s) |
80| sample format | 32-bit IEEE float (WAVE_FORMAT_IEEE_FLOAT) |
81| sample $k$, for $k = 0, \dots, N-1$ | $s(k / f_s) / s_\text{ref}$ |
82| $s_\text{ref}$ | see `output.signal_scale` in challenge.json (m/s) |
84The first sample is at $t = 0$, where $s(0) = 0$. Samples are pointwise values of the continuum signal. No anti-aliasing filter is applied, even though $s(t)$ contains frequency content above the Nyquist frequency; that content is heavily damped by the Kelvin-Voigt term and is part of the exact answer. The scale $s_\text{ref}$ is a fixed constant chosen so that the peak sample magnitude is roughly 0.5. Do not normalize the signal; absolute amplitude is compared.
86## Error measures
88Let $a_k$ and $r_k$, $k = 0, \dots, N-1$, be the samples of a submitted solution and of the reference solution. Two error measures are computed. Both are relative and dimensionless, and both are reported for every solution.
90**Waveform error** (primary):
92$$
93E_\text{wave} = \frac{\left( \sum_k (a_k - r_k)^2 \right)^{1/2}}{\left( \sum_k r_k^2 \right)^{1/2}}.
94$$
96**Spectrogram error.** Let $M = 2048$ be the frame length and $H = 512$ the hop. The periodic Hann window is $g_j = \tfrac{1}{2}\left(1 - \cos(2\pi j / M)\right)$ for $j = 0, \dots, M-1$. Frame $m$ of a signal $x$ is $x_{mH + j}\, g_j$, for $m = 0, \dots, \lfloor (N - M) / H \rfloor$, with no zero padding at either end. Let $X_m[q]$, $q = 0, \dots, M/2$, be its discrete Fourier transform, $X_m[q] = \sum_{j=0}^{M-1} x_{mH+j}\, g_j\, e^{-2\pi i q j / M}$. Then
98$$
99E_\text{spec} = \frac{\left( \sum_{m, q} \left( |A_m[q]| - |R_m[q]| \right)^2 \right)^{1/2}}{\left( \sum_{m, q} |R_m[q]|^2 \right)^{1/2}}.
100$$
102The spectrogram error ignores phase within a frame and is less sensitive than the waveform error to small frequency errors that accumulate into phase drift over the two seconds.
104## Reference solution
106There is no externally supplied ground truth. The reference is chosen automatically from the submitted solutions by the procedure described in the [collection README](../../README.md), unless `reference_solution` in challenge.json names one explicitly. For this particular challenge the modal series in the appendix gives an essentially exact answer, which is expected to be selected.
03370d1Register solution repositories and build the comparison site here; optional HDF5 field export in the schema and specJeremy Magland 108## Optional field export
110A submission may additionally provide the displacement field for visualization. This is not scored. The file is HDF5 with three datasets: `x`, float64, shape (201,), the positions $x_i = i L / 200$ in meters; `t`, float64, shape (4001,), the times $t_j = j / 2000$ in seconds; and `u`, float32, shape (4001, 201), with `u[j, i]` $= u(x_i, t_j)$ in meters. Root attributes `challenge_id`, `solution_id`, `quantity` (`"transverse displacement"`) and `units` (`"m"`) are recommended. The grid is stated under `fields` in challenge.json. A file of this size is about 3 MB uncompressed and can live in the solution repository; gzip compression inside the file is welcome.
ddfc839Add string-pluck-v1 challenge, solution schema, and scoring toolsJeremy Magland 112## Appendix: modal series solution
114This appendix is provided for convenience and verification; it is not part of the challenge definition, and a submission may use any method.
116Expanding $u(x, t) = \sum_{n \ge 1} a_n(t) \sin(k_n x)$ with $k_n = n\pi / L$, each coefficient satisfies
118$$
119a_n'' + 2\alpha_n a_n' + c^2 k_n^2 a_n = 0, \qquad \alpha_n = \sigma_0 + \tfrac{1}{2}\kappa k_n^2,
120$$
9d7f24cDefine the pluck as the static equilibrium under a raised-cosine finger load; w = 6 mm, signal scale 2.4 m/sJeremy Magland 122with $a_n(0) = A_n$ and $a_n'(0) = 0$. Integrating by parts twice, using $u_0'' = -g$ and the fixed ends,
124$$
9d7f24cDefine the pluck as the static equilibrium under a raised-cosine finger load; w = 6 mm, signal scale 2.4 m/sJeremy Magland 125A_n = \frac{2}{L} \int_0^L u_0(x) \sin(k_n x)\, dx = \frac{2}{L k_n^2} \int_0^L g(x) \sin(k_n x)\, dx = \frac{2Q}{L\, w\, k_n^3}\, \sin(k_n x_p)\, \sin(k_n w)\, \frac{(\pi / w)^2}{(\pi/w)^2 - k_n^2}.
128With the parameters above, $(\pi/w)^2 - k_n^2 \ne 0$ for every integer $n$, since $L / w$ is not an integer. For every mode that matters $\alpha_n < c k_n$ (the modes are underdamped up to roughly $n = 14800$), and in that case, with $\omega_n = \sqrt{c^2 k_n^2 - \alpha_n^2}$,
130$$
131a_n(t) = A_n e^{-\alpha_n t} \left( \cos \omega_n t + \frac{\alpha_n}{\omega_n} \sin \omega_n t \right), \qquad a_n'(t) = -A_n \frac{c^2 k_n^2}{\omega_n} e^{-\alpha_n t} \sin \omega_n t.
132$$
134The pickup velocity is then
136$$
137s(t) = \sum_{n \ge 1} a_n'(t) \sin(k_n x_m).
138$$
9d7f24cDefine the pluck as the static equilibrium under a raised-cosine finger load; w = 6 mm, signal scale 2.4 m/sJeremy Magland 140Since $|A_n| = O(n^{-5})$ and $|a_n'|$ carries an extra factor of $n$, the terms decay like $n^{-4}$ before damping is taken into account, and for $t > 0$ the exponential factor makes the series converge rapidly. In practice a few hundred modes give the signal to single precision for all $t \ge 1 / f_s$; at $t = 0$ the exact value is $s(0) = 0$.