Add MOD

ABelliqueux 2021-10-28 20:12:56 +02:00
parent 0c78e181bc
commit 45c7ea4871
3 changed files with 65 additions and 0 deletions

2
BS.md

@ -6,6 +6,8 @@ https://github.com/ABelliqueux/nolibgs_hello_worlds/tree/main/hello_bs
## Converting a still image to BS
Note that your image's width and height must be multiples of 16, as the size of a MDEC decoded macroblock is 16x16.
`MC32` can convert these formats to BS : TIM, RGB, YUV.
### Image > TIM with img2tim

59
MOD.md Normal file

@ -0,0 +1,59 @@
# MOD playback
## Code example
https://github.com/ABelliqueux/nolibgs_hello_worlds/tree/main/hello_mod
## Preparing sound samples
Samples should be 11025Hz mono wavs :
```bash
ffmpeg -i input.wav -ar 11025 -ac 1 output.wav
```
## Adding sound effects (samples) to a mod file
Use [OpenMpt](https://openmpt.org/) to edit an existing mod file or create a new one
![OpenMPT Add sample](https://wiki.arthus.net/assets/openmpt_add_samples.gif)
Then save your mod file.
## MOD > HIT conversion
Use `MODCONV.EXE`, available in hitmen's [hit-hitmod15.zip](http://hitmen.c02.at/files/releases/psx/hit-hitmod15.zip), with dosbox.
```cmd
MODCONV.EXE FILE.MOD
```
![Dosbox MODCONV](https://wiki.arthus.net/assets/modconv-dosbox.png)
### One-liner
You can run a DOS command through dosbox from the CLI with :
```bash
dosbox -c "C:\PATH\TO\MODCONV.EXE INPUT.MOD" -c "EXIT"
```
The generated HIT file will be in the same directory as the MOD file.
## Playing a sample
Using NicolasNoble's [modplayer](https://github.com/grumpycoders/pcsx-redux/tree/main/src/mips/modplayer), you can use the [`MOD_PlayNote()`](https://github.com/grumpycoders/pcsx-redux/blob/main/src/mips/modplayer/modplayer.h#L147) function.
```c
MOD_PlayNote( voiceID, sampleID, note, volume);
```
* *voiceID* is the PSX spu voice to use for playback; Range 0-23
* *sampleID* is the MOD's sample ID. That's the sample number in openMPT minus 1 as counting starts from 0.
* *note* or pitch. That's the note you want to play your sample on. Range 0-35
* *volume* is the playback volume of your sample. Range min-max 0-63
### PSX spu voices
MODs use 4 channels, which are mapped to the four first voices of the SPU by default. When calling `MOD_PlayNote()`, you should use voices > 4.
See [here](https://github.com/ABelliqueux/nolibgs_hello_worlds/hello_mod) for a complete example.

4
STR.md

@ -19,6 +19,10 @@ Mirror : http://psx.arthus.net/code/strplay.7z
## Converting to AVI
### Video dimensions
Note that your video's width and height must be multiples of 16, as the size of a MDEC decoded macroblock is 16x16.
You need `AVI file 320x240, 15 fps, 24-bit color, Stereo 16-bit sound @ 44100 Hz`.
```