ddfc839Add string-pluck-v1 challenge, solution schema, and scoring toolsJeremy Magland 1# string-pluck-v1: plucked damped string, pickup velocity
3This is the hello-world challenge of the collection. The model is a linear damped string with fixed ends, released from rest from a smooth plucked shape. 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$$
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. The initial shape is a raised cosine bump of height $h$ and half-width $w$ centered at the pluck point $x_p$:
29$$
30u_0(x) = \begin{cases} \dfrac{h}{2}\left(1 + \cos\dfrac{\pi (x - x_p)}{w}\right), & |x - x_p| \le w, \\[1ex] 0, & \text{otherwise.} \end{cases}
31$$
33Note that $u_0$ is continuously differentiable and vanishes at both ends, since $w < x_p < L - w$.
35## Parameters
37| Symbol | Value | Unit | Meaning |
38| --- | --- | --- | --- |
39| $L$ | 0.65 | m | string length |
40| $c$ | 143 | m/s | wave speed (fundamental $c / 2L = 110$ Hz) |
41| $\sigma_0$ | 3 | 1/s | frequency-independent loss rate |
42| $\kappa$ | 0.004 | m^2/s | Kelvin-Voigt viscosity |
43| $h$ | 0.002 | m | pluck height |
44| $x_p$ | 0.1625 | m | pluck center ($L/4$) |
45| $w$ | 0.03 | m | pluck half-width |
46| $x_m$ | 0.54 | m | pickup position |
48All values are exact decimal numbers, not rounded measurements.
50## Output signal
52The audio signal is the transverse velocity of the string at the pickup point,
54$$
55s(t) = \frac{\partial u}{\partial t}(x_m, t), \qquad \text{in m/s}.
56$$
58The deliverable is a wav file with the following properties.
60| Property | Value |
61| --- | --- |
62| channels | 1 |
63| sample rate $f_s$ | 48000 Hz |
64| number of samples $N$ | 96000 (2.0 s) |
65| sample format | 32-bit IEEE float (WAVE_FORMAT_IEEE_FLOAT) |
66| sample $k$, for $k = 0, \dots, N-1$ | $s(k / f_s) / s_\text{ref}$ |
67| $s_\text{ref}$ | see `output.signal_scale` in challenge.json (m/s) |
69The 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.
71## Error measures
73Let $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.
75**Waveform error** (primary):
77$$
78E_\text{wave} = \frac{\left( \sum_k (a_k - r_k)^2 \right)^{1/2}}{\left( \sum_k r_k^2 \right)^{1/2}}.
79$$
81**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
83$$
84E_\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}}.
85$$
87The 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.
89## Reference solution
91There 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 93## Optional field export
95A 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 97## Appendix: modal series solution
99This appendix is provided for convenience and verification; it is not part of the challenge definition, and a submission may use any method.
101Expanding $u(x, t) = \sum_{n \ge 1} a_n(t) \sin(k_n x)$ with $k_n = n\pi / L$, each coefficient satisfies
103$$
104a_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,
105$$
107with $a_n(0) = A_n$ and $a_n'(0) = 0$, where
109$$
110A_n = \frac{2}{L} \int_0^L u_0(x) \sin(k_n x)\, dx = \frac{2h}{L}\, \sin(k_n x_p)\, \sin(k_n w)\, \frac{(\pi / w)^2}{k_n \left( (\pi/w)^2 - k_n^2 \right)}.
111$$
113With 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}$,
115$$
116a_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.
117$$
119The pickup velocity is then
121$$
122s(t) = \sum_{n \ge 1} a_n'(t) \sin(k_n x_m).
123$$
125Since $|A_n| = O(n^{-3})$ and $|a_n'|$ carries an extra factor of $n$, the terms decay like $n^{-2}$ 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$.