Close
0%
0%

MIDI Interface for RC2014

Building MIDI Interface for RC2014. The goal of this project is to build a music system with RC2014 computer and external (legacy) MIDI box

Public Chat
Similar projects worth following
Building MIDI Interface for RC2014. The goal of this project is to build a music system with RC2014 computer and external (legacy) MIDI box like Roland SC88 pro.

This project is an entry of Retro Challenge 2024/10 at https://www.retrochallenge.org/

The hardware is already working at this point. The challenge of this project is to write a 8bit software (MIDI Player in this case) with the help of latest AI technologies. I'm going to try ChatGPT to write Z80 assembler code.

Proceeding with the project in the following steps:

  1. Hardware Design
    • Design an ACIA-based MIDI interface for RC2014 Computer system .
    • Provide a clock signal (2MHz).
    • Design a MIDI current loop interface. 
    → Prototyping of step 1 was completed.
  2. Hardware Operation Check
    • Confirm operation on the Small Computer Monitor.
    • Confirm operation on RomWBW.
  3. Software Development 

  3.1 MIDI-OUT: Output Note On/Off. Create a simple melody. 

  3.2 MIDI-IN: Read MIDI message from music keyboard and display the Note No on the screen. 

  3.3 MIDI File Player: Create a MIDI player that read MIDI file and send MIDI to the interface.  The software should works on CP/M.

midi_parser.py

x-python-script - 5.25 kB - 10/10/2024 at 00:24

Download

greensleeves-rc2014.mp3

MPEG Video - 701.55 kB - 10/08/2024 at 11:13

Download

greens.asm

asm - 15.19 kB - 10/08/2024 at 11:12

Download

conv_db.py

x-python-script - 3.69 kB - 10/08/2024 at 11:10

Download

midi_melody.asm

Melody generated by ChatGPT.

asm - 2.81 kB - 10/06/2024 at 11:00

Download

View all 7 files

  • Retrospective of RetroChallenge 2024

    morecat_lab2 days ago 0 comments

    Retrospective of RetroChallenge 2024

    The period for RetroChallenge 2024 concluded on October 31. This project, which explores the combination of retro computing and modern AI, considers this pairing to be both unique and challenging. Although this project didn’t reach its initial goal, I’d like to summarize my progress here.

    The project achieved the following milestones:

    Completed Items:

    • Verification of MIDI hardware functionality
    • Creation of a MIDI file parser in Python
    • Development of a MIDI player program (Z80 assembly) on actual CP/M and SCM machines to play MIDI files (requires pre-conversion of songs using the Python program)
    • Development of a MIDI parser (Z80 assembly) for CP/M

    Incomplete Items:

    • Creation of a MIDI player (Z80 assembly) on CP/M, program to directly read MIDI files was not completed.

    Insights and Know-how Gained:

    • Techniques for creating Z80 programs using ChatGPT
    • Review methodologies for Z80 programs with ChatGPT
    • Effective debugging methods using the ASM80.com online assembler and simulator
    • A library of CP/M and Z80 subroutines developed with ChatGPT

    Through this challenge, I found that creating ready-to-use programs with ChatGPT is challenging. It was most efficient to create small subroutines and combine them into a program, which I believe is the most valuable takeaway from this challenge.

    In summary, I believe the project reached about 80% completion. I am particularly eager to continue developing the MIDI player that runs on an actual CP/M machine.

    (Still) To be continued…

  • Development with Online Assembler, IDE, and Simulator

    morecat_lab10/24/2024 at 06:46 0 comments

    Development with Online Assembler, IDE, and Simulator

    I continue to develop programs for the Z80 using ChatGPT. It has become clear that the programs created by ChatGPT contain many errors, and human intervention is necessary to correct them. To confirm these errors, it is most reliable to execute the created program and check the results. Combining small programs makes it easier to detect errors. However, when it comes to the stage of combining programs and verifying their operation, downloading to the actual RC2014 machine takes time.

    I discovered that efficiency can be increased by combining online assemblers and simulators. I tried Martin Maly's [ASM80.com](https://www.asm80.com/) (online assembler, IDE, simulator).

    Read more »

  • Creating Small Programs with ChatGPT

    morecat_lab10/20/2024 at 06:48 0 comments

    Creating Small Programs with ChatGPT

    Due to security-related updates, the hackaday.io web editor was out of service for a while, which delayed my blog updates. However, the project has been steadily progressing.

    Anyway, I’ve been using ChatGPT to create Z80 assembler programs. Initially, I thought it would be easy to generate Z80 assembly code. For small programs like a MIDI player, I could create something functional with just minor tweaks. However, when I tested it with slightly more complex programs, I realized things weren’t so straightforward.

    Read more »

  • creating a github repo

    morecat_lab10/14/2024 at 06:42 0 comments

    Project Update: MIDI Interface for RC2014

    I have created a GitHub repository to store the latest version of the programs developed for this project, along with their descriptions. You can check it out for the most up-to-date files and documentation.

    https://github.com/kuwatay/MIDI-FOR-RC2014

    singlePlayer is a dedicated program for playing a single song. It pre-processes a MIDI file by parsing it with a MIDI parser, converting it into a data table, and then creating an executable program. It comes with a Makefile that can generate both CP/M COM files and binaries for SCM.

    Stay tuned for more updates as the project progresses!

  • Towards the Next Milestone

    morecat_lab10/10/2024 at 00:16 0 comments

    1. Towards the Next Milestone

    The next goal is to create a program to play MIDI files using Z80 assembler. By specifying it on the command line, it is planned to make it possible to play MIDI files directly with the RC2014 computer alone.

    Since a file system is required, the platform will be migrated from SCM to CP/M. Also, accurate timing generation for music playback requires timer interrupts. It would be good to have a Z80CTC card or a Z180 with a built-in CTC. Alternatively, J.B. Langston's designed TMS9918A Video Card for RC2014 can generate interrupts with vertical sync signals (1/50sec), which might be better.

    To handle MIDI files, it is necessary to write a MIDI parser in Z80 assembler, which seems to be more complex than previous programs. Therefore, first, we will consider the MIDI file parser and the program for real-time management of playback time.

    Read more »

  • Playing "Greensleeves"

    morecat_lab10/08/2024 at 11:09 0 comments

    Playing "Greensleeves"

    In my previous programming endeavors, I was able to send note messages, but I couldn't play an actual song. 

    As the next step, I decided to parse a MIDI file, extract its data, create an assembly table, and give it a try.

    As usual, I asked ChatGPT to help me create a Python program (!) that parses the MIDI file and converts it into an assembler DB format. 

    The following program was created.

    conv_db.py

    Read more »

  • Creating GPTs of Z80 Specialist

    morecat_lab10/07/2024 at 07:40 0 comments

    Creating GPTs of Z80 Specialist

    1. Motivation

    Large Language Models (LLMs), such as ChatGPT, generate programs based on information available on the internet, utilizing language models. For example, if you request it to create a "Hello World" program for CP/M, it will generate a reasonably functional program.

            ORG     100h                ; CP/M programs start at 100h
            LD      DE, message         ; Load the address of the message into DE
            LD      C, 9                ; BDOS function 9 (print string)
            CALL    5                   ; Call BDOS
    
            RET                         ; Return to CP/M
    
    message:
            DB      'Hello, World!$'    ; Message to print, ending with a '$'
    

     
    However, since LLMs do not possess specialized knowledge, if you ask them to create a "Hello World" using the SCM API, the generated program may look somewhat suspicious.

    Read more »

  • AI That Plays Melodies

    morecat_lab10/06/2024 at 08:59 0 comments

    AI That Plays Melodies

    Now that I was able to generate note messages, I asked ChatGPT to create a program that plays a melody.

    I followed these steps to make the request:

    1. As in the previous attempt, I asked ChatGPT to generate a program in Z80 assembler to produce note signals. This time, I specified both the address of the ACIA status register and the data register.
    2. Since the A register was being overwritten in the MIDI transmission subroutine, I asked ChatGPT to fix this issue.
    3. I requested a modification to store the pitch information in a table format.
    4. I then asked ChatGPT to generate the pitch sequence for "Greensleeves" in the table. (It seems that ChatGPT couldn’t generate it correctly.)
    5. Since the instruction IN A, (B) was being generated, I requested a correction.

    With these steps, the assembler program was created, which I downloaded to my computer and generated a HEX file. Although it wasn’t "Greensleeves," I was able to play some melody.

    https://chatgpt.com/share/67026d7d-ab60-8003-9f54-4ff0b840cc6b

    Read more »

  • First Attempt: Generating MIDI Note-On and Note-Off with ChatGPT (Continued)

    morecat_lab10/06/2024 at 06:53 0 comments

    First Attempt: Generating MIDI Note-On and Note-Off with ChatGPT (Continued)

    1. Code Review

    I conducted a detailed review of the program generated by ChatGPT. The following issues were identified:

    1. Incorrect ACIA initialization Since ACIA is already initialized by SCM, I decided to omit the initialization step and commented out the corresponding section.
    2. Destruction of the A register in the SEND_BYTE routine The A register, which stores the data to be transmitted, was being overwritten. To fix this, I modified the routine to push the A register onto the stack at the entry point and pop it before outputting the data.
    3. Incorrect address for the ACIA data register The address should be $A1 instead of $A0.
    4. Infinite loop After outputting the Note-On and Note-Off messages, the program returned to the start. For testing purposes, I modified the program to output only once and then return to the monitor.
    Read more »

  • First Attempt: Generating MIDI Note-On and Note-Off with ChatGPT

    morecat_lab10/05/2024 at 05:51 0 comments

    First Attempt: Generating MIDI Note-On and Note-Off with ChatGPT

    As the first step in this challenge, I tried creating a Z80 assembler program using ChatGPT.

    While it is well-known that ChatGPT excels at generating programs in languages like Python, I am unsure if it can create a Z80 assembler program. For this attempt, I used "ChatGPT 4.0" (paid version). This version is relatively unrestricted and allows for the creation of customized GPTs, which I plan to try later.

    Anyway, I entered the following prompt:

    "Show me a program to send MIDI note messages in Z80 assembler.
    
    MIDI messages are sent via ACIA at $A0. The program should start
    
    at $8000. Please include an ACIA initialize routine."
    Read more »

View all 11 project logs

Enjoy this project?

Share

Discussions

Similar Projects

Does this project spark your interest?

Become a member to follow this project and never miss any updates