Importing recordings from DSi Sound

Shared clip names, catalogue placement, CRC checks and ADPCM conversion.

V2 Studio reads clips exposed by DSi Sound through share:/. It validates a fixed-size container, decodes its ADPCM, resamples PCM and encodes audio for the nominal 8180 Hz stream. It does not simply copy a WAV or PPM track. The parser, catalogue and conversion routines were executed in American, Japanese and European V2; that does not establish the same path in Japanese V1. [1]

Filename contract

share:/voice%02d%02d%02d%02d%02d%02d%02d%03d%01d%01d%02d%02d.dat

The directory adapter stores the name length at record +0x118 and its name at +0x14. The parser requires length thirty-two and prefix voice, then reads twelve fixed-width decimal fields. The complete path is thirty-nine bytes plus NUL, filling the importer's forty-byte buffer. It does not validate the four suffix bytes, but loading reconstructs the canonical .dat path. [1]

Entry byteFilename offset / widthBoundsUse
05 / 20–20Source slot; catalogue only admits 0–17
17 / 20–99Year-shaped field
29 / 21–12Month-shaped field
311 / 21–31Day-shaped field
413 / 20–23Hour-shaped field
515 / 20–59Minute-shaped field
617 / 20–59Second-shaped field
719 / 30–5Button-cell selection
822 / 10–4Meaning unresolved
923 / 11–3Button-cell selection
1024 / 20–21Primary/secondary placement
1126 / 20–99Meaning unresolved

The field reader returns minus one for a non-digit and caps parsed values above ninety-nine. Each field is checked separately; this is not full calendar validation. The parser can populate all twelve output bytes before rejecting a bound, so a nonempty record does not imply success. Empty records are twelve FF bytes; the path builder refuses a signed-negative byte ten. The full date interpretation of the calendar-shaped fields is not independently established. [1]

Eighteen catalogue slots

  • A primary record has byte ten zero and replaces its source slot. A displaced record becomes a fallback candidate.
  • A secondary record fills its empty source slot directly; if occupied, the incoming record becomes the candidate.
  • A candidate with nonzero byte ten can fill empty position byte ten minus one, only within zero through seventeen.
  • Occupied fallback positions are preserved. The record keeps its original source-slot byte.

Directory order can therefore affect collisions; this worker does not sort timestamps. Native cells use 1 + 12 × (byte nine − 1) + 2 × byte seven. The eighteen positions form six columns and three rows at X = 26 + 41 × column and Y = 30 + 40 × row. [1]

Shared container

The file must be exactly 0x14402 (82,946) bytes: an 0x14400-byte body followed by a little-endian CRC16. Both reads must return their exact requested lengths. The importer asks the BIOS service to calculate a seed-zero CRC over the entire body and compares the trailer. The execution fixture models polynomial A001; it does not execute a physical BIOS or shared filesystem. [1]

Conversion receives ADPCM at body +12, source byte length equal to the word at +8 multiplied by four, and sample rate from the halfword at +2. The other descriptor bytes are not all semantically identified by this importer. The body can contain padding beyond that declared audio. A busy guard rejects re-entry; opened files are closed and temporary storage released across the checked length, read, CRC and conversion failures. Zero from conversion is propagated. [1]

Conversion lengths and state

The converter uses two temporary regions of 663,456 bytes. It accepts signed rates 1–48,000, copies the four-byte source state to local state and destination, then checks that the declared source and destination lengths are at least four. The early copies matter when reproducing short-length cases with valid backing storage. It decodes at most 331,728 samples and requests floor(decoded samples × 8180 / source rate), then runs the whole-buffer resampler. [1]

Output is limited to twice the destination capacity after its four-byte header and rounded down to an even sample count. Encoding uses the decoder's final predictor/index, while the copied destination header still holds the initial state. The returned length is coded bytes only, excluding those four header bytes. That differs from the whole encoder's header-inclusive length and eight-sample padding. Sixteen coded source bytes yield thirty-two decoded samples: conversion returns sixteen coded bytes at 8180 Hz or eight at 16360 Hz; capacity seven permits three coded bytes after the header. [1]

Four-tap resampling

Resampler offsetState
0x00–0x1FHistory/work area
0x20Unsigned sixteen-bit phase
0x22Untouched halfword
0x24Flags; bit zero clears initial history
0x28 / 0x2CAdvanced source / destination pointers
0x30 / 0x34Signed input / output sample counts

Nonpositive counts return before filtering. First use clears thirty-two history bytes and flags. The filter has sixty-four phases of four signed sixteen-bit coefficients, selected by phase shifted right ten. The first row is 3129, 26285, 3398, −33. Its signed 16.16 step starts as (input count shifted sixteen) divided by output count, then receives one-unit corrections so projected consumption matches the intended source count under the original unsigned arithmetic. [1]

Each output sums four history products, shifts the signed result right fifteen, clips to −32768…32767 and emits before advancing history. Samples enter a duplicated four-sample ring when phase crosses 0x10000. Phase, pointers and rotated history persist. Whole-buffer processing retains that owner across chunks of 8,180 input samples and rounds each chunk separately. Requested 4,091 output samples from 8,181 input can return 4,090; 20,000 input requesting 10,001 can return 10,000. Ordinary floating-point interpolation or a single final rounding step is not equivalent. [1]

Scene selection and preview

The American scene tracks selected position at +0x5C, remembered preview at +0x5D, currently pressed position at +0x5E and confirmation state at +0x5F; FF means no position. Available presses select, unavailable presses clear selection and stop preview. No selected node restores the remembered preview. Release enables confirmation and starts preview when a position exists; cancellation stops it and clears selection. [1]

Preview requests 0x14400 bytes, stores its returned length and prepares channel zero with that length shifted right two, then starts channel and frame clock. This owner has no separate zero-length refusal. Back stops and returns; confirmation stops, imports the currently selected record into the chosen BGM/effect track, then returns. Effects request 0x2000 bytes; BGM asks its document owner for capacity. These scene checks do not establish a complete rendered screen, successful device playback or parent recovery after every failed import. No original Flipnote-to-DSi-Sound exporter is established by this read-only shared-file branch. [1]

Returning to the recorded parent

American V2 02056078 reaches the original application lookup and history pop through 02008574, 020432C0 and 02043270. A history record is 268 bytes, starting at application offset sixteen. The retained depth is at 5376, current mode at 5384, restored mode at 5388 and restored parameter at 5392. Current modes fourteen/seventeen and depths one/twenty all restore the prepared parent mode seven, parameter three; the depth-one route additionally reaches a checkpoint boundary. [2]

Transition policy 02026D00 requests its mode-seven metadata reset, then publishes engine token 02215470 at offset eight and initial tick FFFFFFFF at twelve. These are original stores, not an uninitialised test value. This history differs from the small byte-mode stack under application architecture. External DSi Sound launch, complete scene construction and durable checkpoints were not executed by the four return comparisons. [2]

Sources

  1. [1] Flipnote Decompilation Project — Original DSi Sound shared files, conversion and import scene
  2. [2] Flipnote Decompilation Project — Original DSi Sound return and application history

← All documentation