Author Topic: BASS.NET API 2.4.12.7  (Read 783639 times)

ken

  • Posts: 739
Re: BASS.NET API 2.4.4.3
« Reply #625 on: 11 May '09 - 17:19 »
Bernd, I tested "BASS_Split_StreamCreate" but I get nothing to the Encoder (just create a zero size file). I get no errors on "clone channels"

I add my main mixer like this sice I have asio, and need it to run all the time.

Code: [Select]
_mixer = BassMix.BASS_Mixer_StreamCreate(MixerFreq, 2, BASSFlag.BASS_STREAM_DECODE | BASSFlag.BASS_MIXER_NONSTOP);

Add's streams like ths:
Code: [Select]

int _channel1 = Bass.BASS_StreamCreateFile(filename, 0L, 0L, BASSFlag.BASS_SAMPLE_FLOAT | BASSFlag.BASS_STREAM_DECODE);

BassMix.BASS_Mixer_StreamAddChannel(_mixer, _channel1, BASSFlag.BASS_MIXER_DOWNMIX | BASSFlag.BASS_STREAM_AUTOFREE | BASSFlag.BASS_MIXER_BUFFER);


And all works just fine. I can record to file just fine with "_mixer" But if I split the stream and try record from "clone1" It don't work

Code: [Select]
int _clone1 = BassMix.BASS_Split_StreamCreate(_mixer, BASSFlag.BASS_STREAM_DECODE, null);

Recorder is just like this:
Code: [Select]

EncoderTooLAME _tooLame = new EncoderTooLAME(_mixer);  //or clone1
_tooLame.InputFile = null;
_tooLame.OutputFile = _FileName;
_tooLame.TOO_Bitrate = BitRate;
_tooLame.Start(null, IntPtr.Zero, false);



I'm stuck...

/Ken

radio42

  • Posts: 4576
Re: BASS.NET API 2.4.4.3
« Reply #626 on: 14 May '09 - 09:58 »
Hi Ken,

when using the splitter you typically would always need to create 2 splitter streams.
_clone1 should then be used for the asio output
_clone2 might then be used for your encoder in parallel.

But I am not fully sure what you are trying to do.
Are you 'only' creating the clones to have the stream encoded without the WADSP processing in it?
If so, note, that the automatic encoding also just uses the DSP system with a default priority of -1000 to perform the encoding.
So it is actually not need to clone the stream:
If the encoder uses -1000 as the priority, simply use a WADSP priority of -1001 and the DSP will not be present in your encoded stream - as DSPs with a higher prioriry are executed first ;-)

ken

  • Posts: 739
Re: BASS.NET API 2.4.4.3
« Reply #627 on: 14 May '09 - 11:44 »
Bernd, here is a simple diagram of what I wanna do. How do I code that?

I attach an image.

/Ken

radio42

  • Posts: 4576
Re: BASS.NET API 2.4.4.3
« Reply #628 on: 14 May '09 - 12:21 »
Code: [Select]
// the main mixer
_mixer = BassMix.BASS_Mixer_StreamCreate(MixerFreq, 2, BASSFlag.BASS_SAMPLE_FLOAT |BASSFlag.BASS_STREAM_DECODE | BASSFlag.BASS_MIXER_NONSTOP);

// the two main outputs of the mixer
_out1 = BassMix.BASS_Split_StreamCreate(_mixer, BASSFlag.BASS_SAMPLE_FLOAT | BASSFlag.BASS_STREAM_DECODE, null);
_out2 = BassMix.BASS_Split_StreamCreate(_mixer, BASSFlag.BASS_SAMPLE_FLOAT | BASSFlag.BASS_STREAM_DECODE, null);

// on out1 you can now setup the Winamp DSP with prio. 0
// on out1 you can now also setup the Encoder1 with prio. -1000

// on out2 you can now also setup the Encoder2 with prio. -1000

// then you are using _out1 with your AsioHandler for Output1
// then you are using _out2 with your AsioHandler for Output2


// and finally the 3 mixer sources
int _channel1 = Bass.BASS_StreamCreateFile(filename1, 0L, 0L, BASSFlag.BASS_SAMPLE_FLOAT | BASSFlag.BASS_STREAM_DECODE);
int _channel2 = Bass.BASS_StreamCreateFile(filename2, 0L, 0L, BASSFlag.BASS_SAMPLE_FLOAT | BASSFlag.BASS_STREAM_DECODE);
int _channel3 = Bass.BASS_StreamCreateFile(filename3, 0L, 0L, BASSFlag.BASS_SAMPLE_FLOAT | BASSFlag.BASS_STREAM_DECODE);

BassMix.BASS_Mixer_StreamAddChannel(_mixer, _channel1, BASSFlag.BASS_MIXER_DOWNMIX | BASSFlag.BASS_STREAM_AUTOFREE | BASSFlag.BASS_MIXER_BUFFER);
BassMix.BASS_Mixer_StreamAddChannel(_mixer, _channel2, BASSFlag.BASS_MIXER_DOWNMIX | BASSFlag.BASS_STREAM_AUTOFREE | BASSFlag.BASS_MIXER_BUFFER);
BassMix.BASS_Mixer_StreamAddChannel(_mixer, _channel3, BASSFlag.BASS_MIXER_DOWNMIX | BASSFlag.BASS_STREAM_AUTOFREE | BASSFlag.BASS_MIXER_BUFFER);

ken

  • Posts: 739
Re: BASS.NET API 2.4.4.3
« Reply #629 on: 15 May '09 - 20:54 »
Thanks Bernd, The mixersplit works just fine. My falt I did't feed the asio handler with the new "_out1", I used the old "_mixer".


BWT, I could not use "Bass.BASS_ChannelSetFX(source, BASSFXType.BASS_FX_BFX_VOLUME_ENV, 0)." for changing volume during ofline mixing.

I did solve it like ths:

Code: [Select]


BASS_MIXER_NODE[] _FadeInAndOut =
                  {
                    new BASS_MIXER_NODE(Bass.BASS_ChannelSeconds2Bytes(_mixerStream, StartCue), 0),
                    new BASS_MIXER_NODE(Bass.BASS_ChannelSeconds2Bytes(_mixerStream, FadeTime), 1),

                    //FadeOut
                    new BASS_MIXER_NODE(Bass.BASS_ChannelSeconds2Bytes(_mixerStream, MixCue), 1),
                    new BASS_MIXER_NODE(Bass.BASS_ChannelSeconds2Bytes(_mixerStream, MixCue + FadeTime), 0)
                  };


BassMix.BASS_Mixer_ChannelSetEnvelope(_stream, BASSMIXEnvelope.BASS_MIXER_ENV_VOL, _FadeInAndOut);

BassMix.BASS_Mixer_ChannelSetPosition(_stream, Bass.BASS_ChannelSeconds2Bytes(_stream, StartCue));





« Last Edit: 16 May '09 - 09:07 by ken »

mitchjs

  • Posts: 15
Re: BASS.NET API 2.4.4.3
« Reply #630 on: 29 May '09 - 00:19 »
nevermind..duh on my part
« Last Edit: 29 May '09 - 00:56 by mitchjs »

ken

  • Posts: 739
Re: BASS.NET API 2.4.4.3
« Reply #631 on: 29 May '09 - 10:09 »
Bernd, I trying to get a nice VU meter, but as I read the doc you say that vaules for "LevelL" is

Quote
between 0 and 32768, or above, if a floating-point channel was selected)

I diud like this, but the VU don't look so good al the times. Any suggestion to make if flow better?

Code: [Select]

//Create stream
_stream = Bass.BASS_StreamCreateFile(FileName, 0, 0, BASSFlag.BASS_SAMPLE_FLOAT);

Code: [Select]

DSP_PeakLevelMeter _PeakLevelMeter = new DSP_PeakLevelMeter(_stream, 2000);
_PeakLevelMeter.CalcRMS = false;
_PeakLevelMeter.Notification += new EventHandler(_PeakLevelMeter_Notification);



Code: [Select]

//Result for VU meter in in Procent (0-100)

if (_PeakLevelMeter.LevelL > 32768)
 {
                _vu.VUvalueLeft = (int)(((double)_PeakLevelMeter.LevelL / 65535) * 100);
                _vu.VUvalueLeftHold = (int)(((double)_PeakLevelMeter.PeakHoldLevelL / 65535) * 100);
}
else
{
                _vu.VUvalueLeft = (int)(((double)_PeakLevelMeter.LevelL / 32768) * 100);
                _vu.VUvalueLeftHold = (int)(((double)_PeakLevelMeter.PeakHoldLevelL / 32768) * 100);
}


And last, can I delay the VU meters? It display the value before I hear the audio.  As I see it "PeakHoldLevelL" are on time but  "LevelL" show the value about 500 millisec. before I can here it. (same on Right channel ofcource)
« Last Edit: 29 May '09 - 10:33 by ken »

radio42

  • Posts: 4576
Re: BASS.NET API 2.4.4.3
« Reply #632 on: 29 May '09 - 11:26 »
The DSP_PeakLevelMeter class uses (as the name suggests) a DSPPROC to measure the levels.
So if your output is buffered, there might be a delay between the processing of the audio in the DSP and the output being heard.
As the DSPPROC doesn't know this latency it can not automatically compensate the delay.
But you might actually do it yourself.
E.g. if the latency is 500 ms (which sounds like you are using the default BASS_BUFFER settings) and you are getting the levels from the DSP_PeakLevelMeter every 100ms, you might store the 'last' 5 values in a circular buffer (array) and then use the 5th last value to display your meter UI control.
E.g.:
- define an array with 5 elements
  • ..[4]

- every 100ms get the new levels
- now move all array elements up: [1] becomes
  • , [2] becomes [1] etc. - element
  • will be removed/overwritten this way

- place the new level value at position [4]
- use the array element
  • to display your level value

ken

  • Posts: 739
Re: BASS.NET API 2.4.4.3
« Reply #633 on: 30 May '09 - 08:38 »
I made a webservice that convert to wma. Works great. But I tested on one server that not hade a soundcard. Without soundcard the wma is filesize 0. Is there a way to get this working on a computer without a soundcard?

Code: [Select]


Bass.Bass.BASS_Free();

        if (!Bass.Bass.BASS_Init(0, 44100, Bass.BASSInit.BASS_DEVICE_DEFAULT, IntPtr.Zero))
        {
            Console.Write("** Bass_Init Error!");
        }
        else
        {
            Bass.BASS_PluginLoad("basswma.dll");
            Console.Write("** Bass_Init OK!");
        }


int _streamConvert = Bass.BASS_StreamCreateFile(inpFile, 0, 0, BASSFlag.BASS_STREAM_DECODE);

            EncoderWMA _wma = new EncoderWMA(_streamConvert);
            _wma.InputFile = null;
            _wma.OutputFile = outputFile + ".WMA";
            _wma.WMA_Bitrate = bitRate;
            _wma.WMA_UseVBR = false;
            _wma.WMA_UseNetwork = false;
            _wma.WMA_UsePublish = false;
            _wma.Start(null, IntPtr.Zero, false);
            Utils.DecodeAllData(_streamConvert, true);


radio42

  • Posts: 4576
Re: BASS.NET API 2.4.4.3
« Reply #634 on: 30 May '09 - 12:29 »
Not really - are you getting any errors?
Is the Windows Media Player (and therewith the wma codec) installed on that machine?!

GambitKZ

  • Posts: 9
Re: BASS.NET API 2.4.4.3
« Reply #635 on: 2 Jun '09 - 13:53 »
I wrote it early, but nobody have answered, and I'm asking again:
I ask about analog "BassVideo_EncoderAudio" in Bass.Net, and radio42 wrote
The function "BassVideo_EncoderAudio" has actually been removed from the latest BassVideo version - that's why it has also been removed from the BASS.NET API....
And what method to use now for Extract Audio?
current version is support to work as bass plugin , you can do like bass write wav example
I'm made it like that:

Code: [Select]
int _VideoAudio = BassVideo.BASS_Video_StreamCreateFile(_FileName,
                BASSFlag.BASS_VIDEO_DISABLE_VIDEO | BASSFlag.BASS_STREAM_DECODE, null, IntPtr.Zero);
EncoderWAV w = new EncoderWAV(_VideoAudio);
w.InputFile = null;
w.OutputFile = "test.wav";
w.Start(null, IntPtr.Zero, false);
Utils.DecodeAllData(_VideoAudio, true);
w.Stop();

it's making "test.wav", but it's showing Window and making "test.wav" more bigger then it must be, and it's unreadable.
How to make "Wav" file from Video?

ken

  • Posts: 739
Re: BASS.NET API 2.4.4.3
« Reply #636 on: 2 Jun '09 - 18:03 »
Bernd, two new questions.

First, the "Visuals.CreateSpectrum" method, can I somehow set what frequencys I want to show the spectrum for. ex. 10kHz - 15kHz.

And second, I wanna cut all sound below a frequency and all sound over a frequency (ex. I just want to get 30Hz to 15kHz) , do I do that best with "BASS_BFX_PEAKEQ" or do you have any other suggestions.

/Ken

radio42

  • Posts: 4576
Re: BASS.NET API 2.4.4.3
« Reply #637 on: 8 Jun '09 - 18:49 »
Hi Ken,

you miht use the "MaxFrequencySpectrum" to define an upper limit. But there is no property to specify the lower limit.
E.g. use:
Code: [Select]
_vis.MaxFrequencySpectrum = Utils.FFTFrequency2Index(15000, _vis.MaxFFTData, _sampleRate);
to limit up to 15kHz.

Cutting frequencies can either be done by the EQ effect or the LowPass Filter of the BASS_FX add-on.

ken

  • Posts: 739
Re: BASS.NET API 2.4.4.3
« Reply #638 on: 9 Jun '09 - 09:27 »
Thanks Bernd,

Now next problem...   There is an extention for the BEXT (BWF) tag called CartChunk "cart". I have problems converting the C++ code to C#, so I can and use it with "BASS_Encode_AddChunk"

AES documentation is here: ftp://ftp.orban.com/Audicy/Cart_Chunk_AES46/

here is a application for viewing the "cart chunk" http://www.cartchunk.org/applicat.htm

Code: [Select]

//the tricky part is "CART_TIMER"

typedef struct cartchunk_tag
{
     DWORD ckID;
     DWORD ckSize;
     BYTE ckData[ckSize];
}
typedef struct cart_exetension_tag
{
     CHAR Version[4];
     CHAR Title[64];
     CHAR Artist[64];
     CHAR CutID[64];
     CHAR ClilentID[64];
     CHAR Category[64];
     CHAR Classification[64];
     CHAR OutCue[64];
     CHAR StartDate[10];
     CHAR StartTime[8];
     CHAR EndDate[10];
     CHAR EndTime[8];
     CHAR ProducerAppID[64];
     CHAR ProducerAppVersion[64];
     CHAR UserDef[64];
     DWORD dwLevelRefference
     CART_TIMER PostTimer[8];
     CHAR Reserved[276];
     CHAR URL[1024];
     CHAR TagText[];
} CART_EXTENSION;
typedef struct cart_timer_tag
{
     FOURCC dwUsage;
     DWORD dwValue;
} CART_TIMER


I love to see this in Bass.NET.

radio42

  • Posts: 4576
Re: BASS.NET API 2.4.4.3
« Reply #639 on: 9 Jun '09 - 10:27 »
I'll look into it - but don't expect that to be implemented within the next days or even at all, as this feature is natively not BASS related.

ken

  • Posts: 739
Re: BASS.NET API 2.4.4.3
« Reply #640 on: 9 Jun '09 - 11:39 »
I'll look into it - but don't expect that to be implemented within the next days or even at all, as this feature is natively not BASS related.

Thanks Bernd.

Here is how I add an WaveHeader to MP2 file and add "bext" and "cart" chunks. I stil having problems with "CART_TIMER". This code works exept for "CART_TIMER".

But since my code was to long for this forum, dowload it here: ...
« Last Edit: 24 Jun '09 - 15:28 by ken »

radio42

  • Posts: 4576
Re: BASS.NET API 2.4.4.3
« Reply #641 on: 10 Jun '09 - 15:00 »
In order to read the 'cart' chunk Ian would need to implement a new BASS_TAG_RIFF_CART flag...

ken

  • Posts: 739
Re: BASS.NET API 2.4.4.3
« Reply #642 on: 20 Jun '09 - 12:34 »
If I only open a saved Waveform with
Code: [Select]
WF.WaveFormLoadFromFile then I can't use
Code: [Select]
WF.Position2Frames(StartSeconds) when I draw the image with
Code: [Select]
WF.CreateBitmap (I only want a part of the audio displayed).

Lools like I must have and Bass stream to do that, well I havent. How can I calculate Frames from my Seconds?


radio42

  • Posts: 4576
Re: BASS.NET API 2.4.4.3
« Reply #643 on: 20 Jun '09 - 12:43 »
There doesn't need to be any stream present for these functions and it should all work without any - just tried it wiothout any issues.
So what is the actual problem with that function(s)?
Can you explain that a bit more...

Position2Frames can also be calculated like this:
// one frame = this.WaveBuffer.resolution milliseconds
frame = (int)(seconds / (double)this._waveBuffer.resolution);

However, note, that you might need to call 'SyncPlayback', if your playback stream and your rendering used different resolutions?

ken

  • Posts: 739
Re: BASS.NET API 2.4.4.3
« Reply #644 on: 20 Jun '09 - 13:00 »
Ok, I posted litle to quick. "Position2Frames" works just fine.

But when I set start/end frame (with or without using Position2Frames) in "WF.CreateBitmap", it works with "-1,-1"  or "-1, 200" or "60, 200".  But if I set endframe to -1 when startfram is not -1 (like "60, -1") that will not work for me.

And I do this without loading the audiofile. I only have the waveform saved to disk, can't do callbacks since it's on a webservice.

radio42

  • Posts: 4576
Re: BASS.NET API 2.4.4.4
« Reply #645 on: 22 Jun '09 - 10:35 »
22.06.2009: Version 2.4.4.4 is out!

BASS: added support for v2.4.3.1            
BASSenc: added support for v2.4.4.0
BASSWMA: added support for v2.4.2.0
BassWinamp: (re)added support for v2.4.0.0
General:
  - AddOn.Tags: support for BASS_TAG_RIFF_CART added

BASS.NET:
Full Install:
  www.un4seen.com/filez/4/Bass24.Net.zip

Lib only:
  www.un4seen.com/filez/4/Bass24.Net_update.zip

ken

  • Posts: 739
Re: BASS.NET API 2.4.4.4
« Reply #646 on: 25 Jun '09 - 08:58 »
I'm using "EncoderTooLAME" to convert, and I want the encoded file to be 48kHz (input file is 44.1kHz) but even if I init Bass with 48000, stilll the encoded file is 44.1

Can I some how change so the encoded file becomes 48k?

Code: [Select]

 _streamConvert = Bass.BASS_StreamCreateFile(inpFile, 0, 0, BASSFlag.BASS_STREAM_DECODE);

  EncoderTooLAME _tooLameBWF = new EncoderTooLAME(_streamConvert);
  _tooLameBWF.InputFile = null;
  _tooLameBWF.OutputFile = _outFile;
 _tooLameBWF.TOO_Bitrate = _bitRate;

  bool _retStart = _tooLameBWF.Start(null, IntPtr.Zero, false);
  Un4seen.Bass.Utils.DecodeAllData(_streamConvert, true);
  _tooLameBWF.Stop();


radio42

  • Posts: 4576
Re: BASS.NET API 2.4.4.4
« Reply #647 on: 25 Jun '09 - 10:05 »
First, the Bass_Init method does NOT define the sample rate being used by any output or stream! See the docs for more info!
Second, the TwoLame encoder does NOT support any internal resampling.

So in order to provide a general way to perform resampling you'll at best use the BASSmix add-on and create a mixer stream with the desired target samplerate (48kHz in your case).
Now you can create any decoding source stream and add that one to the mixer (your input in 44.1kHz acts as a source to the mixer).
BASSmix now performs an automatic resampling of the source samplerate to the mixers target samplerate.

Finally you setup your encoder on the mixer stream - which now encodes in 48kHz.

Something like:
Code: [Select]
int mixer = BassMix.BASS_Mixer_StreamCreate(48000, 2, BASSFlag.BASS_SAMPLE_FLOAT | BASS_STREAM_DECODE);
int streamConvert = Bass.BASS_StreamCreateFile(inpFile, 0, 0, BASSFlag.BASS_SAMPLE_FLOAT | BASSFlag.BASS_STREAM_DECODE);
BassMix.BASS_Mixer_StreamAddChannel(mixer, streamConvert, BASSFlag.BASS_MIXER_FILTER | BASSFlag.BASS_MIXER_NORAMPIN);

EncoderTooLAME tooLameBWF = new EncoderTooLAME(mixer);
tooLameBWF.InputFile = null;
tooLameBWF.OutputFile = _outFile;
tooLameBWF.TOO_Bitrate = _bitRate;

bool retStart = tooLameBWF.Start(null, IntPtr.Zero, false);
Un4seen.Bass.Utils.DecodeAllData(mixer, true);
tooLameBWF.Stop();

BassMix.BASS_Mixer_ChannelRemove(streamConvert);
Bass.BASS_StreamFree(streamConvert);
Bass.BASS_StreamFree(mixer);

ken

  • Posts: 739
Re: BASS.NET API 2.4.4.4
« Reply #648 on: 25 Jun '09 - 10:46 »
Thanks Bernd,

Some how it hangs on "Un4seen.Bass.Utils.DecodeAllData(mixer, true);"  But the file do get encoded and is 48000Hz.

radio42

  • Posts: 4576
Re: BASS.NET API 2.4.5.0
« Reply #649 on: 17 Aug '09 - 13:08 »
17.08.2009: Version 2.4.5.0 is out!

BASSenc: added support for v2.4.4.2
BASS_APE: added support for v2.4.0.4
BASS_MPC: added support for v2.4.1.0
BASSFLAC: added support for v2.4.0.3
BASS_AC3: added support for v2.4.0.2
BASS_ALAC: added support for v2.4.0.5
General:
  - some smaller Bug-Fixes
  - WaveWriter: new WriteNoConvert method added
  - WaveForm: some internal optimizations
  - Utils: DetectNextLevel method added and DetectCuePoints optimized
Breaking Changes:
  - EncoderWinampAACplus changed to support Winamp 5.33 or above enc_aacPlus.dll!
    Note: The AACPlus_* properties have been changed and you MUST use it with the latest Winamp enc_aacPlus.dll!

BASS.NET:
Full Install:
  www.un4seen.com/filez/4/Bass24.Net.zip

Lib only:
  www.un4seen.com/filez/4/Bass24.Net_update.zip

If you are using EncoderWinampAACplus make sure to also update:
  www.un4seen.com/filez/4/enc_aacPlus.zip