-
You have to convert them over I'm afraid. I had a look around for the format of bwg files, but couldn't find much of anything :(
edit: check out my post on page 7 http://forums.qj.net/showthread.php?...6&page=7&pp=10
it tells you how to convert BWG files manually.
-
It just got even better. I've managed to whip up a 16 channel mixer(8 left 8 right) that will mix all of the binaural beats into one complex wave. This frees up a total of 3 more stereo channels that can be used for generation of white noise, or the playing of MP3s/WAVs.
This also has cut down the file size and complexity of the code by a bit of a margin. I had a bit of a problem when mixing all of the 16 channels, but it turned out to be a redundant loop cycle that tried to read from uninitialised integers. Reducing the loop by one make the sound crystal clear with no distortion to any of the waves :D
If anyone is interested in how I did this, here's my audio callback function, fully commented. This was adapted from the wavegen sample in the SDK.
Code:
////////////////////////////////
/// audioCallback
///
/// combines multiple generated
/// frequencies into one
/// stereo channel
///
/// referenced variables:
/// float freq[16][3];
/// float oldFreq[16][2];
/// float sampleTime[16][2];(initial value of 0)
////////////////////////////////
void audioCallback(int channel, unsigned short* buf, unsigned int length) {
//These three variables are standard, they control the length
//of each sample, volume range of each sample, and
//the pointer to our audio buffer
const float sampleLength = 1.0f / sampleRate;
const float scaleFactor = (SHRT_MAX - 1.0f)/2;
sample_t* ubuf = (sample_t*) buf;
//The i variable is standard, but the z is an addition
//i is used to loop through the length of the
//sample we are making, generating the waves as it goes.
//z is used in the loop below to combine all of the
//waves generated in the previous loop.
int i,z;
for (i = 0; i < length; i++) {
//Our left and right wave values
short zL=0;
short zR=0;
//8 stereo hz holders(0-7)
for (z = 0; z < 7; z++ )
{
//Check to make sure we are supposed to be
//generating a tone, so as to prevent
//quietening of the whole sample
if (freq[z][0] > 0)
{
//Here we correct the time stamp of the sample
//incase of freq change(such as with timers)
//freq[z][0] = base freq(e.g. 200hz)
//freq[z][1] = offset freq(e.g. 210hz)
if (freq[z][0] != oldFreq[z][0]) {
sampleTime[z][0] *= (oldFreq[z][0] / freq[z][0]);
}
if (freq[z][1] != oldFreq[z][1])
{
sampleTime[z][1] *= (oldFreq[z][1] / freq[z][1]);
}
//This is the rendering of the two sine
//waves we want(left and right, base and beat
short s = (short) (scaleFactor * sinf(2.0f * PI * freq[z][0] * sampleTime[z][0]));
short s2 = (short) (scaleFactor * sinf(2.0f * PI * freq[z][1] * sampleTime[z][1]));
//Have we been through the loop before
//if so we need to combine the previous
//generated waves with these two
//If not, then we can set our final wave
//variables as the generated ones
if (z == 0)
{
zL = s;
zR = s2;
} else {
//Here is where the samples are added together
//We first of all add the two wave values
//producing a complex wave, then to compensate
//for distortion we find the mean between
//the two freqs and subtract it from the overall
//wave, and then divide by two to normalise the
//the amplitude
zL = ((s+zL) - ((s*zL)/(SHRT_MAX*2)))/2;// - (s.s2) / 32768;
zR = ((s2+zR) - ((s2*zR)/(SHRT_MAX*2)))/2;
}
//Move the time along
sampleTime[z][0] += sampleLength;
sampleTime[z][1] += sampleLength;
if (sampleTime[z][0] * freq[z][0] > 1.0f) {
double d;
sampleTime[z][0] = modf(sampleTime[z][0] * freq[z][0], &d) / freq[z][0];
}
if (sampleTime[z][1] * freq[z][1] > 1.0f) {
double d;
sampleTime[z][1] = modf(sampleTime[z][1] * freq[z][1], &d) / freq[z][1];
}
//Incase the freq changed, update the main holder
oldFreq[z][0]=freq[z][0];
oldFreq[z][1]=freq[z][1];
}
}
//Filling the buffer with the produced data
ubuf[i].l = zL;
ubuf[i].r = zR;
}
}
I'll release an updated version later today or tommorow, depending on what happens :)
It seems like some distortion does appear, so this won't be used.
-
-
Psilocybeing, can't you write a program that converts bwg to the file as a txt document without .txt and put it in the presents folder so we can listen to it on the PSP?
-
I can't find any specifications for the bwg format unfortunately, so no :(
-
Psilocybeing, correct me if I'm wrong. Here's the link for the Sinus Cure preset.
Sinus Cure
V3600 72.0
V90 1.8
V90 1.8
V125 2.5
V7300 146
V20000 456
V0 0
V0 0
T1 599 1200 3600 72.0
T2 600 1200 90 1.8
T3 600 1200 90 1.8
T4 597 1200 125 2.5
T5 600 1200 7300 146
T6 600 1200 20000 456
-
have u tried the sinus one yet? man i wish this was released sooner, i had the worst sinus infection like a month ago and now its gone after like 30 types of medicen a day, this could have saved me the trouble.
-
I tried it on my computer, it worked like 5 minutes after I listened to it, my left and right popped open simutaneously, that's miraculous.
-
Well, I tried one of the presets, and what do you know, I was falling asleep... Not good though, because I was using the computer. :)
Good work on this, I hope it can help with my sleeping problem.
What do you recommend If I wanted to have a really trippy experience? Also, which are the best pre-sets for 1. Sleeping 2. Alertness (for when I get up in the morning) 3. Vivid Experiences ( i read in this thread somewhere that someone had them, and I need to know which ones so I can try =p)
-