Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

[Bug]: Time-stretched proxies are written at the source's bit depth

Open Beginner friendly
#475 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
68/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
cpp

Research direction

The bit-depth choice is in the proxy writer in modules/tracktion_engine/model/clips/tracktion_AudioClipBase.cpp, around line 158, where std::max (16, sourceInfo.bitsPerSample) is passed to AudioFileWriter. Read how proxyInfo is set to tell time-stretched proxies from normal ones. Done means time-stretched proxies are written as 32-bit float while normal-speed proxies keep the source bit depth. Check this with a stretched and an unstretched clip, since the patch in the issue is unverified.

Written by the indexing model from the issue text.

Description

Summary. ProxyGeneratorJob writes a time-stretched proxy with std::max (16, sourceInfo.bitsPerSample) bits, i.e. 16 or 24-bit integer. The stretcher's output is new audio: it gets requantised and clipped if it exceeds 0 dBFS.

Proposal (patch below): write time-stretched proxies as 32-bit float; normal-speed proxies keep the source's bit depth.

Environment: develop @07e2d674 with its JUCE 8.0.13, macOS arm64, 48 kHz, TRACKTION_ENABLE_TIMESTRETCH_SIGNALSMITH=1. The code in question is unchanged on develop @38d5a275.

Patch: 001-proxy-32bit-float.patch
diff --git a/modules/tracktion_engine/model/clips/tracktion_AudioClipBase.cpp b/modules/tracktion_engine/model/clips/tracktion_AudioClipBase.cpp
index b3d2852..6e8964e 100644
--- a/modules/tracktion_engine/model/clips/tracktion_AudioClipBase.cpp
+++ b/modules/tracktion_engine/model/clips/tracktion_AudioClipBase.cpp
@@ -158,9 +158,13 @@ private:
         if (! wavFormat->isChannelLayoutSupported (sourceInfo.channelLayout))
             sourceInfo.channelLayout = juce::AudioChannelSet::discreteChannels (sourceInfo.channelLayout.size());
 
+        // A time-stretched proxy is new audio, not a copy of the source: write it as 32-bit float
+        // so it isn't requantised to the source's bit depth or clipped above 0 dBFS
+        const int bitsPerSample = proxyInfo != nullptr ? 32 : std::max (16, sourceInfo.bitsPerSample);
+
         AudioFileWriter writer (tempFile, wavFormat,
                                 sourceInfo.numChannels, sourceInfo.sampleRate,
-                                std::max (16, sourceInfo.bitsPerSample),
+                                bitsPerSample,
                                 sourceInfo.metadata, 0,
                                 sourceInfo.channelLayout);
 
Dominant language
C++
Stars
1.5k
Forks
222
Avg merge
15h 44m
Merged PRs (30d)
33

Getting set up

This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from Tracktion/tracktion_engine

All issues in Tracktion/tracktion_engine

Similar issues

More C++ issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.