Close

Chapter 3: Generation 2 - WAV File Becomes TV (Spresense Version)

A project log for Spresense Audio Jack as NTSC Video Output

Playing NTSC composite video on a TV using Sony Spresense's 192kHz 24bit HiRes Audio DAC — no code changes, just a WAV file.

chrmlinux03chrmlinux03 4 hours ago0 Comments

3.1 The Key Insight

After completing the CH32V003 version, something became clear while working with the Spresense Audio library.

Spresense has a feature called 192kHz 24bit HiRes Audio — sampling rate equivalent to professional audio equipment. It can update voltage 192,000 times per second.

1 sample = 1/192000 sec = 5.2us

The NTSC horizontal sync frequency is 15,734Hz. One line period is:

1 line = 1/15734 sec = 63.5us

Samples per line:

63.5us / 5.2us = 12 samples

12 samples can represent 1 line.

Spresense has stereo output, so L and R channels can be controlled independently.

L ch = VIDEO signal (luminance) R ch = SYNC signal (sync pulse)

Mix them with 2 resistors and you get an NTSC signal.

3.2 The Critical Realization

Spresense has a sample called player_hires.ino. It simply plays a RAW file from the SD card at 192kHz 24bit Stereo. Nothing more.

This code is not changed at all.

Only the file on the SD card is changed. Put NTSC waveform data inside ntsc.raw, and the Audio Player outputs NTSC signal directly.

The CPU is doing nothing in real time. It is simply playing back.

This is the decisive difference from Generation 1.

Generation 1 (CH32V003): CPU generates video signal in real time

Generation 2 (Spresense): Python pre-generates the data, CPU only plays it back

3.3 Circuit

Just 2 resistors.

Headphone Jack:

 
L (tip) -> 470 ohm -> RCA center pin
R (middle) -> 1k ohm -> RCA center pin
G (sleeve) -----------> RCA GND


3.4 PCM Values and NTSC Voltage Levels

PCM_SYNC = 0x000000 # 0V = sync pulse 

PCM_BLACK = 0x100000 # 0.3V = black level 

PCM_WHITE = 0x7FFFFF # 1.0V = white level (maximum brightness)

3.5 Result

Oscilloscope measurements:

Horizontal frequency : 15.97kHz (spec: 15.734kHz) Period : 62.56us (spec: 63.5us) Vpp : 960mV (spec: 1Vpp)

Video appeared on the TV.

But "video appeared" is not the accurate description. More precisely:

"A WAV file was played on a TV."

Discussions