Crate ptcow

Crate ptcow 

Source
Expand description

ยง๐Ÿ„๐Ÿ„๐Ÿ„๐Ÿ„๐Ÿ„๐Ÿ„๐Ÿ„๐Ÿ„๐Ÿ„๐Ÿ„
๐Ÿฎ ptcow ๐Ÿฎ
๐Ÿ„๐Ÿ„๐Ÿ„๐Ÿ„๐Ÿ„๐Ÿ„๐Ÿ„๐Ÿ„๐Ÿ„๐Ÿ„

Library for editing and playback of PxTone (.ptcop) music.

Based on the PxTone C++ source code available here.

ยงโœ…Goals / โŒNon-goals

  • โœ… Support V5 (and newer) versions of PxTone.

  • โŒ No support for V4 and earlier. Maybe read support in the future, but no export support planned.

  • โœ… Rendering that sounds faithful to the original PxTone rendering

  • โŒ No sample-by-sample accuracy. There can be minor differences as long as it sounds (almost) indistinguishable.

ยงLimitations

  • Currently, ptcow only supports little endian architectures. There may be big endian support added in the future, but itโ€™s not a focus right now.

ยงGetting Started

To get started, load a .ptcop or .pttune file into a Vec<u8>, and call read_song on it. You can also check out crates/ptmoo for a command line player that writes samples to stdout.

Re-exportsยง

pub use timing::Meas;
pub use timing::SampleT;
pub use timing::SamplesPerTick;
pub use timing::Tick;
pub use timing::Tick16;
pub use timing::Timing;

Modulesยง

timing
Timing related definitions and utilities

Structsยง

Delay
A delay (reverb) effect
EnvPt
An envelope point
EnvelopeSrc
Describes an envelope for a Voice.
EveList
List of Events.
Event
Song event
FmtInfo
Information about what format the song is
GroupIdx
A group index.
Herd
The glorious cows that are going to moo your song
LoopPoints
Where the song ends and starts repeating from, as defined by the song.
Master
Timing and loop points
MooInstructions
How to moo the song
MooPlan
Plan for the cows on how to moo the song
NoiseData
Noise generated with a waveform generator
NoiseDesignOscillator
An oscillator for generating different kinds of noise waveforms.
NoiseDesignUnit
Describes how to generate a noise design waveform
NoiseDesignUnitFlags
What attributes of NoiseDesignUnit to serialize
NoiseTable
Contains wave tables for generating different kinds of noises.
OggVData
Ogg/Vorbis voice data
OsciArgs
Oscillator arguments
OsciPt
2d point for coord and overtone based wave generation.
Overdrive
Overdrive effect that amplifies and cuts the samples of a sample group
PcmData
Describes PCM (Pulse Code Modulation) voice data
Song
A PxTone song
Text
Song name and comment
Unit
A ๐Ÿ„ cow that moos a channel of your song, otherwise known as a unit.
UnitIdx
Unit index
Voice
Audio data that gives Units a voice. In other words, an instrument.
VoiceFlags
Different attributes a voice can have
VoiceIdx
Voice index
VoiceInstance
Contains the precomputed sample and envelope data for a voice
VoiceTone
Data keeping track of play state of a voice
VoiceUnit
Data required to generate and play voice samples

Enumsยง

Bps
Bits per sample
ChNum
Channel number (mono or stereo)
DelayUnit
What unit should the delay frequency be treated as
EventPayload
Payload of an event
FmtKind
Kind of PxTone format we are dealing with
FmtVer
PxTone format version
NoiseType
Types of waves for noise generation
ProjectReadError
Error that can happen when reading a PxTone project
StartPosPlan
Start position that can be given in different units
VoiceData
The data used for the voice waveform
WaveData
What kind of wave to generate

Constantsยง

DEFAULT_KEY
The default Key units start out with
NATIVE_SAMPLE_RATE
The sample rate PxTone internally works with

Functionsยง

coord
Get the amplitude of sample at index for a coordinate based wave.
current_tick
Get the current Tick the playback is at.
do_event
Do a single event
moo_prepare
Prepare to moo.
noise_to_pcm
Build PCM data out of NoiseData.
overtone
Get the amplitude of sample at index for an Overtone based wave.
read_song
Read a PxTone song from a byte array.
rebuild_tones
Adjust voice and effect tones to output sample rate
serialize_project
Serialize the project into the PxTone file format

Type Aliasesยง

Key
1/256 of a semitone.
PanTimeBuf
Buffer to store a Unitโ€™s audio samples before applying the pan time effect.
PanTimeOff
Pan-time offset.
ReadResult
Result of attempting to read a PxTone project
SampleRate
Wide enough to represent 48 Khz
SourceSampleRate
Some sources (Ogg/Vorbis) can have high sample rates (96 khz for example)