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

PapaBearPW

  • Posts: 50
Re: BASS.NET API 2.4.9.1
« Reply #1125 on: 4 Oct '12 - 11:56 »
OPUS always uses 48kHz as the traget sample rate and performs resampling internally if necessary - so for OPUS this option doesn't exist.

The other encoders you mentioned also doesn't support any internal sample rate conversion (resampling).
Which means the encoders can only use the sample rate as the provided stream is having.
If you want to (re)encode an existing stream to a different sample rate, you must provide the encoder with resampled data yourself.

Doing so is easy, as you can use the BASSmixx add-on.
Create a mixer stream with the desired target sample rate and add your original stream as a decoding one to that mixer stream (as a source).
Then use the mixer stream for decoding.
BASSmix in that case performs the resampling for you.

The OGG encoder is the only encoder which natively supports resampling internally, that's why this encoder offers such option itself.

I see. Thank you. OGG and LAME were the only ones I saw that had that option. I already use BASSmix so, I can't believe I hadn't thought of that before. So I could basically create a new mixer stream for each encoder at whatever sample rate I desire and feed the main mixer stream into it. Sounds like a plan. :)

radio42

  • Posts: 4576
Re: BASS.NET API 2.4.9.1
« Reply #1126 on: 4 Oct '12 - 17:01 »
@HarryHar:
No, that is currently by design - as any markers at the exact same position are drawn in the same way.
I'll see, if that can be changed - not sure yet.

ken

  • Posts: 739
Re: BASS.NET API 2.4.9.1
« Reply #1127 on: 15 Oct '12 - 08:40 »
Hi,

I need to convert a audiofile on a webserver to a new file.

The file plays fine with BASS_StreamCreateURL, but how do I feed EncoderLAME? If I could do it faster than 1x it would be good (like when I use BaseEncoder.EncodeFile)

Thanks!

/Ken

radio42

  • Posts: 4576
Re: BASS.NET API 2.4.9.1
« Reply #1128 on: 15 Oct '12 - 14:16 »
Why couldn't you use "BaseEncoder.EncodeFile"?
E.g. something like this should work:
Code: [Select]
int stream = Bass.BASS_StreamCreateURL(url, 0, BASSFlag.BASS_STREAM_DECODE | BASSFlag.BASS_SAMPLE_FLOAT, null, IntPtr.Zero);
EncoderLAME lame = new EncoderLAME(stream);
...
BaseEncoder.EncodeFile(lame, null, true, false);
Note, the encoder speed however might still be restricted to the download speed of your BASS_StreamCreateURL call!

ken

  • Posts: 739
Re: BASS.NET API 2.4.9.1
« Reply #1129 on: 15 Oct '12 - 14:35 »
Why couldn't you use "BaseEncoder.EncodeFile"?
E.g. something like this should work:
Code: [Select]
int stream = Bass.BASS_StreamCreateURL(url, 0, BASSFlag.BASS_STREAM_DECODE | BASSFlag.BASS_SAMPLE_FLOAT, null, IntPtr.Zero);
EncoderLAME lame = new EncoderLAME(stream);
...
BaseEncoder.EncodeFile(lame, null, true, false);
Note, the encoder speed however might still be restricted to the download speed of your BASS_StreamCreateURL call!

 That works great.   Thanks! Sorry I have to read the docs better ;-)

ken

  • Posts: 739
Re: BASS.NET API 2.4.9.1
« Reply #1130 on: 17 Oct '12 - 16:32 »
Hi,

Need lile help on Gain.

I scan my file with GetNormalizationGain like this:
Code: [Select]
public float GetAudioGain(string filename)
{
   float _peak = 0;

   return = Un4seen.Bass.Utils.GetNormalizationGain(filename, 1, -1, -1, ref _peak);

}

I apply tha value "gain" during playback with "Gain_dBV" on DSP_Gain

Now I want to show the gain in my WaveForm, using "GainFactor", but the WaveForm becoms way to big...

Am I on the right track here with gain, or. Please advice.

/Ken

radio42

  • Posts: 4576
Re: BASS.NET API 2.4.9.1
« Reply #1131 on: 17 Oct '12 - 17:08 »
Can you please confirm what value your GetAudioGain method returns in that case.
And how are you using that with the WaveForm?
It should be something like this:
Code: [Select]
float gain = GetAudioGain(filename);
...
waveForm.GainFactor = gain;

Also your method looks a bit strange:
Code: [Select]
return = Un4seen.Bass.Utils.GetNormalizationGain(filename, 1, -1, -1, ref _peak);Shouldn't that be:
Code: [Select]
return Un4seen.Bass.Utils.GetNormalizationGain(filename, 1, -1, -1, ref _peak);

ken

  • Posts: 739
Re: BASS.NET API 2.4.9.1
« Reply #1132 on: 17 Oct '12 - 17:30 »
Hi,

Sorry typo, should be like this and it returns values. (like 1.0 or 1.142 and so on depending on the song, new songs often returns 1.0)

Code: [Select]
return Un4seen.Bass.Utils.GetNormalizationGain(filename, 1, -1, -1, ref _peak);


Should I use "Gain" instead of "Gain_dBV" on DSP_Gain when I playback the song?  I tested that and then "GainFactor" on WaveForm looks more realistic.

/Ken

radio42

  • Posts: 4576
Re: BASS.NET API 2.4.9.1
« Reply #1133 on: 18 Oct '12 - 08:42 »
Yes, you must use the "DSP_Gain.Gain" property, as the "Gain_dBV" property expects dB values and not a linear amplification value as returned by GetNormalizationGain.

Ivan.Tsarevich

  • Posts: 5
Re: BASS.NET API 2.4.9.1
« Reply #1134 on: 24 Oct '12 - 14:29 »
Hi!

Can anyone help me about EvalNativeTAGs field in AddOn.Tags.BassTags namespace?
I'm tryin' to store my custom tag in the file, but have no luck. Any point to do it?

Thanx!

radio42

  • Posts: 4576
Re: BASS.NET API 2.4.9.1
« Reply #1135 on: 25 Oct '12 - 08:33 »
Bass and Bass.Net doesn't support TAG writing!
It's all there only about reading existing TAGs.

Ivan.Tsarevich

  • Posts: 5
Re: BASS.NET API 2.4.9.1
« Reply #1136 on: 26 Oct '12 - 11:03 »
Bass and Bass.Net doesn't support TAG writing!
It's all there only about reading existing TAGs.

 :o Thats strange. For developer - if you can read, edit, add, then it is logical to can write.

Anyway, i have more ideas for next releases of bass.net

Issue-report-1 : tags with non-unicode non-latin encoding reads in wrong encoding. I can send you a sample mp3 with win1251(?) + correct unicode text. Can i attach it here?

Issue-report-2 : I have seen the "Simple" sample about Un4seen.Bass.Misc.WaveForm. With normal Bass-out its all OK!
But, When the source for WaveForm is a file, added to BassMix. A) Clicks on WaveForm PictureBox reports wrong position for "cursor" - a twice lefter than real click. B) Zoomed image show wrong part of song. C) Using of any type of Spectrum makes the song play dirty with wrong tempo (a twice faster with pauses). D) Code on line 503 inside "if (WF2 != null && WF2.IsRendered)" - looks like never be reached.

I have a little rewrites this sample for last Bass.Net, VS2012, .Net FW4.5
Significal fragments:
Code: [Select]
//...........
//Init:
Bass.BASS_Init(1, 44100, BASSInit.BASS_DEVICE_DEFAULT, IntPtr.Zero);
mixerA = BassMix.BASS_Mixer_StreamCreate(44100, 2, BASSFlag.BASS_DEFAULT | BASSFlag.BASS_MUSIC_FLOAT | BASSFlag.BASS_SAMPLE_FLOAT);

//..............
//PlayButton:
{
  stream1 = Bass.BASS_StreamCreateFile(".\\testA.mp3", 0, 0, BASSFlag.BASS_STREAM_DECODE | BASSFlag.BASS_SAMPLE_FLOAT);
  stream2 = Bass.BASS_StreamCreateFile(".\\testB.mp3", 0, 0, BASSFlag.BASS_STREAM_DECODE | BASSFlag.BASS_SAMPLE_FLOAT);
  bool okA = BassMix.BASS_Mixer_StreamAddChannel(mixerA, stream1, BASSFlag.BASS_DEFAULT);
  bool okB = BassMix.BASS_Mixer_StreamAddChannel(mixerA, stream2, BASSFlag.BASS_DEFAULT);

  Bass.BASS_ChannelPlay(mixerA, false);
  GetWaveForm();
  if (WF2 != null && WF2.IsRendered)
  {
WF2.SyncPlayback(stream1);
        //..... same to you
  }
}
//........
// GetWaveForm same to you, but:
WF2 = new WaveForm(".\\testA.mp3", new WAVEFORMPROC(MyWaveFormCallback), this);

Radio42, Thanx you in advance
« Last Edit: 26 Oct '12 - 11:09 by Ivan.Tsarevich »

radio42

  • Posts: 4576
Re: BASS.NET API 2.4.9.1
« Reply #1137 on: 26 Oct '12 - 12:38 »
Quote
Issue-report-1 : tags with non-unicode non-latin encoding reads in wrong encoding. I can send you a sample mp3 with win1251(?) + correct unicode text. Can i attach it here?
You can, but I doubt, that this makes much sense, as e.g. the ID3v2 standard clearly defines the encoding rules.
The issue is more, that some tagger applications don't care and instead use their own code-page!
This is typically an error of the tagger and not of Bass or Bass.Net.
However, not, that there is a general option available to change this.

See the global BassNet.UseBrokenLatin1Behavior property!
Gets or Sets whether or not to use a broken behavior for Latin-1 strings (e.g. common to ID3v1 and ID3v2 tags).
Many media players and taggers incorrectly treat Latin-1 fields as "default encoding" fields. As such, a tag may end up with Windows-1250 resp. Windows-1252 encoded text.
Set this property to true to use the broken latin-1 behaviour.



Quote
Issue-report-2: WaveForm
This is also not an issue, as its already availble.
See the WaveForm.SyncPlayback and/or the WaveForm.SyncFactor property for details.
Sets a playback channel to synchronize the wave form positions.
This is mostly due to the fact, that you use a different 'resolution' for rendering the wave form (e.g. 16-bit) as for the playback (e.g. 32-bit).
So the "SyncPlayback" method takes care of that.

This is exactly the case in your example:
The wave form gets rendered in 16-bit, but your playback is in 32-bit.
So you have 2 options:
a) Call "WF2.RenderStart" as well with the BASS_SAMPLE_FLOAT flag!
or
b) Call "WF2.SyncPlayback(stream1)"

As you are doing b) in your example, I guess this code is never really called - e.g. you are doing this is a background thread.
Unfortunally is your call to RenderStart missing in the code sample.
Typically you should call "SyncPlayback" in your callback delegate (MyWaveFormCallback) once rendering has finished.
Something like this:
Code: [Select]
private void MyWaveFormCallback(int framesDone, int framesTotal, TimeSpan elapsedTime, bool finished)
{
    if (finished && _waveForm != null)
    {
        _waveForm.SyncPlayback(_mixerSourceStream);
    }
...
}

Ivan.Tsarevich

  • Posts: 5
Re: BASS.NET API 2.4.9.1
« Reply #1138 on: 26 Oct '12 - 15:54 »
This is also not an issue, as its already availble.

Thanx you for your fast answer, radio42! I'll try your recomendations and report  :)

As you are doing b) in your example, I guess this code is never really called - e.g. you are doing this is a background thread.

(Actually, your samples in SDK is out of date, we need new and more!=) )

Dimman

  • Posts: 12
Re: BASS.NET API 2.4.9.1
« Reply #1139 on: 9 Nov '12 - 11:11 »
Hello.
I have two questions  :)

1. I've just read this:
http://msdn.microsoft.com/en-us/library/windows/desktop/hh749939.aspx
Can I certify my desktop app (using BASS.NET)? Section 3.1: "Your app must not use AllowPartiallyTrustedCallersAttribute (APTCA) to ensure secure access to strong-named assemblies". As I see in Bass.Net.dll - there "AllowPartiallyTrustedCallersAttribute" string is exists... And what about the remaining paragraphs? Will it be compatible in future versions?

2. And I have a problem with recorder after update BASS.NET to 2.4.9.1 from 2.4.8.6 and bass.dll to 2.4.9.0 from 2.4.8.1. On some users machines BASS_RecordGetInputName can't get any input names. It worked fine everywhere with old bass version, but after update it not works on some machines (Windows 7). On my Win8 all versions works fine. What may be the problem is related? Here is the code:
Code: [Select]
        private void comboDevices_SelectedIndexChanged(object sender, EventArgs e)
        {
            Bass.BASS_RecordFree();
            comboInput.Items.Clear();
            if (comboDevices.SelectedIndex < 0) return;
            if (!Bass.BASS_RecordInit(comboDevices.SelectedIndex))
            {
                ShowError("RecorderErrorInitDevice");
                return;
            }
           
            for (int c = 0; Bass.BASS_RecordGetInputName(c) != null; c++)
            {
                comboInput.Items.Add(Bass.BASS_RecordGetInputName(c));
                if ((Bass.BASS_RecordGetInput(c) & BASSInput.BASS_INPUT_OFF) == 0) comboInput.SelectedIndex = c;
            }
            if (comboInput.Items.Count == 0)
                ShowError("RecorderErrorGetInput"); // this shows after update on some machines!
        }

Thank you in advance!
« Last Edit: 9 Nov '12 - 11:21 by Dimman »

radio42

  • Posts: 4576
Re: BASS.NET API 2.4.9.1
« Reply #1140 on: 9 Nov '12 - 14:51 »
Yes, Bass.Net currently still has the AllowPartiallyTrustedCallers attribute applied - this to support all ASP.Net developers.
Removing that attribute wouldn't allow any partially trusted apps (callers), like when running in an ASP.Net environment, to use Bass.Net - basically because almost all code inside Bass.Net is almost "security-critical" - since we almost always invoke unmanaged code (P/Invoke to the native bass.dll).
That's also the reason, why Bass.Net is a 'Transparency Level 1' assembly.

Dimman

  • Posts: 12
Re: BASS.NET API 2.4.9.1
« Reply #1141 on: 9 Nov '12 - 21:19 »
Thanks, radio42. And what about other questions?

radio42

  • Posts: 4576
Re: BASS.NET API 2.4.9.1
« Reply #1142 on: 9 Nov '12 - 21:23 »
I'lL take a look, if the APTCA might be removed in the next release.

Not sure about your 2. question (enum of recording devices)- Bass.Net hasn't changed there.

Dimman

  • Posts: 12
Re: BASS.NET API 2.4.9.1
« Reply #1143 on: 9 Nov '12 - 21:26 »
Thanks again! :) Maybe there is something changed in bass.dll...

Starstruck

  • Posts: 5
Re: BASS.NET API 2.4.9.1
« Reply #1144 on: 18 Nov '12 - 12:15 »
Hi Bernd , i really like the VU meters and fader you are using, are these something you developed using DevExpress, some other component or something you developed your self .

I would really like to use something similar in a project Im thinking about (but only if they are not copyrighted) .

Thanks
Starstruck

radio42

  • Posts: 4576
Re: BASS.NET API 2.4.9.1
« Reply #1145 on: 18 Nov '12 - 12:21 »
You mean the level meters, faders within ProppFrexx?
If yes, they are all self developed.
But currently not freely available.
I might think about building a UI component out of it.

Starstruck

  • Posts: 5
Re: BASS.NET API 2.4.9.1
« Reply #1146 on: 18 Nov '12 - 12:54 »
You mean the level meters, faders within ProppFrexx?
If yes, they are all self developed.
But currently not freely available.
I might think about building a UI component out of it.

Yes, thats exactly what I mean  :)

I had a feeling they were self developed, they are really good, well done :)

Building a UI component would be a great idea, Im sure many other people would be interested as there isnt much available on the market and most people seem to end up using a progress bar.

Thanks
Starstruck

ken

  • Posts: 739
Re: BASS.NET API 2.4.9.1
« Reply #1147 on: 24 Nov '12 - 09:39 »
You mean the level meters, faders within ProppFrexx?
If yes, they are all self developed.
But currently not freely available.
I might think about building a UI component out of it.

I be happy to bay some $$ for your level meters and faders as a .NET UI component.

/Ken

HarryHar

  • Posts: 147
Re: BASS.NET API 2.4.9.1
« Reply #1148 on: 16 Dec '12 - 20:32 »
Please Ignore. Problem was an old BassFx.dll  :-X




When I compile this piece of code in Debug mode, the code runs perfect.

Code: [Select]
static void Main(string[] args)
{
Bass.BASS_Init(0, 44100, 0, IntPtr.Zero);

int stream = Bass.BASS_StreamCreateFile(@"C:\test.mp3", 0, 0, BASSFlag.BASS_STREAM_DECODE);
if (stream != 0)
{
float newBPM = BassFx.BASS_FX_BPM_DecodeGet(stream, 0, 0, 0, BASSFXBpm.BASS_FX_BPM_BKGRND | BASSFXBpm.BASS_FX_FREESOURCE | BASSFXBpm.BASS_FX_BPM_MULT2, null, IntPtr.Zero);
Console.Write(newBPM.ToString());
}

Bass.BASS_Free();
}

Where I change the output to Release, I get :

A call to PInvoke function 'Bass.Net!Un4seen.Bass.AddOn.Fx.BassFx::BASS_FX_BPM_DecodeGet' has unbalanced the stack. This is likely because the managed PInvoke signature does not match the unmanaged target signature. Check that the calling convention and parameters of the PInvoke signature match the target unmanaged signature.
« Last Edit: 16 Dec '12 - 20:40 by HarryHar »

cezar.mr

  • Posts: 9
Re: BASS.NET API 2.4.9.1
« Reply #1149 on: 8 Jan '13 - 20:41 »
Hello,

I've managed some troubles trying to download Bass24.Net.zip from un4seen servers. No matter if I were downloading it from UK or US, it always have been stucking at 19.5MB...
Can somebody try to fix this?
I'd be greatfull if somebody for now could give me some another link to this file.
Thanks a lot.