Author Topic: BASS_ATTRIB_TEMPO_FREQ sound problem  (Read 1420 times)

muntablues

  • Posts: 196
BASS_ATTRIB_TEMPO_FREQ sound problem
« on: 8 Sep '10 - 23:35 »
Hi

I have a crazy problem after changing sample rate. It works fine on most PC but one user has real problems with it. If he makes pause and play it sound ok for some ms. I told him to increase the Buffer to 500 but it is only working for half a second or so after pause -> play.

I know many Systems using my SW but none of them has this problem. This user has 4 PCs and not any works!

Here is what I am going:
Code: [Select]

void load()
{
            buffer = File.ReadAllBytes(filename);
            long length = buffer.LongLength;
            _hGCFile = GCHandle.Alloc(buffer, GCHandleType.Pinned);

            if (fileinfo.Extension.ToLower() == ".wma")
                stream = BassWma.BASS_WMA_StreamCreateFile(_hGCFile.AddrOfPinnedObject(), 0, length, BASSFlag.BASS_STREAM_DECODE | BASSFlag.BASS_SAMPLE_FLOAT |BASSFlag.BASS_STREAM_PRESCAN);
            else
                stream = Bass.BASS_StreamCreateFile(_hGCFile.AddrOfPinnedObject(), 0, length, BASSFlag.BASS_STREAM_DECODE | BASSFlag.BASS_SAMPLE_FLOAT | BASSFlag.BASS_STREAM_PRESCAN);
            if (stream >= 0)
                throw new Exception("Konnte File: " + filename + " nicht laden");
            stream = BassFx.BASS_FX_ReverseCreate(stream, 2f, BASSFlag.BASS_STREAM_DECODE | BASSFlag.BASS_SAMPLE_FLOAT);
            Bass.BASS_ChannelSetAttribute(stream, BASSAttribute.BASS_ATTRIB_REVERSE_DIR, 1f);
            //setPosition(0.02);
            BASSError er = Bass.BASS_ErrorGetCode();
            stream_EQ = Bass.BASS_ChannelSetFX(stream, BASSFXType.BASS_FX_BFX_PEAKEQ, 100);
            stream_dynamp = Bass.BASS_ChannelSetFX(stream, BASSFXType.BASS_FX_BFX_DAMP, 10);
            stream_tempo = BassFx.BASS_FX_TempoCreate(stream, BASSFlag.BASS_STREAM_DECODE | BASSFlag.BASS_SAMPLE_FLOAT | BASSFlag.BASS_SAMPLE_SOFTWARE);
           
}

void SetPitch(float pitch)
{
    float p = channel_info.freq * pitch / 100;
    bool ok = Bass.BASS_ChannelSetAttribute(stream_tempo, BASSAttribute.BASS_ATTRIB_TEMPO_FREQ, channel_info.freq + p);
}

After this I feed stream_tempo to a mixer.

And here is a recorded sample. http://digijay.kilu.de/temp/2010-09-08_22h43m28.mp3

If you need more code, please let me know.

Thanks for help!

MB

radio42

  • Posts: 4576
Re: BASS_ATTRIB_TEMPO_FREQ sound problem
« Reply #1 on: 9 Sep '10 - 08:45 »
That really sounds strange - seems to be a BASS_FX or soundcard issue?!

One note though:
Code: [Select]
if (stream >= 0)
    throw new Exception("Konnte File: " + filename + " nicht laden");
Doesn't look quite right and should be:
Code: [Select]
if (stream == 0)
    throw new Exception("Konnte File: " + filename + " nicht laden");

muntablues

  • Posts: 196
Re: BASS_ATTRIB_TEMPO_FREQ sound problem
« Reply #2 on: 9 Sep '10 - 11:17 »
Ok that was a mistake of mine, but I think that can not be the problem...

I have no idea what is going wrong. This user has got 4 PCs and all has the same problem. What about DirectX, is it necessary for this function? I have testet many PCs and all worked great.

I could send him an old bass_fx.dll, just for test...

Thanks MB

(: JOBnik! :)

  • Posts: 1065
Re: BASS_ATTRIB_TEMPO_FREQ sound problem
« Reply #3 on: 10 Sep '10 - 12:49 »
Hi ;D

Please try creating first the Tempo stream and then the Reversed stream.

muntablues

  • Posts: 196
Re: BASS_ATTRIB_TEMPO_FREQ sound problem
« Reply #4 on: 10 Sep '10 - 12:55 »
TU

I am going to try this... I will give you information.

MB

radio42

  • Posts: 4576
Re: BASS_ATTRIB_TEMPO_FREQ sound problem
« Reply #5 on: 10 Sep '10 - 12:56 »
Quote
try creating first the Tempo stream and then the Reversed stream
Would that make any differences?
Is it recommended to use it in that order (source -> tempo -> reverse) ?

muntablues

  • Posts: 196
Re: BASS_ATTRIB_TEMPO_FREQ sound problem
« Reply #6 on: 13 Sep '10 - 19:51 »
I removed reverse stream creation at all but it didn't solve the problem.

Any other suggestion?

Thanks MB

muntablues

  • Posts: 196
Re: BASS_ATTRIB_TEMPO_FREQ sound problem
« Reply #7 on: 13 Sep '10 - 21:54 »
Problem solved! Somewhere in my code was a mistake. I set wrong parameter...

Sorry

MB