Marvin Rainwater, a classically trained pianist who improbably turned to country music after an accident in a garage, then wrote and recorded the hit songs “Gonna Find Me a Bluebird” and “Whole Lotta Woman,” died on Tuesday in Minneapolis. He was 88.

The cause was heart failure, his wife, Sheree, said.

Mr. Rainwater’s piano playing was curtailed after he lost part of his right thumb in an accident while working in a garage as a teenager. He turned to the guitar, and to singing country music in his twangy baritone, while serving in the Navy during World War II.

“When I went in the Navy, I was so lonesome for my music,” Mr. Rainwater said in an interview with Minnesota Public Radio in 1998. “Then I started writing songs, and naturally it fell back to my roots as a boy in Oklahoma, and they turned out to be hillbilly songs.”