midi2gcode

MIDI to G-code Converter: Bridging Music and 3D Printing

Welcome to the midi2gcode converter project. This tool is designed to convert MIDI files into G-code patterns for 3D printers, offering a unique way to generate 3D printable designs from musical data. The application processes MIDI files and translates musical elements such as note pitch, velocity, and timing into dynamic patterns for 3D printing. Here, we’ll explore the features and technical details that make this project both innovative and practical for users interested in merging music with 3D printing technology.

Key Features

Graphical User Interface

The user interface of the midi2gcode converter is built using Dear ImGui, providing a clean, modern, and responsive design. The GUI is streamlined to ensure that users can easily interact with the software, access key features, and navigate through the application with ease. The interface is designed to be intuitive for both beginners and experienced users.

Real-Time MIDI Playback

One of the core features of this application is the ability to preview MIDI files in real time. Users can listen to their MIDI file while simultaneously visualizing how the musical data is being translated into a 3D print pattern. This allows for immediate feedback and adjustments before the final G-code is generated.

G-code Visualization

The application offers an essential G-code visualization feature. Before sending the generated G-code to the 3D printer, users can view a representation of the final pattern. This ensures that the pattern behaves as expected and allows for any necessary adjustments to be made prior to printing, saving both time and material.

Advanced Pattern Generation

The converter creates intricate spiral patterns based on several musical parameters:

  • Note timing influences the angle of the spiral, controlling how the pattern rotates.
  • Note velocity (loudness) determines the radius, where louder notes generate larger circles.
  • Note pitch controls the Z-height, adding vertical depth to the design.
  • Note frequency affects the movement speed, with faster frequencies leading to quicker movements.

These elements combine to form complex patterns that are uniquely driven by the properties of the MIDI file, offering creative and flexible design options for 3D printing.

Printer Settings Management

To facilitate a smooth user experience, the application allows users to save and load printer profiles. This enables quick configuration adjustments tailored to different 3D printers, ensuring that the generated G-code aligns with specific printer settings, such as print area size, material, and resolution.

Dark/Light Theme Support

Understanding the importance of user experience, the application supports both dark and light themes. Users can toggle between the two to suit their environment and preferences, ensuring comfort during extended use.

Prerequisites

To get started with the midi2gcode converter, there are a few prerequisites to ensure a smooth setup:

  • CMake (version 3.10 or higher) is required for managing the build process.
  • A C++17-compatible compiler is necessary for compiling the source code.
  • Visual Studio 2019 or later is recommended for Windows users.
  • An OpenGL 3.3-capable graphics card and drivers are required for rendering the 3D visualizations.

Dependencies

The project relies on several libraries to enable core functionality, all of which are automatically managed by CMake:

  • Dear ImGui: A lightweight, powerful UI framework used for creating the application’s interface.
  • GLFW: Provides window management and OpenGL context handling.
  • GLAD: Responsible for loading OpenGL functions to ensure compatibility with different graphics hardware.
  • PortMidi: Handles MIDI file parsing and playback, enabling the processing of MIDI data.
  • GLM: A mathematics library that facilitates 3D transformations and calculations for pattern generation.
  • nlohmann/json: Used for managing settings and configurations in JSON format, allowing for easy customization.

Getting Started

To begin using the midi2gcode converter, follow these steps:

  1. Ensure you have CMake (version 3.10 or higher) installed, and a C++17-compatible compiler configured.
  2. Clone the project repository from GitHub.
  3. Open the project in Visual Studio 2019 or later (or your preferred IDE) and build the solution.
  4. Explore the application’s interface, load a MIDI file, and experiment with the real-time playback and G-code generation features.
  5. And remember – this is an ongoing project! It might not work if you build it incorrectly and testing it on various 3d printers is impossible for me. So, community support is much needed!

The midi2gcode converter provides a unique and powerful tool for creating 3D printable patterns driven by musical data. By converting MIDI files into intricate G-code patterns, this application opens up new possibilities for combining music and 3D printing. Whether you’re a designer, 3D printing enthusiast, or developer, this project offers a sophisticated way to explore the intersection of technology and art. Check out the project on GitHub to get started and see how music can shape your 3D prints.

You can check out the GitHub page here.