| | |
The "sound" of the brain...?
Please support our Python advertiser: Programming Forums - DaniWeb Sister Site
![]() |
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!
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!
•
•
Join Date: Jul 2007
Posts: 45
Reputation:
Solved Threads: 1
just curious, whose brain waves has she recorded? I would like to hear my brain sound later if you succeed
Cool!!
Cool!! "Details make Perfection and Perfection is not a Detail" my site
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.
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/
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:
I think the webbrowser module allows you to play .au files too.
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:
python Syntax (Toggle Plain Text)
# create a soundfile in AU format playing a sine wave # of a given frequency, duration and volume # tested with Python25 by vegaseat 29jan2008 from struct import pack from math import sin, pi def au_file(name='test.au', freq=440, dur=1000, vol=0.5): """ creates an AU format audio file of a sine wave of frequency freq (Hz) for duration dur (milliseconds) at volume vol (max is 1.0) """ fout = open(name, 'wb') # header needs size, encoding=2, sampling_rate=8000, channel=1 fout.write('.snd' + pack('>5L', 24, 8*dur, 2, 8000, 1)) factor = 2 * pi * freq/8000 # write data for seg in range(8 * dur): # sine wave calculations sin_seg = sin(seg * factor) fout.write(pack('b', vol * 127 * sin_seg)) fout.close() # test the module ... if __name__ == '__main__': au_file(name='sound800.au', freq=800, dur=2000, vol=0.8) # if you have Windows, you can test the audio file # otherwise comment this code out import os os.startfile('sound800.au')
Last edited by sneekula; May 22nd, 2009 at 2:49 pm.
No one died when Clinton lied.
![]() |
Similar Threads
- Where do I begin to submit website to search engines. (Search Engine Optimization)
- how do you disable the "sound" chipset... (Windows NT / 2000 / XP)
- "HELP" have no sound but i got two sound cards in my pc (Windows 95 / 98 / Me)
Other Threads in the Python Forum
- Previous Thread: JSON Library
- Next Thread: Pygame logic problem
| Thread Tools | Search this Thread |
abrupt ansi anti approximation array assignment avogadro backend beginner binary bluetooth builtin calculator character chmod code converter countpasswordentry curved customdialog dan08 decimals dictionaries dictionary drive dynamic examples exe file float format function gnu graphics gui heads homework http ideas import input java launcher leftmouse line linux list lists loop module mouse mysqlquery number numbers output parsing path plugin pointer port prime programming progressbar projects py2exe pygame pyqt pysimplewizard python random recursion scrolledtext sqlite statistics stdout string strings sum table terminal text textarea thread threading time tkinter tlapse tricks tuple tutorial twoup ubuntu unicode urllib urllib2 variable windows write wxpython xlib






