3D Printing Generator
DeutschEnglish

How to 3D print a song code keychain

What is a song code?

A song code is the small bar pattern a music service generates for every track, playlist and album: 23 vertical bars, each with a height from 0 to 7. Point your phone’s camera at it and the app recognizes the pattern and plays the song. On Spotify these patterns are called “Spotify Codes”, which is why most how-tos use that name. The original has a logo on the left, but it is not required for printing – the app often recognizes the code without it.

These patterns are a popular gift: your wedding song as a wall plaque, the playlist of your first kiss as a keychain, or the kids’ favorite song on a backpack. This generator builds such a tag from the 23 digits of the code – or straight from the SVG file the music service exports. The result is scannable and yet a clean, printable model, because the bars are rebuilt as their own shapes instead of being imported as an image.

Getting your code

Before you print, you need the 23 bars of your song. There are two ways:

  1. Download the SVG. Open the music service’s code page, pick your song and download the image as SVG. Drop the file into the “Code file (SVG)” field here. The bar heights are detected automatically – background and any included logo are filtered out.
  2. Type the digits. The share link of the code, or an export view, often shows the number sequence. Type it into the “Code digits” field. There are exactly 23 digits from 0 to 7; missing ones are padded, extras are cut off.

Make sure the reference bars are correct: the first and last bar must be height 0, the middle one (position 12) height 7. If not, the generator warns you – it is probably a typo, and the app will not read the code.

Shape, style and title

The generator knows three parts: the plate with the code, the frame (a tray a cut-through plate drops into) and an optional title. Under “Parts” you choose what to build – only the plate, only the frame, or both. Both are placed side by side on the bed, so you get plate and frame in a single print.

The most important switch is the bar style:

  • Cut through is the principle of the original: the bars are cut entirely out of the plate. Hold the tag against the light, or drop it into the colored frame, and the bars show clearly.
  • Raised lifts the bars 0.8 mm above the plate. Printed in a second color this is the simplest clean two-color version.
  • Engraved cuts the bars into the plate. For wood-fill PLA or matte filament it looks very classy and works single-color.
  • Inlaid makes the bars end flush with the surface. It is the most robust, since nothing protrudes, and stays two-color with a filament change.

About the title: under “Title & text” you enter a line such as “Our Song” or a date, and choose whether it sits below, above or right of the code. The size is the cap height of the letters; the plate does not grow automatically, so make sure text and code fit together. Left of the code sits a neutral end mark – a plain disc or a ring – where the scanner app expects the start.

Printing tips

For the code to actually scan, a few simple rules help:

  • Not too small. From about 50 mm code width the bars are at least 0.8 mm wide – the lower limit for a 0.4 mm nozzle. The generator warns when the bars or the bridges between them get too thin.
  • A good first layer. The plate lies flat and the bars form in the top layers. A clean plate and a well-leveled bed matter more here than for most other prints.
  • Choose contrast. Dark plate with light bars, or the other way round. In the cut-through version, the contrast comes from the frame or the surface underneath.
  • Matte over glossy. Glossy PLA and silk filaments glare, which confuses the camera. Matte filament gives the most reliable results.
  • Filament change. For raised bars, set the change at the plate thickness; for inlaid bars it sits lower by the bar depth. The generator shows the exact height under “Colors”.

Most tags print in under half an hour. Use PETG for gifts that see water, such as on a bottle or in the bathroom.

It does not scan?

If the app cannot read the code, work through this list:

  1. Check the reference bars. First = 0, last = 0, middle = 7. One wrong bar makes the whole code unreadable.
  2. Increase contrast. Gray on gray is hard for the camera. Try a dark plate with white bars – or put the cut-through plate on a white background.
  3. Check the size. To test, hold the plate about 20–30 cm away, straight in front of the camera. Too near, too far or strongly tilted often fails.
  4. Avoid mirroring. A cut-through plate reads mirrored from behind and normal from the front, so do not print it mirrored.
  5. Vary the end mark. Some app versions want the logo on the left. We do not draw brand logos, so try both the disc and the ring instead. In many cases the neutral disc is enough – just test it yourself.

Sizes for typical tags

How large the plate should be depends on where it will live later. As a rough guide:

PlateCode widthUse
70 × 20 × 2 mm~55–64 mmthe classic keychain
56 × 16 mm~50 mmreally small for the key ring
80 × 32 mm~60 mmgift tag with a title
90 × 30 mm~60 mmfridge magnet with a playlist
140 × 45 mm~80 mmstand for a desk or shelf
180 × 55 × 3 mm~120 mmwall sign for a door

The code width adjusts itself automatically to what fits the plate, taking the margin and the title into account. If you enter a code width yourself, the generator warns when the code sticks out. In the examples you can see for each size how many bars still look clean, from the slim 56 mm keychain to the 180 mm wall plaque.

Frame and second color

The frame is the original’s little extra: a tray sized to the plate plus a wall thickness, which a cut-through plate simply drops into. Put the dark plate with the cut bars into a light frame and the bars glow in the frame color – no multi-material printer and no filament change. Under “Frame” you set the wall thickness, the floor and the clearance; a small clearance value (typically 0.2 mm) makes the plate sit snugly without jamming.

The raised and inlaid versions also do not need a dedicated multi-material machine: both produce two parts the slicer prints in two colors. On a single-nozzle printer a single filament change is enough – at the plate thickness for raised bars, and lower by the bar depth for inlaid bars. The generator shows the exact height; in PrusaSlicer you add it as a “color change” in the layer list, in Bambu Studio / OrcaSlicer as “change filament”.

What happens when you share?

The tag is made entirely in the browser. The state of your design lives in the link in the address bar – the digits, size, style and colors. Save the link or send it to someone and they see exactly your design. Only an uploaded SVG file cannot travel in the link; it stays local in your browser. The digit sequence itself only points at a song – it contains no account data and no personal information.

Origin & license

This generator ports the OpenSCAD project openscad-spotify-barcode by César Venzor (MIT license). The original construction – a plate with cut-through bars and a colored frame the plate clicks into – is kept. Changed: the bars are rebuilt from the digits instead of an imported image, the brand logo is replaced by a neutral end mark, and extra styles and mounts were added. The sample code and the brand’s logo are not used.

All parameters

The numeric settings of the generator with their default values and allowed ranges. Text, fonts, patterns and colors are set directly in the generator.

ParameterDefaultRangeMeaning
Length70–Length of the plate from left to right.
Height20–Height of the plate.
Thickness2–Thickness of the plate.
Corner radius2–Rounding of the corners, 0 = square.
Code width0–Width of the code including the end mark, 0 = fit the plate.
Margin3–Plain border around the code and the title.
Relief height0.8–How far raised bars stand out, or how deep bars are engraved/inlaid.
Title size4–Height of the capital letters.
Ring hole5–Diameter of the key-ring hole.
Frame radius5–Corner rounding of the frame.
Frame size4–The frame is this much larger than the plate.
Frame floor2–Thickness of the frame floor the plate rests on.
Clearance0.2–Gap between plate and frame so it fits reliably.

Frequently asked questions

Where do I get my code?

On the music service’s code page, pick the song and download the image as SVG. Drop the file here and the bar heights are read automatically.

Can I type the digits instead?

Yes. Each of the 23 bars has a height from 0 to 7; the first and last are 0, the middle one is 7. The digits are also stored in the share link.

Why is there no logo on the left?

We do not draw brand logos. A neutral disc sits on the left instead; the app usually still recognizes the code.

How small can the keychain be?

From about 50 mm code width the bars are at least 0.8 mm wide and print cleanly with a 0.4 mm nozzle. Smaller codes get thinner and sloppier.

Which colors scan best?

Strong contrast matters most: a dark plate with light bars or the other way round. Glossy filament can glare; matte colors work more reliably.

Does it work without a multi-material printer?

Yes. The cut-through version is single-color, and raised or inlaid bars only need one filament change, at the height the generator reports.

Origin & license

  • openscad-spotify-barcode by César Venzor · MIT · code ported – code plate with cut-through bars and the matching frame; the logo and sample code are not used