Results 1 to 4 of 4

Thread: crossover...

  1. #1

    crossover...

    ive started my sound system and have a simple engine simulation running (can be heard here ). at the moment its using 2 samples 1 for idle and 1 for high revs, but i think it will sound better with 3 samples.

    im having trouble figuring out the maths to make sample 1 get quieter as the revs increase (2500 + ), sample 2 gets louder towards middle revs (lets say 5000) and quieter as it goes past those revs as sample 3 gets louder as it gets to full revs (10,000)

    anyone understand?

  2. #2

    crossover...

    Could not you record a whole sequence for a real engine and play the according part when needed?
    http://3das.noeska.com - create adventure games without programming

  3. #3

    crossover...

    dont have access to real engines but ive done it! ill post source code on how i did it (and a screenshot) when ive finished tidying up

    i always jump into things over thinking everything

  4. #4

    crossover...

    the maths wasnt bad at all in the end, i just needed to think harder

    here is how to do a cross over with 3 (easy to put more in ) samples

    [pascal] // sample 1
    if iEngineRPM <= iSample1RPM then
    sSample1Volume := iEngineRPM;// iSample1RPM + (iEngineRPM - iSample1RPM);

    if iEngineRPM > iSample1RPM then
    sSample1Volume := iSample1RPM - (iEngineRPM - iSample1RPM);


    // sample 2
    if (iEngineRPM <= iSample2RPM)
    and (iEngineRPM - iSample2RPM < (iSample2RPM shr 1))
    and (iEngineRPM - (iSample1RPM shr 1) > 0) then
    sSample2Volume := (iSample2RPM + (iEngineRPM - iSample2RPM) - (iSample1RPM shr 1));

    if (iEngineRPM > iSample2RPM) and (iEngineRPM - (iSample1RPM shr 1) > 0) then
    sSample2Volume := (iSample2RPM - (iEngineRPM - iSample2RPM) - (iSample1RPM shr 1));


    // sample 3
    if (iEngineRPM <= iSample3RPM)
    and (iEngineRPM - iSample3RPM < (iSample3RPM shr 1))
    and (iEngineRPM - (iSample2RPM shr 1) > 0) then
    sSample3Volume := (iSample3RPM + (iEngineRPM - iSample3RPM) - (iSample2RPM shr 1));

    if (iEngineRPM > iSample3RPM) and (iEngineRPM - (iSample2RPM shr 1) > 0) then
    sSample3Volume := (iSample3RPM - (iEngineRPM - iSample3RPM) - (iSample2RPM shr 1));


    // updating
    AlSourcef(source1, AL_GAIN, sSample1Volume / (iMaxRPM shr 1));
    AlSourcef(source2, AL_GAIN, sSample2Volume / (iMaxRPM shr 1));
    AlSourcef(source3, AL_GAIN, sSample3Volume / (iMaxRPM shr 1));

    AlSourcef ( source1, AL_PITCH, iEngineRPM / (iMaxRPM shr 1));
    AlSourcef ( source2, AL_PITCH, iEngineRPM / (iMaxRPM shr 1));
    AlSourcef ( source3, AL_PITCH, iEngineRPM / (iMaxRPM shr 1));[/pascal]

    that sounds much much better then the last method i was using

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Comodo SSL