SIR Paul McCartney said artificial intelligence has been used to create “the last Beatles record”, which is set to be released later this year.

The 80-year-old former Beatle said technology was used to extract late bandmate John Lennon’s voice from an old demo and “get it pure” for what he said will be the final song from the Liverpool band.

He told Martha Kearney on BBC Radio 4’s Today programme that AI is an “interesting thing” and “something that we’re all sort of tackling at the moment” and trying to deal with.

“When Peter Jackson did the film (The Beatles) Get Back, where it was us making the Let It Be album, he was able to extricate John’s voice from a ropey little bit of cassette and a piano. He could separate them with AI, he’d tell the machine ‘That’s a voice, this is a guitar, lose the guitar’.

READ MORE: Sir Ian Rankin to receive knighthood at Buckingham Palace

“So when we came to make what will be the last Beatles record, it was a demo that John had that we worked on and we just finished it up. It will be released this year.

“We were able to take John’s voice and get it pure through this AI so then we could mix the record as you would do. It gives you some sort of leeway.”

McCartney “We will just have to see where that leads,” he said.

The singer-songwriter also spoke about his forthcoming exhibition to mark the reopening of the National Portrait Gallery, titled Paul McCartney Photographs 1963-64: Eyes Of The Storm, which incorporates unseen photographs taken by Sir Paul during the early days of The Beatles.

The archive features more than 250 images taken between November 1963 and February 1964, which capture the emergence of Beatlemania through the personal lens of Sir Paul’s Pentax camera.

The exhibition will run from June 28 to October 1 at the gallery, which has undergone three years of major refurbishment.

It features portraits of Sir Ringo Starr as well as late bandmates George Harrison and Lennon, and manager Brian Epstein.

McCartney said: “It is very poignant, it’s great because, whenever you lose someone, I think your natural thing is ‘Well, we’ve got beautiful memories’, and you hold fast those memories of the good times.

“I don’t tend to dwell on the fact that you’ve lost someone. After a while – it’ll maybe take a year or two – and then you can look back and you just remember where you met them, things you did…

“And when it came to The Beatles, and you have this overwhelming stuff happening to you, you knew each other so well that you could lean on each other – that’s what I see in these pictures.”