Binaural signal generation

Iain_C

Member
Hi all,

I'm interested in making a Picaxe-based mind machine, to provide photic stimulation and binaural signal generation. The hardware side's certainly easy; an output for LEDs on googles, and an output for each headphone with an RC filter.

The question is how to get the three frequencies I need.

1. A base tone, 300-400Hz to one earphone. Exact frequency doesn't matter so long as it's known.
2. A tone with an 10Hz offset from the base tone, to the other earphone.
3. A 10Hz square-wave output to strobe the LEDs.

The simplest solution I can see is a pair of 08M's. One would use pwmout to generate the base tone in the background while the inner loop would use pulsout to generate the 10Hz square wave. Meanwhile a second 08M would use pwmout to generate the base+offset tone.

Would this work? Is there a single-Picaxe solution?
 

craig008

New Member
i cant see a reason why it wouldnt. as you know pwmout runs in the back ground and i do not know if the 28x1 can pwmout on both its pwm pins at the same time (you may want to llok into this in more detail), this then gives you plenty of outputs for ur LEDs and also alot more programme space if you want to make chnages later or your programme is to large for 08m + also its just on chip which should make the circuit easier to construct
________
Mb50
 
Last edited:

hippy

Technical Support
Staff member
The 28X1 can do two entirely independant PWM's although getting down to 300-400Hz and another with an accurate +10Hz could be an interesting challenge, if at all possible.

I expect the ideal sound is two sine waves and even one would be hard to generate at PICAXE speeds. It might be possible to turn the PWM square wave into something approaching a sine wave.

My gut reaction is not possible, but I never mind being proven wrong and a lot would be learned by trying anyway.

Added : A long sequence of pins= commands may be the best way to bit bang out the required signals through a couple of 3 resistor D-to-A's with a spare i/O line for the LED. Fastest execution speed is what's best there and the 28X1 can run at 20MHz and potentially overclocked higher.
 
Last edited:

Tom2000

Senior Member
I could see generating a low frequency sine wave using PWM values obtained from, say, a 128-step sinewave lookup table, but I can't figure any way to generate two of them 10 Hz apart.

If you want to do this in dedicated hardware, I'd say build yourself two audio oscillators using whichever of the gazillion audio oscillator circuits out there that meet your requirements.

If a hybrid PC/Picaxe solution is a possibility, though, let each machine do what it does best. Have the Picaxe manage your LEDs, and play a wave file through your sound card.

I've generated a wave file that might be suitable. It's 300 Hz on the left channel, and 310 Hz on the right, at -8 dB. If you use Media Player to play the file, set it to loop continuously.

Set your machine's level controls to no more than 2/3 max for the Master and Wave volume controls to maintain spectral purity.

You can find the file at http://www.mindspring.com/~tom2000/. Navigate to the bottom of the page and click on the "Download 300-310_Hz.zip" link.

HTH,

Tom
 

womai

Senior Member
If the frequencies are fixed, then generating a sine wave form a PWM square wave is very easy - add a low-pass filter. The simplest incarnation is an R-C-filter (Picaxe PWM feeds a resistor that feeds a capacitor, see below). The 3dB bandwidth is BW=1/(2*pi*R*C), pi=3.14159. Make that bandwidth approximately equal to your square wave frequency. Also a good idea to buffer the filter output (with an op-amp follower) if you want to use it to drive headphones.

Code:
               ___
         PWM -|___|------o Out
                R      |
                      ---
                    C ---
                       |
                      GND
That gives at least a good approximation to a sine wave. You can of course get more fancy and build a multi-stage filter, or make it an active filter (op-amp with appropriate feedback loop).

Wolfgang
 

Iain_C

Member
Many thanks to all for your thoughts, and especially to Tom for bothering to render me a WAV.

Further Googling has revealed that the "isochronic tones" method of auditory stimulation has been found to be at least as effective than binaural generation. Which is nice, as it's extremely simple - a higher frequency tone, pulsed with a square wave at the target frequency (e.g. 10hz).

Using this technique, audio and LED stimulation can now easily be done on an 08. I may use a 555 etc to generate the higher tone, then the 08 just needs to worry about accurately switching the 555 and LEDs. It'll make it easy to set up programs of varying frequency too.
 

Tom2000

Senior Member
And the use of isochronic tones neatly solve one problem you didn't mention, but that was giving me a headache: how to sync the LED flashes to binaural beat note. Now it's easy.

Good luck with your investigations, Iain.

Tom
 

Iain_C

Member
Hmm - now I think of it, I'm fairly sure I can ignore instruction timing altogether given that I'm only generating frequencies up to 12Hz!

So I can keep the whole thing on one chip including audio osc with a simple inner loop of

Code:
led high
play toneburst for n
led low
pause for n
where n = 1 / 2 * frequency.
 

Tom2000

Senior Member
Iain,

Once you start fooling around with this stuff, it becomes addictive. :)

I generated a couple more wave files for you, based on the old analog IMD test signal used to test telephone circuits. (I always liked the sound of that test signal.)

The zip file in the "Download Brainbeats.zp" link at the bottom of my page contains two files: Brainbeat Mono.wav and Brainbeat Stereo.wav.

The mono file consists of 855 + 865 + 1355 + 1365 at -8 dB. The stereo file consists of 855 + 865 on the left channel and 1355 + 1365 on the right, both at -8 dB.

I don't know if they have any earthly use in a mind machine, but they have a very pleasant sound with a very pronounced 10 Hz beat.

Have fun!

Tom
 

Magma6

New Member
Interesting project ! I was thinking to try to do something like that after I read the weekend project on Makezine blog (google "Hack Your Brain" on their site).
I found this interesting link in the comments http://www.hackcanada.com/homegrown/wetware/brainwave/ based on the use of the parallel port of a PC but still worth a read.

Please keep giving us feedback of your experiments.

(And sorry for all the mistakes but english is not my mother tongue)
 
Top