YSE: 3D sound engine created with JUCE


#1

Hello again.

I just created a first public beta of my 3D sound engine, which uses JUCE for file reading and audio output. The goal is an easy to use library for 3D audio with a lot of functionality normally not found in this type of library. Please take a look at http://attr-x.net/yse There is also a demo available for windows and android. (There are some practical complications on iOS and Mac right now, but they will be sorted out soon).

Currently implemented are:

  • 3D sounds and effects
  • no limit on the number of simultanious sounds (as long as your cpu can handle it. On my nexus 5 i can render about 700 sounds, my desktop can do 4000)
  • multithreaded sound rendering, lock free
  • virtualisation support
  • localized reverb
  • sound occlusion
  • DSP filters and generators (also a lot of primitives to write your own classes)
  • flexible speaker setup, with multichannel support
  • automated resource management
  • virtual DSP synth's
  • midi support
  • midi file support

Next on the list are more 'time related concepts', like classes that can generate a musical idea over time (a bit like composers' desktop project), harmony functions, dissonance calculators etc.

I haven't set up a forum yet, but feedback is very welcome. 

regards,

yvan vander sanden


#2

smiley


#3

What he said! :D


#4

The Windows demo .exe gives (on Windows 7 64 bit) :

"The program can't start because d3dx9_42.dll is missing from your computer. Try reinstalling the program to fix this problem. "



#5

Ah yes. Well, I didn't make a full installer for a small demo. Otherwise I could have included the dll. It's just directX. I've used a game engine to create the demo, that's why.

If you don't know how to install it, try this: http://support.microsoft.com/kb/179113/en-gb

Thanks for trying though.

yvan

 

 

 


#6

It would have been no problem for me to install it, I'd just rather not, if it's required to be installed at the system level. (Could it work so that the DirectX dll is simply put at the same folder where your .exe is?) 

Thanks for posting about the project, it looks interesting and I might take a better look at it later!


#7

I don't think it will work by simply putting it the right folder. DirectX is a bit more complex than most dll's. Anyway, I cannot test that because all my computers have it installed.

Perhaps I'll release the console demo later on. It works without DirectX and can be found in the github repository. You could try compiling it yourself, but right now I'm the only one using the repository, so there might be some absolute paths that I forgot about in those solutions.


#9

I'll have to take a look as I was heavily involved with 3D audio and game audio engines for several years.


#10

OK the demo is pretty straightforward. I'm curious to know how you've done the 3D audio. I've not looked at the source code. Are you simply panning or using HRTF?

Are you planning on supporting consoles like Xbox or PS3/4?


#11

Thanks for testing it! I mostly ran the engine on my own machine, so yeah, there might be some issues to sort out. I'm currently working on something else, but I'll take a look at this soon and PM you if that's all right.

At first glance, I'd think it has either something to do with COM initialisation or your soundcard running at a frequency i don't expect.

 

BTW: Jules, I never get an email if someone answers to a message. I read this was an issue last year. Or isn't this working for anyone?

 

regards,

 

yvan

 


#12

Hey, it's not HRTF, although I will implement binaural support for headphones when I got the time. But it's not simple panning either, since the system also supports custom surround (you can enter the angle of every single speaker). I wrote the surround function a few years back and never got arround documenting it :-)

It's mostly this function, if you're interested:


void YSE::SOUND::implementationObject::toChannels() {

  for (UInt x = 0; x < buffer->size(); x++) {
    // calculate spread value for multichannel sounds
    Flt spreadAdjust = 0;
    if (buffer->size() > 1) spreadAdjust = (((2 * Pi / buffer->size()) * x) + (Pi / buffer->size()) - Pi) * spread;

    // initial panning
    for (UInt i = 0; i < parent->outConf.size(); i++) {
      parent->outConf[i].initPan = (1 + cos(parent->outConf[i].angle - (angle + spreadAdjust))) * 0.5f;
      parent->outConf[i].effective = 0;
      
      // effective speakers
      for (UInt j = 0; j < parent->outConf.size(); j++) {
        parent->outConf[i].effective += (1 + cos(parent->outConf[i].angle - parent->outConf[j].angle) * 0.5f);
      }

      // initial gain
      parent->outConf[i].initGain = parent->outConf[i].initPan / parent->outConf[i].effective;
    }

    // emitted power
    Flt power = 0;
    for (UInt i = 0; i < parent->outConf.size(); i++) {
      power += pow(parent->outConf[i].initGain, 2);
    }

    // calculated power
    Flt dist = distance - size;
    if (dist < 0) dist = 0;
    Flt correctPower = 1 / pow(dist, (2 * INTERNAL::Settings().rolloffScale));
    if (correctPower > 1) correctPower = 1;

    // final gain assignment
    for (UInt j = 0; j < parent->out.size(); ++j) {
      parent->outConf[j].ratio = pow(parent->outConf[j].initGain, 2) / power;
      channelBuffer = (*buffer)[x];
      parent->outConf[j].finalGain = sqrt(correctPower * parent->outConf[j].ratio);
      
      // add volume control now
      if (occlusionActive) parent->outConf[j].finalGain *= 1 - occlusion_dsp;
      dspFunc_calculateGain(j, x);
      channelBuffer *= fader();
      parent->out[j] += channelBuffer;
    }
  }
}

The algorithm itself was described in a paper which can be found here: http://www.dtic.mil/cgi-bin/GetTRDoc?AD=ADA464895


#13

About the demo being straightforward: the strength of the engine will not be the way it spacializes sound. I think it does a good job at that, but more interesting will be the concept of combining 3D sound with virtual synths, dsp objects and musical objects into one library.

I don't think Xbox and such will be supported. A first step would be support by juce, because I obiously use that as a backend to support multiple platforms.