If so, how? Do I need any additional software?
I'd instead use LilyPond, which, though not based on TeX at all, has similar goals of human-readable plain-text source files and beautiful, customizable output.
There's also MusiXTeX or old site https://icking-music-archive.org/software/indexmt6-2012-12.html for the actual typesetting (CTAN). A bit of searching turned up this page about exporting from LilyPond to MusiXTeX.
In addition to MusiXTeX, there's also GregorioTeX for gregorian chant. It's apparently very well suited to typesetting this particular type of scores, and is actively maintained.
Lilypond provides a tool called lilypond-book for creating LaTeX documents with embedded music pieces inside. The embedding works via images, and baselines are not considered. So if you want to display a clef in the middle of a line, it will only be nicely aligned vertically with the rest of the line after you have tweaked its vertical position using additional LaTeX code.
If you don't want to create a document, but rather music sheets on their own, Lilypond wins hands down in user friendliness. I am considered quite unanimously as a TeX wizard and would no longer think of using the TeX-based approaches for typesetting music.
With regard to its implementation: I think Lilypond has always been C++, has gained some Scheme innards rather early, but used TeX as its typesetting backend internally for quite a long time. However, its current mode of operation is to write PostScript files directly as main output (PDF generation works internally by using Ghostscript on those). As a result, utf-8 characters work rather transparently if the font has them. TeX's track record in that area, in comparison, is less than fabulous although in the last years, a few TeX engines (XeTeX, LuaTeX) that can work with larger character sets than 8bit have been developed.
I'd go for Lilypond, myself (see Ben Alpert's answer), but note that there's a TeX FAQ page of discussion about the alternatives
I noticed that all these answers have been a long time. I think they are wonderful tools but I have discovered a great summary on CTAN here: http://tug.ctan.org/info/latex4musicians/latex4musicians.pdf. This is a more modern version with TeX Live > 2018, which offers amazing functions.
Excerpt from the document:
- This guide shows how to create LATEX documents that include several kinds of music elements, from very simple to quite complex. Music features may consist of music symbols, song lyrics, guitar chords diagrams, lead sheets, music excerpts, guitar tablatures, multi-page scores.
- Music can be produced directly by TEX and LATEX using packages, and also by external scorewriters. Major packages and programs are listed and briefly described, providing ready-to-use examples.
This should be gospel for LaTeX and music lovers!