Teach your 3D Printer to Sing and Dance

3D printers are amazing pieces of technology that enable individuals to design and build with unprecedented ease. They can also play little bleepy tunes and shimmy around, so... add that to the list.

By modifying the .gcode that your printer normally reads to make a 3D print, you can instead make your 3D printer play music! A lot of it comes down to 3 common parameters :


The M300 command prompts your printer to beep it's buzzer

For example, the command M300 S440 P250 will play a beep at 440Hz frequency for 250 milliseconds. That's the A4 note on a keyboard!

The G1 command controls your printers movement

You may have to put the G91 command first to use relative movement (instead of absolute), and then you can use a code like G1 F98.7 Z6 to move the Z axis 6mm at a feedrate of 98.7 mm/s. If you want to play music with the axes of your printer you need to figure out what feedrate corresponds to a certain note. To accomplish this, I used an Android app called PitchLab Pro for it's live spectrogram feature that visualizes the spectrum of frequencies that the printer is producing.

The G4 command pauses your printer

Music is not only a collection of notes, but also the spaces in between. I used the G4 command to create those gaps. The code G4 P250 pauses the printer for 250 milliseconds.


I put together a list of frequencies for the common range of musical notes for your reference, as well as the feedrates that correspond to certain notes for my Anycubic i3 Mega (different printers may produce different frequencies at different feedrates). You can also download the songs I wrote to play on your own 3D printer. All the files are below :

Web Resources


Printed on the Anycubic i3 Mega



*** gcode with the G1 command moves your printers stepper motors. These songs were written for my printer and may cause an axis to hit the edge of your printers limit. I've included beep only versions that avoid this risk


Tips :

I've noticed many printers don't handle the G4 pause command as well as my i3 Mega. You can either keep testing to get the timing right on your specific machine or remove the G4 command altogether. I made versions of my songs that just hold notes longer instead of pausing to rest. It's not quite as pro, but you've gotta do what it takes to make things work on your printer!