npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

z80ne-wav

v1.7.2

Published

Z80NE WAV decoder

Downloads

9

Readme

z80ne-wav

Utility for encoding/decoding WAV files for the Z80 N.E. Nuova Elettronica computer.

decodewav takes a WAV file created with the LX.385 tape interface and produces a binary (.HEX) file. encodewav does the opposite, takes a .HEX file and generates a .WAV file to be loaded on the Z80NE.

Installation

You must have Node.js installed. From the command prompt:

npm i z80ne-wav -g

Decoding a WAV file

From the command prompt:

decodewav -i inputfile.wav -o outputfile.hex [--noheader] [-b 300|600|1200] [--invert]

The --noheader switch is used to skip the two bytes header that encode the starting address of the file in memory.

The -b option sets de baudrate (300 by default).

The --invert option inverts the polarity of the audio samples.

Encoding a WAV

From the command prompt:

encodewav -i inputfile.hex -o outputfile.wav [-b 300|600|1200] [-a address] 

The -b option sets de baudrate (300 by default).

The -a option specifies the starting address in memory where the file is going to be loaded. It can be either a decimal or hexadecimal (with 0x prefix) number. If omitted, the starting address will be formed from the first two bytes in the file.

See the command line help for more options.

WAV file data format

Data are saved on the WAV file using Kansas Standard format, with 1200 Hz and 2400 Hz signals (for 300 bps speed). To be precise to encode a binary 0 there are 4 periods at 1200 Hz, while to encode a binary 1 there are 8 periods at 2400 Hz.

For every data bytes these data bits are written on tape:

  • 1 start bit at 0 (that is 4 periods at 1200 Hz)
  • 8 data bits, encoded as explained previously, starting from the least meaningful bit to the most one
  • 1 parity bit (even) computed on data bits: parity bit is 0 if the number of 1 of 8 data bits is even, it's 1 if the number of 1 of 8 data bits is odd
  • 2 stop bits at 1 (that is 16 periods at 2400 Hz).

For higher speeds it's sufficient to double frequencies. So:

  • for 300 bps 0 bits are at 1200 Hz, 1 bits are at 2400 Hz
  • for 600 bps 0 bits are at 2400 Hz, 1 bits are at 4800 Hz
  • for 1200 bps 0 bits are at 4800 Hz, 1 bits are at 9600 Hz.

The first two saved bytes are the memory address of the first following byte (the first byte is the most meaningful address byte, then there is the less meaningful one).