Search This Blog

Showing posts with label midi. Show all posts
Showing posts with label midi. Show all posts

Wednesday, September 1, 2021

Play the MacGyver theme when your 3d print ends


If you have owned a 3d printer for a while then you've probably already added code to beep the 3d printers speaker to notify you that your print has completed.  Otherwise, your stuck occasionally checking the print progress, which can become tiresome.

Why not play a favorite tune when your 3d print has completed?  Maybe a fanfare? Celebration?  "Flight of the Valkyries?"

With the tool at the following link, you can convert a midi file directly to GCODE that will output tones on your 3d printers speaker:  Midi to M300

The M300 GCODE command is used by 3d printers running Marlin firmware to generate sounds, tones.  Many 3d printers use the Marlin codebase so if your 3d printer has a speaker then you should be able to generate music.

The music will not sound like music from your smartphone might sound.  It actually sounds more like a Commodore VIC-20 could be playing the music but it is recognizable and guaranteed to arose curiosity from those not expecting it.

You can of course generate your own midi files like Lazy Game Reviewer (LGR) might, but there are also numerous midi songs available on the Internet.

Since I'm no musician but still am a fan of the original MacGyver show, I found the theme song in midi form and ran it through Midi to M300 and tried it on my printer.

It sounded terrible!

So I went back to Midi to M300 and unchecked boxes for some instruments and channels and tried again.  I had to repeat this several times before I got something that sounded good to my ears.  However, it was too lengthy.  I didn't need to hear the entire MacGyver theme at the end of a print, just enough to be recognizable and get my attention.

So I started trimming M300 lines from the generated code.  The final result has been shorted to around 30 seconds of time and contains the most recognizable parts of the tune.

If you'd like to just try this out on your 3d printer then install a copy of Pronterface and connect to your 3d printers USB port.  Some Creality printers now use the CH340 serial USB driver so you may need to install it to get Pronterface working with your printer - it does not autoinstall on Win10.

Copy the GCODE for the MacGyver theme below and save it using Notepad as a text file.  Change the extension of the file to MacGyver.GCODE.  After Pronterface is connected to your printer, Load the MacGyver.GCODE file in Pronterface.

Now press the Print button in Pronterface and your 3d printer should play the MacGyver theme.  If it is unsuccessful, and your certain that Printer face is connected, double check the MacGyver.GCODE file that you saved and make sure that it only contains the M300 GCODE lines shown below and nothing else.

To play the MacGyver theme at the end of a print, open up your printer configuration in Cura slicer and go to the "End G-code" under the Machine Settings for your printer and paste the following GCODE:

M300 P104 S523
M300 P104 S0
M300 P104 S523
M300 P104 S0
M300 P104 S523
M300 P104 S0
M300 P104 S523
M300 P104 S0
M300 P104 S523
M300 P104 S0
M300 P104 S523
M300 P104 S0
M300 P104 S523
M300 P104 S0
M300 P104 S523
M300 P104 S0
M300 P208 S494
M300 P208 S392
M300 P208 S196
M300 P208 S392
M300 P208 S370
M300 P208 S440
M300 P208 S196
M300 P208 S392
M300 P208 S392
M300 P208 S392
M300 P208 S196
M300 P208 S392
M300 P208 S523
M300 P208 S523
M300 P208 S196
M300 P208 S494
M300 P208 S196
M300 P208 S523
M300 P208 S494
M300 P208 S440
M300 P208 S392
M300 P208 S330
M300 P208 S659
M300 P208 S330
M300 P208 S440
M300 P208 S262
M300 P208 S131
M300 P208 S262
M300 P208 S523
M300 P208 S523
M300 P208 S147
M300 P208 S494
M300 P208 S196
M300 P208 S392
M300 P208 S196
M300 P208 S392
M300 P208 S370
M300 P208 S440
M300 P208 S196
M300 P208 S392
M300 P208 S196
M300 P208 S392
M300 P208 S196
M300 P208 S392
M300 P208 S523
M300 P208 S523
M300 P208 S196
M300 P208 S494
M300 P208 S196
M300 P208 S523
M300 P208 S494
M300 P208 S440
M300 P208 S392
M300 P208 S330
M300 P208 S659
M300 P208 S330
M300 P208 S440
M300 P208 S262
M300 P208 S131
M300 P208 S262
M300 P208 S494
M300 P208 S247
M300 P208 S123
M300 P208 S247
M300 P208 S523
M300 P208 S494
M300 P208 S440
M300 P208 S523
M300 P208 S185
M300 P208 S494
M300 P208 S440
M300 P208 S587
M300 P208 S123
M300 P208 S523
M300 P208 S494
M300 P208 S587
M300 P208 S123
M300 P208 S523
M300 P208 S494
M300 P208 S659
M300 P208 S131
M300 P208 S587
M300 P208 S659
M300 P208 S740
M300 P208 S185
M300 P208 S494
M300 P208 S123
M300 P208 S784
M300 P208 S165
M300 P208 S330
M300 P208 S740
M300 P208 S311
M300 P208 S698
M300 P208 S294
M300 P208 S494
M300 P208 S392
M300 P208 S784
M300 P208 S659
M300 P208 S494
M300 P208 S740
M300 P208 S587
M300 P208 S440
M300 P208 S659
M300 P208 S523
M300 P208 S392
M300 P208 S587
M300 P208 S494
M300 P208 S392
M300 P208 S523
M300 P208 S330
M300 P208 S494
M300 P208 S294
M300 P208 S523
M300 P208 S494
M300 P208 S440
M300 P208 S392
M300 P417 S466
M300 P417 S440
M300 P208 S784
M300 P208 S392
M300 P208 S587
M300 P208 S392
M300 P208 S622
M300 P208 S311
M300 P208 S466
M300 P208 S440
M300 P208 S392
M300 P208 S196
M300 P208 S294
M300 P208 S196
M300 P208 S311
M300 P208 S196
M300 P208 S233
M300 P208 S220
M300 P208 S587
M300 P208 S587
M300 P208 S587
M300 P208 S587
M300 P208 S587
M300 P208 S587
M300 P208 S587

Wednesday, August 25, 2021

Make your 3d printer play music - "How It's Made"


 I found a midi file of the intro music from the TV show, "How It's Made" and found an online midi to GCODE converter.  Perfect!  

If you want your 3d printer to start playing the "How It's Made" tune through the printers speaker when starting a print then add this GCODE to the end of your printers start code:

;How its Made tune  

M300 P103 S123
M300 P635 S0
M300 P117 S123
M300 P337 S0
M300 P137 S123
M300 P190 S0
M300 P107 S123
M300 P249 S0
M300 P166 S110
M300 P1724 S0
M300 P93 S156
M300 P620 S0
M300 P93 S156
M300 P347 S0
M300 P156 S156
M300 P200 S0
M300 P117 S156
M300 P234 S0
M300 P107 S165
M300 P1299 S0
M300 P464 S185
M300 P5 S311
M300 P103 S123
M300 P371 S0
M300 P210 S311
M300 P34 S0
M300 P20 S370
M300 P117 S123
M300 P293 S0
M300 P44 S277
M300 P137 S123
M300 P190 S0
M300 P127 S123
M300 P200 S311
M300 P29 S0
M300 P166 S110
M300 P68 S0
M300 P132 S311
M300 P337 S0
M300 P117 S311
M300 P117 S0
M300 P117 S370
M300 P352 S0
M300 P176 S277
M300 P288 S0
M300 P20 S311
M300 P93 S156
M300 P366 S0
M300 P210 S311
M300 P34 S0
M300 P10 S370
M300 P93 S156
M300 P327 S0
M300 P20 S277
M300 P156 S156
M300 P200 S0
M300 P122 S156
M300 P200 S311
M300 P29 S0
M300 P107 S165
M300 P127 S0
M300 P132 S311
M300 P337 S0
M300 P117 S311
M300 P117 S0
M300 P117 S370
M300 P352 S0
M300 P176 S440
M300 P59 S0
M300 P176 S494
M300 P54 S0
M300 P5 S622
M300 P103 S123
M300 P371 S0
M300 P210 S622
M300 P34 S0
M300 P20 S740
M300 P117 S123
M300 P293 S0
M300 P44 S554
M300 P137 S123
M300 P190 S0
M300 P127 S123
M300 P200 S622
M300 P29 S0
M300 P166 S110
M300 P68 S0
M300 P132 S622
M300 P337 S0
M300 P117 S622
M300 P117 S0
M300 P117 S740
M300 P352 S0
M300 P176 S554
M300 P288 S0
M300 P20 S622
M300 P93 S156
M300 P366 S0
M300 P210 S622
M300 P34 S0
M300 P10 S740
M300 P93 S156
M300 P327 S0
M300 P20 S554
M300 P156 S156
M300 P200 S0
M300 P122 S156
M300 P200 S622
M300 P29 S0
M300 P107 S165
M300 P127 S0
M300 P132 S622
M300 P337 S0
M300 P117 S622
M300 P117 S0
M300 P117 S740
M300 P352 S0
M300 P176 S880
M300 P59 S0
M300 P176 S988