From left, Larry Grenadier, Jack DeJohnette, John Scofield and John Medeski make up jazz supergroup Hudson. (Nick Suttle)

After living in New York and Boston for much of his adult life, jazz pianist John Medeski moved to the Hudson Valley in upstate New York in 2003, trading city life for a secluded house in the woods about two hours from Manhattan. The loose region that contains the Hudson River has long been a popular enclave for musicians (it’s where Woodstock was staged) and remains home to many players who migrate there from the city.

“There’s a certain native energy here that we tap into, that fuels us, and it’s really just beautiful,” Medeski says. “For the past 100 years, it’s been a place for artists and musicians to come and be inspired.”

In 2014, Medeski and a few other jazz musicians who live in the area — drummer Jack DeJohnette, bassist Larry Grenadier and guitarist John Scofield — joined forces for a one-off show at the Woodstock Jazz Festival. Last year, DeJohnette (who played on Miles Davis’ “Bitches Brew”) decided he wanted to do something for his 75th birthday in 2017, so he called up his collaborators from that festival set.

The band Hudson was born and a plan was hatched: They’d record original compositions, along with improvisational jazz takes on pop and rock songs that were either about the Hudson Valley, recorded there or from musicians who had a connection to the area (including Joni Mitchell’s “Woodstock,” Bob Dylan’s “Lay Lady Lay” and The Band’s “Up on Cripple Creek”). The chemistry was instantaneous.

“I think it’s pretty obvious in the music, when you hear it,” says Medeski, a third of the avant-garde jazz group Medeski Martin & Wood, which often collaborates with Scofield. “You never know when you get a bunch of guys together — it doesn’t mean there’s gonna be chemistry. There’s something about where we meet because we all have a lot of the same influences but varying degrees of doing different things, between jazz and popular music and funk and R&B and avant-garde music. We all have connections to that music so when we come together, the common denominators that arise are really great and we all get pushed in different directions that give the band a life of its own.”

You can hear that process in real time on “Hudson,” the first track from the resulting album of the same name, which the band will bring to the Hamilton on Tuesday for a live show.

“That [recording] was the first and only time that [song] happened, and now, when we do it live, it’s different every night,” Medeski says. “Everyone in the band is a composer and improviser and a great soloist, so you put that all together with the desire to make music and that kind of stuff happens where you can create this piece — this spontaneous composition can happen without having to talk about it at all.”

Hamilton, 600 14th St. NW; Tue., 8 p.m., $29.75-$73.25.