How Do You Program Isochronic Tones in C#?

  • Thread starter Thread starter btb4198
  • Start date Start date
AI Thread Summary
To program isochronic tones in C#, the code should generate a sine wave with specific frequency and amplitude, inserting silence (zeros) at intervals determined by the desired beat frequency. The sample rate is set to 44100, and the frequency and amplitude can be adjusted based on the user's requirements. It is suggested to add a significant number of zeros (e.g., 10,000 or 20,000) for each beat to create a noticeable gap in the sound. The discussion emphasizes the importance of troubleshooting the sound output and understanding the parameters for effective isochronic tone generation. Proper implementation of these concepts is crucial for achieving the desired auditory effect.
btb4198
Messages
570
Reaction score
10
how do i make an isochronic tone?

is it like this?
Code:
 for (int n = 0; n < sampleCount; n++)
        {
            if( counter == Beat)
            {
              buffer[n + offset] = 0;
                sample++;
            }
            else
            {
            buffer[n + offset] = (float)(Amplitude * Math.Sqrt((2 * Math.PI * sample * Frequency) / sampleRate));
            sample++;
            if (sample >= sampleRate) sample = 0;
               
                counter =0;
            }

?
 
Engineering news on Phys.org
I don't think so.

I think you need A*sin(wt) where w=frequency of tone and A = repeating envelope
 
ok I tried that but it still does not sound right :

Code:
   public override int Read(float[] buffer, int offset, int sampleCount)
    {
        int sampleRate = WaveFormat.SampleRate;
    
        for (int n = 0; n < sampleCount;)
        {
            if( counter == Beat)
            {
              buffer[n + offset] = 0;
              buffer[n + offset + 1 ] = 0;
              buffer[n + offset + 2] = 0;
              n = n + 3;
                sample = sample +3;
            }
            else
            {
            buffer[n + offset] = (float)(Amplitude * Math.Sin((2 * Math.PI * sample * Frequency) / sampleRate));
            sample++;
            n++;
            if (sample >= sampleRate) sample = 0;
               
                counter =0;
            }
        }
        return sampleCount;
    }

this is what i have now
 
What is amplitude set to?

Have you plotted the sine wave?

How does it sound wrong? It's pretty hard for me to hear it.

You may need to float things within the sine
 
It does not sound like an Isochronic tone...
is my function wrong?
 
What frequency sine wave do you want, and what amplitude pattern. What are you actually getting? Seems pretty simple to me. Can't you do a little basic troubleshooting?

BTW, No way I'm going to run an exe file.
 
lol it is safe... I made it lol...
and this is how I am going it :

Code:
for (int n = 0; n < sampleCount;n++)
        {
            if( counter == Beat)
            {
              buffer[n + offset] = 0;
              sample++;
              counter = 0;
            }
            else
            {
            buffer[n + offset] = (float)(Amplitude * Math.Sin((2 * Math.PI * sample * Frequency) / sampleRate));
            sample++;
            counter++;
            if (sample >= sampleRate) sample = 0;

sampleRate is 44100
Frequency changes
and so does Amplitude
Beat is the isochronic tone frequency
from what I read online, when the beat is 0...
I just do not know if i set it up right in the cool

also how many 0s should I add at one time...
right now I am adding a 0 everytime counter = beat which I do not know if that it right ...

how should I set it up ?
I did not find an equation for it
 
  • #10
If you are getting a modulated tone that electronically behaves as you'd expect, then I can be of no further help. I know nothing about isochronic tones, what paramaters they require, and/or their physiological or pychological effects.
 
  • #11
does that code look right, base on the beat ? if I have a 10Hx beat, should I add a zero every 100 points? and how many 0s should I add... that is what I really need to know
 
  • #12
Just for our members and visitors here at Physics Forums, here is some information about isochronic tones, how they are generated, and what they are used for.

“Isochronic tones are regular beats of a single tone used for brainwave entrainment. Similar to monaural beats, the interference pattern that produces the beat is outside the brain so headphones are not required for entrainment to be effective. They differ from monaural beats, which are constant sine wave pulses rather than entirely separate pulses of a single tone.”
http://en.wikipedia.org/wiki/Isochronic_tones

“Brainwave entrainment is the practice of entraining one's brainwaves to a desired frequency, by means of a periodic stimulus with corresponding frequency.”
http://en.wikipedia.org/wiki/Comparison_of_brainwave_entrainment_software

Bobbywhy
 
  • #13
Bobbywhy,

I am setting up my code right for this ? I could not find any online equations for it . how many 0s should I add in for each beat ?
 
  • #14
btb4198 said:
Bobbywhy,

I am setting up my code right for this ? I could not find any online equations for it . how many 0s should I add in for each beat ?

I cannot answer your question. There may be some help available here:
http://www.lux-vst.com/plugins/lux-brainwave-entrainment-instrument/

And, if that brings “no joy”, then you might try using Google and the search terms “isochronic tone generator software”. There are lots of entries to check.

Bobbywhy
 
  • #15
btb4198 said:
also how many 0s should I add at one time...
right now I am adding a 0 everytime counter = beat which I do not know if that it right ...

If samplerate is the number of samples per second, and you want a gap of 0.1 seconds, you need 0.1*samplerate zeros.

One or two zeros won't do anything much. Try 10,000 or 20,000 and see if that is more like what you want.
 
  • #16
how do I know when to add the 0s? per the beat ?
so if I have a 4kh beat, how do i know when to start add the 0 then when to go back the the normal signal ?
 
Back
Top