Future Driver

Tape Converter for SG-1000 Level II BASIC

Introduction

SG-1000のLEVEL II BASICで保存した音声をBASICソースコードに変換するプログラムです。
Make BASIC source code from saved sound record on SG-1000 LEVEL II BASIC.

Download

wav2basic.c - console based program
C標準関数を使ったコンソールプログラムです。 各自自分の使っているOS上で使える様にコンパイルして下さい。
The source code is a console program with C standard functions. Please compile it make as usable on your OS.

Usage

第一引数に録音したWAVファイルを、第二引数に生成するソースコードファイル名を指定します。
Set a WAV file as the recorded to first argument, set a output source code file name to second argument.

$ wav2ascii source.wav distination.txt

Record Format

基本的にはEnriさんのサイトで詳しく解説されているので、そこを見れば良いでしょう。
ここでは波形についてだけ解説しておきます。
Basically, you had better visit Enri's home page it expound on the format.
So only expound on waveform here.

SK-1100から出力される音声はHIGHとLOWの二値です。 波形はPSGのそれと良く似ています。
The waveform shows only two values HIGH and LOW from SK-1100. It look like PSG waveform.

状態は無音、bit 0、 bit 1 の3種類です。
Bit 0 は 833.3 u秒の間に1回のパルスがあります。 周波数にして1200Hzです。
Bit 1 は 833.3 u秒の間に2回のパルスがあります。 周波数にして2400Hzです。
1度データストリームが始まると、 bitを表すパルスは連続していて、途切れる事はありません。
There is three state as silent, bit 0, bit 1.
Bit 0 represented by one pulse in 833.3 micro sec. 1200 Hz as frequency.
Bit 1 represented by two pulse in 833.3 micro sec. 2400 Hz as frequency.
When begin a data strem, the pulse is contiguous and without space.

1つのデータストリームはストリームの開始を表す7200回のパルスで始まります。 このパルスは最初の1回目だけ、下の図の様に、Bit 0 に相当する1200Hzです。 残る7199回のパルスはBit 1 に相当する2400Hzです。 7199回と言う事は、bit 1 を表すパルスとしては1回足りない事に注意して下さい。
One data stream begin with 7200 pulses. The pulses contain one 1200Hz pulse in the first (see the following figure). It like bit 0. Other 7199 pulses all 2400Hz. It like bit 1. But bit 1 represented by two pulses so the 7199 pulses lack more one pulse.

7200回のパルスの後にバイトデータが続きます。 全てのバイトデータは11 bitsで表され、一般的なシリアル通信形式に似ています。
Byte data is continued after the 7200 pulses. All byte data shows 11 bits and it like common serial protocol.

スタートビットは1です。 次にデータビットが続きます。 最後にストップビットが2つ続きます。 ストップビットは0です。
The start bit is 1. And followed by data bits. Finally followed by two stop bits. The stop bits are 0.

inserted by FC2 system