A Ranz des Vaches or Kuhreihen is a simple melody traditionally played on the horn by the Swiss Alpine herdsmen as they drove their cattle to or from the pasture. The Kuhreihen was linked to the Swiss nostalgia and Homesickness (also known as mal du Suisse "Swiss illness" or Schweizerheimweh "Swiss homesickness").
The Reverend James Wood, writing in the Nuttall Encyclopaedia in 1907, said that such a tune "when played in foreign lands, produces on a Swiss an almost irrepressible yearning for home", repeating 18th century accounts the mal du Suisse or nostalgia diagnosed in Swiss mercenaries. Singing of Kuhreihen was forbidden to Swiss mercenaries because they led to nostalgia to the point of desertion, illness or death. The 1767 Dictionnaire de Musique by Jean-Jacques Rousseau claims that Swiss mercenaries were threatened with severe punishment to prevent them from singing their Swiss songs. The Romantic connection of nostalgia, the Kuhreihen and the Swiss Alps was a significant factor in the enthusiasm for Switzerland, the development of early tourism in Switzerland and Alpinism that took hold of the European cultural elite in the 19th century.
The Kuhreihen were romanticized in the wake of the Unspunnenfest of 1805 in a collection edited by G. J Kühn and J. R. Wyss. The fourth edition of 1826 gave scores for piano and was luxuriously illustrated, its intended market the educated early tourists to Switzerland. The collection also influenced the Swiss yodel that was emerging at the time. It became somewhat of a topos in Romantic literature, and figures in the poem Der Schweizer by Achim von Arnim (1805) and in Clemens Brentano's Des Knaben Wunderhorn (1809) as well as in the opera Le Chalet by Adolphe Charles Adam (1834) which was performed for Queen Victoria under the title The Swiss Cottage.
Two famous examples of the ranz des Vaches melodies are the cor anglais and Flute solo in the third section of the overture to Gioachino Rossini's opera William Tell, and the oboe and cor anglais theme of the third movement of Hector Berlioz's Symphonie fantastique.
Henry David Thoreau compared the song of the wood thrush to a ranz des vaches: "So there is something in the music of the cow bell, something sweeter and more nutritious, than in the milk which the farmers drink. This thrush's song is a ranz des vaches to me. I long for wildness, a nature which I cannot put my foot through, woods where the wood thrush forever sings, where the hours are early morning ones, and there is dew on the grass, and the day is forever unproved, where I might have a fertile unknown for a soil about me." 
Also in Thoreau, in his Walden chapter "The Bean Field," he writes of the beans he plants near his home: "They were beans cheerfully returning to their wild and primitive state that I cultivated, and my hoe played the Ranz des Vaches for them."