Music. This is how I unplug my brain from daily toils and relax. Not listening to it; instead, making it… with a guitar or with anything available.
A CNC (computer numerical control) machine is a type of machine that uses a computer to control its movement and cutting operations. CNC machines are commonly used in manufacturing and can be programmed to cut, drill, and shape materials with precision and accuracy. However, the use of CNC machines is not limited to traditional manufacturing. They can also be used to create music by utilizing the sound of their electric motors. How to do this? Look at the end of the post.
To make music with the sound of a CNC machine’s electric motors, a user must first program the machine to move in specific patterns. The movement of the machine’s electric motors creates different sounds depending on the speed of movement.ย
To use a CNC machine to make music, a user must first create a design or blueprint in a CAD (computer-aided design) software. This design is then converted into G-code, which is a programming language that the CNC machine can understand. The G-code is loaded into the CNC machine’s control system, which uses it to guide the movement of the machine’s cutting tools.
Even betterโฆ have CNC play real instruments
A CNC machine (more precisely, a robot, but the boundary is fuzzy) can be programmed to play a complex rhythm or melody at a faster tempo or with more precision than a human musician would be able to achieve. Nigel Stanford’s Automatica offers a beautiful example of this.
How to create music with a CNC machine
The easy way to create music with a CNC machine is to obtain a MIDI file of the musical piece you are interested in. MIDI stands for Musical Instrument Digital Interface; there are many MIDI libraries, for example MIDIWorld. The midi file of Bohemian Rhapsody was edited with Signal, a supoercool online & free tool for midi edition; I left only three channels: https://signal.vercel.app/ After you have the MIDI file, you can use one of the many software libraries that convert MIDI to g-code (a computer numerical control programming language), for example the Python library MIDI-to-CNC. Alternatively, you can use Matthias Rock’s MIDI-to-G-Code converter. Use these tools carefully. An ill-configured CNC machine can break itself. The first few lines of the G-Code program for Queen’s Bohemian Rhapsody is shown below.
( Unit: Millimeter )
( Steps per millimeter for X-axis: 400 )
( X-coordinate limits: from 0 to 100 Millimeters)
( Steps per millimeter for Y-axis: 400 )
( Y-coordinate limits: from 0 to 100 Millimeters)
( Steps per millimeter for Z-axis: 400 )
( Z-coordinate limits: from 0 to 100 Millimeters)
( Used channels: Channel 1, Channel 2, Channel 4 )
( Number of axes: 3 )
G21
G90
G94
G00 X0 Y0 Z0
G01 X0.37412550 Y0.33327825 Z0.28023300 F107.30580751
G01 X0.43939350 Y0.39142025 Z0.28030300 F93.65296338
G01 X0.43940350 Y0.39143025 Z0.28031300 F0.12990381
G01 X0.63495550 Y0.70189425 Z0.54138500 F120.62112128
G01 X0.68384350 Y0.77951025 Z0.54145500 F98.28151212
G01 X0.70479550 Y0.77954025 Z0.54148500 F52.38010739
G01 X0.70489675 Y0.77964150 Z0.54158625 F0.12990381
G01 X1.10582875 Y1.13679950 Z0.84189825 F107.30580751
G01 X1.12447675 Y1.13681950 Z0.84191825 F69.93008044
G01 X1.12450675 Y1.13684950 Z0.84194825 F0.12990381
G01 X1.91821225 Y1.84389775 Z1.43646125 F107.30580751
G01 X1.94618425 Y1.86881575 Z1.43649125 F93.65296338
G01 X1.96483225 Y1.86883575 Z1.43651125 F69.93008044
G01 X1.96489225 Y1.86889575 Z1.43657125 F0.12990381
G01 X2.53146925 Y2.76840975 Z2.19298075 F120.62112128
G01 X2.55242125 Y2.80167375 Z2.19301075 F98.28151212
G01 X2.56638925 Y2.80169375 Z2.19303075 F52.38010739
G01 X2.56697050 Y2.80227500 Z2.19361200 F0.12990381
G01 X2.79796225 Y3.21391700 Z2.53976550 F118.25148086
G01 X2.80418425 Y3.22500500 Z2.53977550 F95.35834232
G01 X2.81662825 Y3.22502500 Z2.53979550 F46.66512054
G01 X2.81670825 Y3.22510500 Z2.53987550 F0.12990381
G01 X3.29349225 Y3.49265100 Z2.94080750 F118.25148086
G01 X3.33784425 Y3.51753900 Z2.94084750 F95.35834232
G01 X3.33785425 Y3.51754900 Z2.94085750 F0.12990381
G01 X3.61808725 Y3.85082725 Z3.31498300 F107.30580751
G01 X3.64602325 Y3.88405125 Z3.31502300 F81.39003041
G01 X3.66697525 Y3.88408125 Z3.31505300 F52.38010739
G01 X3.66698525 Y3.88409125 Z3.31506300 F0.12990381
G01 X4.18950725 Y4.32348475 Z3.68452300 F123.54444747
G01 X4.18951725 Y4.32349475 Z3.68453300 F0.12990381
G01 X4.38055525 Y4.48412675 Z3.68476300 F81.39003041
( ...and 2,400 additional lines of similar code )
One response to “Making Music with a CNC Machine”
[…] Making Music with CNCOctober 10, 2023 […]