SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2505.13000 · 2025

DualCodec: A Low-Frame-Rate, Semantically-Enhanced Neural Audio Codec for Speech Generation

arXiv · PDF · Open in the Atlas

Code that ran

7 of 8 samples (functions and classes) lifted from this paper's linked repositories executed on a synthesized input in Syntology's jail (0 of them constructed an object rather than computing a result; 0 honoured the contract we drafted, 0 violated it and 6 have no contract verdict; 1 failure of our instrument; 1 no recorded run), measured 2026-11-24; repository links from the Papers with Code archive attributed under CC BY-SA, no affiliation; bodies inline only under a permissive licence as GitHub detects it. Not a reproduction of the paper's results.

"Ran" means the function executed on a synthesized input and returned a value. It is not a reproduction of the paper's results. This record, dated, as JSON: /api/ran/2505.13000.json · badge: /api/ran/2505.13000.svg

Each repository's role is a label: a classifier's output recorded on the link, or, where no role is recorded, what the Papers with Code archive marked. The line under it names its basis. Neither says who wrote the code.

RepositoryRoleRan
jiaqili3/DualCodec canonical (classifier label)
classifier basis not recorded on the link
7 ran · 1 no recorded run
FunctionStatusWhere it lives
batch Ran
ran on a synthesized input
jiaqili3/DualCodec/dualcodec/dataset/processor.py
code served (permissive licence) · get_code("ceaa742d42b41c00")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned generator. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch
import numpy as np

torch.manual_seed(0)

# Create sample data with the structure expected by the batch function
# Each sample needs 'key', 'speech_feat', 'text_token', and 'label'
data = [
    {
        'key': 'sample_0',
        'speech_feat': torch.randn(100, 4),  # 100 frames, 4 features
        'text_token': [1, 2, 3],
        'label': 0
    },
    {
        'key': 'sample_1',
        'speech_feat': torch.randn(150, 4),  # 150 frames, 4 features
        'text_token': [4, 5],
        'label': 1
    },
    {
        'key': 'sample_2',
        'speech_feat': torch.randn(80, 4),  # 80 frames, 4 features
        'text_token': [6, 7, 8, 9],
        'label': 0
    },
    {
        'key': 'sample_3',
        'speech_feat': torch.randn(120, 4),  # 120 frames, 4 features
        'text_token': [10],
        'label': 1
    },
]

ARGS = {
    'data': data,
    'batch_type': 'static',
    'batch_size': 2,
    'max_frames_in_batch': 12000,
    'mode': 'train',
    'ignore_text': False
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type generator — a generator output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a generator output the recorded ndim 0 and dtype family float describe that coercion, not the output, and are not stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
pad_to_length Ran
ran on a synthesized input
jiaqili3/DualCodec/dualcodec/model_codec/dac_model.py
code served (permissive licence) · get_code("d548fecaa09ac280")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned Tensor, ndim 2, dtype family float, shape (2, 6) as a later run recorded it. The image it ran in was not recorded. If your copy returns the same type, ndim and shape on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch
import torch.nn.functional as F

torch.manual_seed(0)

# Create a small tensor with shape (batch=2, features=4)
x = torch.randn(2, 4)

# Target length to pad/truncate to
length = 6

# Padding value (default is 0, but we can specify it)
pad_value = 0

ARGS = {
    "x": x,
    "length": length,
    "pad_value": pad_value,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type Tensor, ndim 2, dtype family float, shape (2, 6) — shape (2, 6) as a later run recorded it
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
prepare_gluster_dataset Ran
ran on a synthesized input
jiaqili3/DualCodec/dualcodec/dataset/dataset.py
code served (permissive licence) · get_code("6be4da9d721293fb")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned Processor. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch
import random
import math
from torch.utils.data import IterableDataset

torch.manual_seed(0)

class DistributedSampler:
    """
    DistributedSampler
    """

    def __init__(self, shuffle=True, partition=True):
        """
        :param shuffle:
        :param partition:
        """
        self.epoch = -1
        self.update()
        self.shuffle = shuffle
        self.partition = partition

    def update(self):
        """
        :return:
        """
        self.rank = 0
        self.world_size = 1
        self.worker_id = 0
        self.num_workers = 1
        ret = dict(rank=self.rank, world_size=self.world_size, worker_id=self.worker_id, num_workers=self.num_workers)
        return ret

    def set_epoch(self, epoch):
        """
        :param epoch:
        :return:
        """
        self.epoch = epoch

    def sample(self, data):
        """Sample data according to rank/world_size/num_workers

        Args:
            data(List): input data list

        Returns:
            List: data list after sample
        """
        data = list(range(len(data)))
        if self.partition:
            if self.shuffle:
                random.Random(self.epoch).shuffle(data)
            if len(data) < self.world_size:
                data = data * math.ceil(self.world_size / len(data))
                data = data[:self.world_size]
            data = data[self.rank::self.world_size]
        if len(data) < self.num_workers:
            data = data * math.ceil(self.num_workers / len(data))
            data = data[:self.num_workers]
        data = data[self.worker_id::self.num_workers]
        return data


class DataList(IterableDataset):
    """
    DataList IterableDataset
    """

    def __init__(self, lists, shuffle=True, partition=True):
        """
        :param lists:
        :param shuffle:
        :param partition:
        """
        self.lists = lists
        self.partition = partition
        if partition:
            self.sampler = DistributedSampler(shuffle, partition)
            self.sampler_info = self.sampler.update()
            self.indexes = self.sampler.sample(self.lists)
        else:
            self.indexes = list(range(len(self.lists)))

    def set_epoch(self, epoch):
        """
        :param epoch:
        :return:
        """
        self.sampler.set_epoch(epoch)

    def __len__(self):
        return len(self.indexes)

    def __iter__(self):
        """
        :return:
        """
        if self.partition:
            for index in self.indexes:
                try:
                    data = dict(src=self.lists[index])
                    data.update(self.sampler_info)
                    yield data
                except Exception as e:
                    continue
        else:
            for i in self.lists:
                data = dict(src=i)
                yield data


class Processor(IterableDataset):
    """
    Processor IterableDataset
    """

    def __init__(self, source, f, *args, **kw):
        """
        :param source:
        :param f:
        :param args:
        :param kw:
        """
        assert callable(f)
        self.source = source
        self.f = f
        self.args = args
        self.kw = kw

    def set_epoch(self, epoch):
        """
        :param epoch:
        :return:
        """
        self.source.set_epoch(epoch)

    def __len__(self):
        return len(self.source)

    def __iter__(self):
        """Return an iterator over the source dataset processed by the
        given processor.
        """
        assert self.source is not None
        assert callable(self.f)
        return self.f(iter(self.source), *self.args, **self.kw)

    def apply(self, f):
        """
        :param f:
        :return:
        """
        assert callable(f)
        return Processor(self, f, *self.args, **self.kw)


def sample_processor_1(iterator, mode='train'):
    for item in iterator:
        item['processed_1'] = True
        yield item


def sample_processor_2(iterator, mode='train'):
    for item in iterator:
        item['processed_2'] = True
        yield item


data_list_obj = DataList(['item_0', 'item_1', 'item_2'], shuffle=True, partition=True)

pipeline_funcs = [sample_processor_1, sample_processor_2]

ARGS = {
    'data_list': data_list_obj,
    'data_pipeline': pipeline_funcs,
    'mode': 'train'
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type Processor — a Processor output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a Processor output the recorded ndim 1 and dtype family float describe that coercion, not the output, and are not stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
read_json_lists Ran
ran on a synthesized input
jiaqili3/DualCodec/dualcodec/dataset/file_utils.py
code served (permissive licence) · get_code("d02d287ae67db103")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned dict. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import tempfile
import json
import os

# Create temporary files for testing
temp_dir = tempfile.mkdtemp()

# Create a list file containing paths to JSON files
json_file_1 = os.path.join(temp_dir, "data1.json")
json_file_2 = os.path.join(temp_dir, "data2.json")
list_file = os.path.join(temp_dir, "list.txt")

# Write JSON data files
with open(json_file_1, 'w', encoding='utf8') as f:
    json.dump({"key1": "value1", "key2": "value2"}, f)

with open(json_file_2, 'w', encoding='utf8') as f:
    json.dump({"key3": "value3", "key4": "value4"}, f)

# Write list file with paths to JSON files
with open(list_file, 'w', encoding='utf8') as f:
    f.write(json_file_1 + "\n")
    f.write(json_file_2 + "\n")

ARGS = {
    "list_file": list_file
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
none outside the standard library — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type dict — a dict output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a dict output the recorded ndim 0 and dtype family float describe that coercion, not the output, and are not stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
read_lists Ran
ran on a synthesized input
jiaqili3/DualCodec/dualcodec/dataset/file_utils.py
code served (permissive licence) · get_code("76cb8017cf220876")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned list, ndim 1, dtype family float; no output shape is stated. The image it ran in was not recorded. If your copy returns the same type and ndim on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import tempfile
import os

# Create a temporary file with some test content
temp_file = tempfile.NamedTemporaryFile(mode='w', delete=False, encoding='utf8', suffix='.txt')
temp_file.write("line one\n")
temp_file.write("line two with spaces  \n")
temp_file.write("line three\n")
temp_file.close()

ARGS = {
    'list_file': temp_file.name
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
none outside the standard library — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type list, ndim 1, dtype family float — a list output has no array shape of its own; none is stated
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
snake Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
jiaqili3/DualCodec/dualcodec/model_codec/dac_layers.py
code served (permissive licence) · get_code("f247e4748f379a76")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned Tensor, ndim 4, dtype family float, shape (2, 4, 3, 5) as a later run recorded it. The image it ran in was not recorded. If your copy returns the same type, ndim and shape on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch

torch.manual_seed(0)

# The function takes two parameters: x (a tensor) and alpha (a scalar or tensor)
# x is reshaped, modified with sin operations, and reshaped back
# alpha is used in arithmetic operations (reciprocal, multiplication)

# Create a small tensor with shape (batch=2, channels=4, height=3, width=5)
x = torch.randn(2, 4, 3, 5)

# Create a scalar alpha parameter
alpha = torch.tensor(1.0)

ARGS = {
    "x": x,
    "alpha": alpha,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type Tensor, ndim 4, dtype family float, shape (2, 4, 3, 5) — shape (2, 4, 3, 5) as a later run recorded it
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
tokenize Ran
ran on a synthesized input
jiaqili3/DualCodec/dualcodec/dataset/processor.py
code served (permissive licence) · get_code("06cc7e2f6e744cda")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned generator. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import string

class StandInTokenizer:
    def __init__(self):
        self.language_tokens = {
            'en': 50257,
            'fr': 50258,
            'de': 50259,
            'es': 50260,
        }
    
    def encode(self, text, allowed_special='all'):
        # Simple mock: convert text to token ids
        tokens = []
        for char in text:
            tokens.append(ord(char) % 256)
        return tokens
    
    def to_language_token(self, language):
        return self.language_tokens.get(language, 50257)

def get_tokenizer_fn():
    return StandInTokenizer()

def data_generator():
    # Generate sample data matching the expected format
    samples = [
        {
            'text': 'hello world',
            'language': 'en',
            'key': 'sample1',
        },
        {
            'text': 'bonjour le monde',
            'language': 'fr',
            'key': 'sample2',
        },
        {
            'text': 'hello',
            'language': 'de',
            'key': 'sample3',
        },
    ]
    for sample in samples:
        yield sample

ARGS = {
    'data': data_generator(),
    'get_tokenizer': get_tokenizer_fn,
    'allowed_special': 'all',
    'mode': 'train',
    'prepend_language_token': True,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
none outside the standard library — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type generator — a generator output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a generator output the recorded ndim 0 and dtype family float describe that coercion, not the output, and are not stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
Dataset Not yet run
unverified (harvested, no recorded run)
jiaqili3/DualCodec/dualcodec/dataset/dataset.py
code served (permissive licence) · get_code("dc6ecd768e01e65d")
How it ran

no invocation recorded.

Also present in other papers' code

Of 8 samples lifted from this paper's linked repositories, 8 carry a function identity and 0 do not. Of the 8 distinct functions with an identity, 1 are also present in other papers whose code we hold (1 with at least one paper dated earlier, 0 the same month, 1 later) and 7 are only here among the 52,977 papers whose code Syntology holds (as of 2026-09-26).

Only here means: among the 52,977 papers whose code Syntology holds (51,887 with lifted samples, 1,090 through their assemblies only), as of 2026-09-26, no other paper's lifted samples or current assembly bricks contain an identical function body after normalisation.

FunctionAlso present inEarliest-datedOthers named
snake 10 other papers
9 dated earlier, 1 later · 1 only as an assembly brick
2306.06546 (2023-06)
High-Fidelity Audio Compression with Improved RVQGAN
2307.04686 (2023-07)
VampNet: Music Generation via Masked Acoustic Token Modeling
2308.16692 (2023-08)
SPEECHTOKENIZER: UNIFIED SPEECH TOKENIZER FOR SPEECH LANGUAGE MODELS
and 7 more not named here

Presence, not direction: an identical function body in two papers' repositories does not say who wrote it, which came from which, or that either paper's method rests on it. Matching is exact after normalisation, so a renamed or edited function is not matched. Dates are when papers appeared, not when code was written. Only .py files the harvester lifted are covered; notebooks are not read. A new-style arXiv id YYMM.NNNN dates a paper to the month 20YY-MM; otherwise Paper.year dates it to the year; otherwise it is undated. Dates are when the paper appeared, not when the code was written. Read 2026-11-24.

Repositories linked to this paper

Some links come from the archived Papers with Code dataset (CC BY-SA 4.0): attribution and licence.

Abstract

Neural audio codecs form the foundational building blocks for language model (LM)-based speech generation. Typically, there is a trade-off between frame rate and audio quality. This study introduces a low-frame-rate, semantically enhanced codec model. Existing approaches distill semantically rich self-supervised (SSL) representations into the first-layer codec tokens. This work proposes DualCodec, a dual-stream encoding approach that integrates SSL and waveform representations within an end-to-end codec framework. In this setting, DualCodec enhances the semantic information in the first-layer codec and enables the codec system to maintain high audio quality while operating at a low frame rate. Note that a low-frame-rate codec improves the efficiency of speech generation. Experimental results on audio codec and speech generation tasks confirm the effectiveness of the proposed DualCodec compared to state-of-the-art codec systems, such as Mimi Codec, SpeechTokenizer, DAC, and Encodec. Demos are available at: https://dualcodec.github.io, code is available at: https://github.com/jiaqili3/DualCodec

For agents

The same record, over MCP at https://syntology.ai/mcp:

get_harvested_code_for_paper("2505.13000")
get_code_for_paper("2505.13000")
have("2505.13000")

The run record, dated, one paper per request, free:

curl https://syntology.ai/api/ran/2505.13000.json

A badge for a README (the split and the date, never a ratio):

[![Syntology run record](https://syntology.ai/api/ran/2505.13000.svg)](https://syntology.ai/paper/2505.13000)

Connect an agent — have() is free.