It sounds like the stuff of science fiction dreams – or nightmares.

Scientists believe they have found a way to read our minds, using a computer program that can decode brain activity in our brains and put it into words.

They say it could offer a lifeline to those whose speech has been affected by stroke or degenerative disease, but many will be concerned about the implications of a technique that can eavesdrop on thoughts and reproduce them.

Scroll down for video

Scientific breakthrough: An X-ray CT scan of the head of one of the volunteers, showing electrodes distributed over the brain’s temporal lobe, where sounds are processed

Weird science: Scientists believe the technique, shown here, could also be used to read and report what they were thinking of saying next

Neuroscientists at the University of California Berkeley put electrodes inside the skulls of brain surgery patients to monitor information from their temporal lobe, which is involved in the processing of speech and images.

As the patient listened to someone speaking, a computer program analysed how the brain processed and reproduced the words they had heard.

Words with scientists: The top graphic shows a spectrogram of six isolated words (deep, jazz, cause) and pseudo-words (fook, ors, nim). At bottom, the speech segments how the words were reconstructed based on findings from the electrodes

Robert Knight, professor of psychology and neuroscience, added: ‘This is huge for patients who have damage to their speech mechanisms because of a stroke or Lou Gehrig’s [motor neurone] disease and can’t speak.

‘If you could eventually reconstruct imagined conversations from brain activity, thousands could benefit.’

The researchers tested 15 people who were already undergoing brain surgery to treat epilepsy or brain tumours.

They agreed to have up to 256 electrodes put on to the brain surface, as they listened to men and women saying individual words including nouns, verbs and names.

Testing: As a subject listened to someone speaking, a computer program analysed how the brain processed and reproduced the words they had heard

Breakthrough: The ability to scan the brain and read thoughts could offer a lifeline to those whose speech has been affected by a stroke or degenerative disease

A computer programme analysed the activity from the electrodes, and reproduced the word they had heard or something very similar to it at the first attempt.

Co-author Brian Pasley said there is already mounting evidence that ‘perception and imagery may be pretty similar in the brain’.

Therefore with more work, brain recordings could allow scientists to ‘synthesise the actual sound a person is thinking, or just write out the words with a type of interface device.’

Their study also shows in sharp relief how the auditory system breaks down sound into its individual frequencies – a range of around 1 to 8,000 Hertz for human speech.

Pasley told ABC News: ‘This study mainly focused on lower-level acoustic characteristics of speech. But I think there’s a lot more happening in these brain areas than acoustic analysis’.

He added: ‘We sort of take it for granted, the ability to understand speech. But your brain is doing amazing computations to accomplish this feat.’

Analyzing words: This graphic breaks down the three ways the brain hears spoken words and processes sounds

This information does not change inside the brain but can be accurately mapped and the original sound decoded by a computer. British expert Professor Jan Schnupp, from Oxford University who was not involved in the study said it was ‘quite remarkable’.

‘Neuroscientists have of course long believed that the brain essentially works by translating aspects of the external world, such as spoken words, into patterns of electrical activity’, he said.

‘But proving that this is true by showing that it is possible to translate these activity patterns back into the original sound (or at least a fair approximation of it) is nevertheless a great step forward, and it paves the way to rapid progress toward biomedical applications.’

He played down fears it could lead to range of ‘mind reading’ devices as the technique can only, at the moment, be done on patients willing to have surgery.

Non-invasive brain scans are not powerful enough to read this level of information so it will remain limited to ‘small numbers of willing patients’.

He added: ‘Perhaps luckily for all those of us who value the privacy of their own thoughts, we can rest assured that our skulls will remain an impenetrable barrier for any would-be technological mind hacker for any foreseeable future.’