The first time Andy Moor remembers his band The Ex playing in Edinburgh, it was in a long lost Cowgate dive sometime in 1990. With much of the venue's clientèle in attendance solely to take advantage of its late night opening hours, the sounds of Holland's première underground punk band didn't go down too well.

“After four songs our sound man got bottled,” Moor remembers. “It was quite a dodgy place, where most people just wanted a late drink, I don't think we were what some people were expecting.”

This incident hasn't stopped Moor and co returning to the city that is arguably the band's spiritual home, and is where they forged strong musical connections with a grassroots DIY scene based around Edinburgh College of Art's Wee Red Bar and other places with more responsive audiences than the weekend drinking crowd of yore.

Following a date in Glasgow in 2010 accompanied by Brass Unbound, the free jazz horn quartet featuring saxophonists Mats Gustafsson and Ken Vandermark, this weekend sees The Ex return to Edinburgh for the first time since 2001. The band's Summerhall show is promoted by the city's finest purveyors of interesting sounds, Braw Gigs, in association with the venue's regular Nothing Ever Happens Here initiative. The Ex will also slot in a set at the Doune the Rabbit Hole festival at the Cardross Estate.

The band's Edinburgh date comes on the back of the release of The Ex at Bimhaus, a two CD compilation of performances recorded at Amsterdam's legendary jazz club between 1991 and 2015 with a host of guest collaborators. The record also charts The Ex's changes in personnel, with G.W. Sok, the band's vocalist since 1979, departing amicably after twenty years.

“The band's first bass player left in 2004,” says Moor.”He'd been playing in The Ex for fifteen years was there when I joined, and now suddenly he was gone. At first that felt strange, but we felt like we wanted to carry on, and at first replaced it with a double bassist, and then with a baritone guitar. Replacing the singer was different, because it's the front person of the band, but we were very lucky finding Arnold de Boer. He sings and plays guitar, so it's very different, and I think I like playing in the band even more than I did before. If we'd not found him,” Moor laughs, “we'd have had to become an instrumental math rock band or something.”

Moor first hooked up with The Ex after the band toured with Dog Faced Hermans, the equally wayward anarcho-punk quartet formed in Edinburgh with bass player Colin McLean, drummer Wilf Plum and vocalist Marion Coutts.

“We first met The Ex through Dunstan Bruce from Chumbawamba,” Moor says, highlighting the tight-knit nature of the 1980s anarcho-punk scene before Chumbawamba subverted the mainstream with their 1998 smash hit, Tubthumping. “He drove the van for Dog Faced Hermans, and he said I played exactly like The Ex. We'd never heard of them, and thought they were this really heavy industrial band like Test Department.”

An alliance between The Ex and Dog Faced Hermans was eventually formed, with both bands collaborating on the single, Stonestamper's Song, and the live cassette release, Treat, in 1990. By that time Moor was playing with The Ex, and the whole of Dog Faced Hermans decamping to Amsterdam.

“Marion had wanted to go to Poland to do her art,” says Moor, “and we didn't know what would happen. The Ex invited me to join them, and I went to Amsterdam, originally for a year, then when Dog Faced Hermans regrouped there I played in both bands for a while, but it killed me.”

Originally from London, Moor moved to Edinburgh to study anthropology, and met Colin McLean at a benefit disco for SCRAM, or the Scottish Campaign to Remove the Atomic Menace.

“He was playing lots of James Brown and African records,”says Moor, “and he must've lent me about a hundred records that summer, all this free jazz, African and reggae stuff.”

Such out-there influences on Edinburgh's post-punk scene were galvanised even more by what can now be regarded as a golden age of Friday night jazz gigs at the Queen's Hall throughout the 1980s and 1990s . With barely a week passing by without giants of the genre appearing, artists such as Ornette Coleman, the Art Ensemble of Chicago, Don Cherry's Nu and Cecil Taylor opened Moor and friends up to an eclectic array of sounds that influenced McLean and Moor's early forays with experimental act Volunteer Slavery, which eventually morphed into Dog Faced Hermans.

“At the time you don't think about the influence that's having on you. You just go. But when you're young you're open to all that stuff, and it steers you into some really interesting territory.”

Dog Faced Hermans and fellow travellers including Archbishop Kebab and Vatican Shotgun Scare became key figures in Edinburgh Musicians Collective, which was based at Jimmy Boyle's Gateway Exchange centre in Edinburgh’s Abbeyhill district.

“Colin was working at the Gateway,” explains Moor, “and we spent a whole summer rehearsing in what had been an old washhouse. Loads of bands became involved in the collective, and we started getting bands like Bogshed and Big Flame up to play the Wee Red Bar. The Ex were part of that as well. That whole period was just lie this little explosion of activity, with everyone helping each other out, but because it was pre-internet a lot of that history has become lost or hidden now.”

Over the years, The Ex have collaborated with the likes of Tortoise and Sonic Youth, as well as free improv players such as drummer Han Bennink. Moor has also collaborated with saxophonist John Butcher and an array of Ethiopian musicians.

“We get invited to play a lot of free jazz festival,” says Moor, “and that's where we see these people and they see us, so it's a good exchange.”

By a quirk of fate, The Ex arrive in Edinburgh two days before former Dog Faced Hermans vocalist Coutts appears at Edinburgh International Book Festival. Now an internationally renowned visual artist, Coutts will be reading from The Iceberg, her acclaimed memoir of her time caring for her partner, art critic Tom Lubbock prior to his tragic death from a brain tumour.

“Marion's lyrics were so good that it was inevitable she would end up writing something,” Moor comments.

With McLean working in music venues in Amsterdam and Plum in Brussels playing with the African inspired Orchestre Tout Puissant Marcel Duchamp, the legacy of Edinburgh Musicians Collective goes on.

“The Ex isn't about some old geezers reunion,” says Moor. “We still have energy, and we still want to do different things. Sometimes we get invited to play those Punk's Not Dead Festivals, and we always say no, but the people who ask us think we're being snobby. I don't care if punk's dead or not. I just want to keep on making interesting music.”

The Ex play Summerhall tomorrow, and at the Doune The Rabbit Hole festival on Cardross Estate this weekend.