Expand description
A library for parsing ZX Spectrum .tzx and
Amstrad CPC .cdt tape data files, and converting
encoded tape data to waveform sample data for conversion to WAV or direct playback.
To parse a TZX/CDT data, use rtzx::TzxData::parse_from().
Example:
let file = match File::open("some-zx-spectrum-tape.tzx") {
Err(why) => panic!("Couldn't open file: {}", why),
Ok(file) => file,
};
let tzx_data = TzxData::parse_from(file);The rtzx::TzxData struct contains two fields,
the .header for specifying the TZX version, and
.blocks, which a vector containing all blocks parsed from the
TZX data.
Parsing a TZX/CDT file does not require configuration, however conversion / playback will need
rtzx::Config to set the sample rate, playback speed, etc.
To obtain sample data for conversion / playback, the idea is to loop over the blocks and use
.get_waveforms(). Waveform structs implement
the Waveform trait and can either be iterated dirctly for
conversion to WAV
(e.g. rtzx::ui::commands::convert::run_convert)
or used as Sources for playback
with Rodio
Re-exports§
pub use crate::u24::U24;pub use crate::tzx::Config;pub use crate::tzx::Platform;pub use crate::tzx::TapeDataFile;pub use crate::tzx::TapeDataFileType;pub use crate::tzx::TzxData;