The "sound" of the brain...?

Please support our Python advertiser: Programming Forums - DaniWeb Sister Site
Reply

Join Date: Feb 2007
Posts: 77
Reputation: aot is an unknown quantity at this point 
Solved Threads: 1
aot's Avatar
aot aot is offline Offline
Junior Poster in Training

The "sound" of the brain...?

 
0
  #1
May 22nd, 2009
So, as a scientist, I have plenty of geeky friends... and one of them is interested in creating a sound file from the brain waves she records. Essentially, she has a brain wave, and wants to feed it into a sound program to play it as if it were a sound wave.

Does anyone know of a program like this, or possibly a way to do it using python? I only ask here because I don't know of a better forum for this question, and if the answer is available in python I might be able to code something up for her.

Cheers!
Reply With Quote Quick reply to this message  
Join Date: Jul 2007
Posts: 45
Reputation: names24 is an unknown quantity at this point 
Solved Threads: 1
names24 names24 is offline Offline
Light Poster

Re: The "sound" of the brain...?

 
0
  #2
May 22nd, 2009
just curious, whose brain waves has she recorded? I would like to hear my brain sound later if you succeed Cool!!
"Details make Perfection and Perfection is not a Detail" my site
Reply With Quote Quick reply to this message  
Join Date: Feb 2007
Posts: 1,613
Reputation: scru has a spectacular aura about scru has a spectacular aura about 
Solved Threads: 130
Featured Poster
scru's Avatar
scru scru is offline Offline
Posting Virtuoso

Re: The "sound" of the brain...?

 
0
  #3
May 22nd, 2009
What format are the recorded waves in? A binary stream, or?
Reply With Quote Quick reply to this message  
Join Date: Feb 2007
Posts: 77
Reputation: aot is an unknown quantity at this point 
Solved Threads: 1
aot's Avatar
aot aot is offline Offline
Junior Poster in Training

Re: The "sound" of the brain...?

 
0
  #4
May 22nd, 2009
Ah yes. Technically they record it in analog and convert to digital, so she could theoretically provide either format. Although I don't know the specific file type that she uses, I can find out. At the least it would be possible to take a screenshot of the wave.
Last edited by aot; May 22nd, 2009 at 10:15 am.
Reply With Quote Quick reply to this message  
Join Date: Feb 2007
Posts: 1,613
Reputation: scru has a spectacular aura about scru has a spectacular aura about 
Solved Threads: 130
Featured Poster
scru's Avatar
scru scru is offline Offline
Posting Virtuoso

Re: The "sound" of the brain...?

 
0
  #5
May 22nd, 2009
I don't know of any program that does exactly this, but maybe you can search for one that transforms binary data into a wave file (or at least how). If you're feeling particularly ambitious, you can even write a script that transforms the data from scratch: http://ccrma.stanford.edu/courses/42...ts/WaveFormat/
Reply With Quote Quick reply to this message  
Join Date: Oct 2006
Posts: 2,279
Reputation: sneekula has a spectacular aura about sneekula has a spectacular aura about 
Solved Threads: 176
sneekula's Avatar
sneekula sneekula is offline Offline
Nearly a Posting Maven

Re: The "sound" of the brain...?

 
0
  #6
May 22nd, 2009
Look into Python modules audioop and sunaudiodev
Sun's .au audio file format is rather simple and flexible. Here is an example that vegaseat left some time ago, it shows you how to create an .au files from scratch:
  1. # create a soundfile in AU format playing a sine wave
  2. # of a given frequency, duration and volume
  3. # tested with Python25 by vegaseat 29jan2008
  4.  
  5. from struct import pack
  6. from math import sin, pi
  7.  
  8. def au_file(name='test.au', freq=440, dur=1000, vol=0.5):
  9. """
  10. creates an AU format audio file of a sine wave
  11. of frequency freq (Hz)
  12. for duration dur (milliseconds)
  13. at volume vol (max is 1.0)
  14. """
  15. fout = open(name, 'wb')
  16. # header needs size, encoding=2, sampling_rate=8000, channel=1
  17. fout.write('.snd' + pack('>5L', 24, 8*dur, 2, 8000, 1))
  18. factor = 2 * pi * freq/8000
  19. # write data
  20. for seg in range(8 * dur):
  21. # sine wave calculations
  22. sin_seg = sin(seg * factor)
  23. fout.write(pack('b', vol * 127 * sin_seg))
  24. fout.close()
  25.  
  26. # test the module ...
  27. if __name__ == '__main__':
  28. au_file(name='sound800.au', freq=800, dur=2000, vol=0.8)
  29.  
  30. # if you have Windows, you can test the audio file
  31. # otherwise comment this code out
  32. import os
  33. os.startfile('sound800.au')
I think the webbrowser module allows you to play .au files too.
Last edited by sneekula; May 22nd, 2009 at 2:49 pm.
No one died when Clinton lied.
Reply With Quote Quick reply to this message  
Join Date: Mar 2008
Posts: 3
Reputation: Bill Fisher is an unknown quantity at this point 
Solved Threads: 0
Bill Fisher Bill Fisher is offline Offline
Newbie Poster

Re: The "sound" of the brain...?

 
0
  #7
May 24th, 2009
..and if you convert to square waves......
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the Python Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC