Expand description
This library lets you parse Dirtywave M8 data
See, in particular, the read
method available on:
E.g.:
use m8_file_parser::*;
let mut f = std::fs::File::open("./examples/songs/TEST-FILE.m8s").unwrap();
let song = Song::read(&mut f).unwrap();
dbg!(song);
For song writing and file manipulation, you will need to load the whole file in memory, in order to be able to overwrite it
use m8_file_parser::*;
use m8_file_parser::remapper::Remapper;
let mut song_data = std::fs::read("./examples/songs/V4EMPTY.m8s").unwrap();
let mut song_reader = reader::Reader::new(song_data.clone());
let mut song = Song::read_from_reader(&mut song_reader).unwrap();
// let's renumber an instrument
let mut remapper = Remapper::default_ver(song.version);
let instrument : usize = 4;
let to_instrument = 10;
remapper.instrument_mapping.mapping[instrument] = to_instrument;
remapper.instrument_mapping.to_move.push(instrument as u8);
remapper.renumber(&mut song);
dbg!(&song);
let mut output_writer = writer::Writer::new(song_data);
song.write(&mut output_writer);
// ready to be written elsewhere
let output_song_data = output_writer.finish();
You also can perform more complex copies of chain, that will copy intrument/eq/table definitions required to copy a chain from a song to another
use m8_file_parser::*;
use m8_file_parser::remapper::Remapper;
let mut from_file = std::fs::File::open("./examples/songs/TEST-FILE.m8s").unwrap();
let from_song = Song::read(&mut from_file).unwrap();
let mut empty_file = std::fs::File::open("./examples/songs/V6_2EMPTY.m8s").unwrap();
let mut to_song = Song::read(&mut empty_file).unwrap();
let chain : u8 = 12;
let mapping =
Remapper::create(&from_song, &to_song, vec![chain].iter()).unwrap();
// you can inspec the mapping here if needed.
// and apply the remapping
mapping.apply(&from_song, &mut to_song);
// you now have the chain 12 in to_song, and you can edit a song
// cell to write it
let final_chain = mapping.out_chain(chain);
to_song.song.steps[2] = final_chain;
Modules§
- dests
- Various constants for modulation destinations, to avoid nasty typos everywhere
- param_
gatherer - params
- Various constants for common parameters, to avoid nasty typos everywhere
- reader
- remapper
- writer
Structs§
- ADSREnv
- AHDEnv
- Chain
- Chain
Step - Command
Pack - This structure will aggregate for every instrument and its modulator the name of the commands associated to it.
- Control
Change - DrumEnv
- Effect
Filter - Effect filter configuration only used in old versions of the firmware before being replaced with EQ
- Effects
Settings - EqBand
- EqMode
Type - Equ
- External
Inst - FMSynth
- FX
- FmAlgo
- FxCommands
- Groove
- Hyper
Synth - Input
Mixer Settings - Instrument
With Eq - Firmware 4.1 introduce files with an instrument definition and an EQ. This structure represent the result of parsing such insturment with an optional EQ.
- LFO
- Limit
Type - Limiter
Parameter - MIDIOut
- Macro
Synth - Midi
Mapping - Midi
Settings - Mixer
Settings - Note
- Note
Offset - Offsets
- Operator
- OttConfiguration
- Phrase
- Phrase
View - RGB
- Sampler
- Scale
- Song
- Song
Steps - Step
- Synth
Params - Table
- Table
Step - Table
View - Theme
- Tracking
Env - TrigEnv
- Version
- WavSynth
Enums§
- Analog
Input Settings - EqMode
- EqType
- FMWave
- FxKind
- Instrument
- LfoShape
- LfoTrigger
Mode - Macro
Synth Osc - Macro synth oscilator modes.
- Mod
- Reference
Templating - Sample
Play Mode - WavShape
- Wavsynth wave shape