LaTumbaMuerto.com

PlayStation Release Guide

Converting MIDI files into a playable music application on the PlayStation 1 (PS1), also known as PSX, involves several steps. This process includes preparing your MIDI files, converting them into a format compatible with the PS1’s audio system, developing a homebrew application to play the music, and running it on the PS1 console. Below is a detailed, step-by-step guide to help you through the process.



Prerequisites

Before you begin, ensure you have the following:


Step 1: Prepare Your MIDI File

1. Simplify the MIDI File

Recommended MIDI Editors:


Step 2: Convert MIDI Files to Audio Format

1. Understand PS1 Audio Formats

2. Convert MIDI to WAV Format

Recommended Tools:

Steps to Convert:

3. Prepare the Audio File


Step 3: Convert WAV to VAG Format

1. Use PSYQ Tools or Alternative Converters

2. Steps to Convert WAV to VAG

3. Note on Looping


Step 4: Install PS1 Development Tools

1. Install PSn00bSDK or PSXSDK

2. Install the MIPS Compiler Toolchain

3. Set Environment Variables


Step 5: Set Up Your PS1 Project

1. Create a New Project Directory

2. Set Up the Directory Structure


Step 6: Write the Main Program

1. Create main.c in the src Directory

#include <psx.h>
#include <stdio.h>
#include <stdlib.h>

int main() {
    PSX_InitEx(0);

    // Initialize the SPU
    SpuInit();
    SpuInitMalloc(SPU_MALLOC_RECSIZ, 1);
    SpuSetTransferMode(SpuTransByDMA);

    // Load VAG data
    FILE *file = fopen("cdrom:\\YOUR_SONG.VAG;1", "rb");
    if (!file) {
        printf("Failed to open VAG file.\n");
        while (1);
    }

    // Get file size
    fseek(file, 0, SEEK_END);
    int vag_size = ftell(file);
    fseek(file, 0, SEEK_SET);

    // Allocate memory for VAG data
    unsigned char *vag_data = (unsigned char *)malloc(vag_size);
    fread(vag_data, 1, vag_size, file);
    fclose(file);

    // Upload VAG data to SPU
    unsigned long spu_address = SpuMalloc(vag_size);
    SpuSetTransferStartAddr(spu_address);
    SpuWrite(vag_data + 0x30, vag_size - 0x30); // Skip VAG header (48 bytes)

    // Set voice parameters
    SpuVoiceAttr voice_attr;
    memset(&voice_attr, 0, sizeof(SpuVoiceAttr));
    voice_attr.mask = SPU_VOICE_VOLL | SPU_VOICE_VOLR | SPU_VOICE_PITCH |
                      SPU_VOICE_WDSA | SPU_VOICE_ADSR_AMODE | SPU_VOICE_ADSR_SMODE |
                      SPU_VOICE_ADSR_RMODE | SPU_VOICE_ADSR_AR | SPU_VOICE_ADSR_DR |
                      SPU_VOICE_ADSR_SR | SPU_VOICE_ADSR_RR | SPU_VOICE_ADSR_SL;
    voice_attr.voice = SPU_VOICECH(0);
    voice_attr.volume.left = 0x3fff;
    voice_attr.volume.right = 0x3fff;
    voice_attr.pitch = SPU_MyPitch2SpuPitch(44100); // Adjust if necessary
    voice_attr.addr = spu_address;
    voice_attr.a_mode = SPU_VOICE_LINEARIncN;
    voice_attr.s_mode = SPU_VOICE_LINEARIncN;
    voice_attr.r_mode = SPU_VOICE_LINEARDecN;
    voice_attr.ar = 0x0;
    voice_attr.dr = 0x0;
    voice_attr.sr = 0x0;
    voice_attr.rr = 0x0;
    voice_attr.sl = 0xf;

    SpuSetVoiceAttr(&voice_attr);

    // Start playing
    SpuSetKey(SPU_ON, SPU_VOICECH(0));

    // Main loop
    while (1) {
        // Keep the program running
    }

    // Clean up (unreachable in this example)
    SpuFree(spu_address);
    free(vag_data);
    PSX_End();

    return 0;
}

2. Update the Makefile

3. Include Necessary Headers and Libraries


Step 7: Build the PS1 Executable

1. Open a Command Prompt

2. Run the Build Command

make

3. Convert the Executable to PS1 Binary


Step 8: Create a CD Image

1. Prepare the CD File System

2. Create SYSTEM.CNF File

3. Copy Necessary Files

4. Generate the CD Image


Step 9: Test the ISO in an Emulator

1. Choose an Emulator

2. Load and Test the ISO


Step 10: Burn the ISO to a CD-R

1. Prepare to Burn the Disc

2. Modchip or Swap Trick

3. Burn the ISO


Step 11: Run the Disc on the PS1 Console

1. Insert the Burned Disc

2. Power On the Console

3. Verify Functionality


Additional Tips


Summary

By following these steps, you can successfully convert MIDI files into a playable music application on the PlayStation 1:

  1. Prepare and convert your MIDI file into a WAV audio format.

  2. Convert the WAV file to VAG format, compatible with the PS1’s SPU.

  3. Install PS1 development tools, including PSn00bSDK or PSXSDK and necessary compilers.

  4. Set up your project structure with appropriate directories and files.

  5. Write a homebrew application that plays your audio file on the PS1.

  6. Configure the build process to include your audio file and compile the project.

  7. Build your application to create a PS1 executable.

  8. Create a CD image containing your application and audio file.

  9. Test your application in an emulator to verify functionality.

  10. Burn the ISO to a CD-R using appropriate software.

  11. Run the disc on your PS1 console, ensuring it can read burned discs.

  12. Verify that the music plays as intended on actual hardware.

This process allows you to experience custom music on your PlayStation 1 console and provides valuable experience in retro console development.


Disclaimer: Modifying your PlayStation 1 console and creating custom discs involves risks and may be subject to legal restrictions in some jurisdictions. Copying or modifying game consoles may violate the console’s terms of service and local laws. Always ensure you are complying with local laws and do not engage in piracy or distribute copyrighted material.


Appendix: Additional Resources