A barrel organ plays music by using turning a barrel , with notes decided by an arrangement of pins . It is very similar to a simple music box where the pins pluck a metal harp . The pieces of music ( or tunes ) are encoded onto the barrel using metal pins and staples .