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

DoctorDangerous

  • Posts: 33
max BPM?
« Reply #1175 on: 18 Apr '13 - 23:51 »
I have got beat detection working, but it seems to max out around 600 BPM. I am procession some speed drummers, so I need to capture up to 2000 BPM. can this be done?

Chris

  • Posts: 1810
Re: BASS.NET API 2.4.10.1
« Reply #1176 on: 18 Apr '13 - 23:57 »
try to change the minMaxBPM Value.....in the BASS_FX_BPM_DecodeGet/BASS_FX_BPM_CallbackSet Call

DoctorDangerous

  • Posts: 33
Re: BASS.NET API 2.4.10.1
« Reply #1177 on: 19 Apr '13 - 10:21 »
I am using the following code, which doesn't seem to have those parameters:
            // start recording paused
            _myRecProc = new RECORDPROC(MyRecording);
            _recHandle = Bass.BASS_RecordStart(44100, 2, BASSFlag.BASS_RECORD_PAUSE, _myRecProc, new IntPtr(_encHandle));

            //start beat detection
            _myBeatProc = new BPMBEATPROC(MyBeatDetection);
            BassFx.BASS_FX_BPM_BeatCallbackSet(_recHandle, _myBeatProc, new IntPtr(_encHandle));

How would I set the minMaxBPM in this case?

Chris

  • Posts: 1810
Re: BASS.NET API 2.4.10.1
« Reply #1178 on: 19 Apr '13 - 11:26 »
minmaxbpm are only available in the BPM Stuff
Code: [Select]
BASS_FX_BPM_DecodeGet)(DWORD chan, double startSec, double endSec, DWORD minMaxBPM, DWORD flags, BPMPROCESSPROC *proc);
Code: [Select]
BASS_FX_BPM_CallbackSet)(DWORD handle, BPMPROC *proc, double period, DWORD minMaxBPM, DWORD flags, void *user);and not in the beat stuff





DoctorDangerous

  • Posts: 33
Re: BASS.NET API 2.4.10.1
« Reply #1179 on: 19 Apr '13 - 12:39 »
That's what I was just realising. But I'm using a live stream, so I need to detect beats as they happen (i.e. drum hits), which the current code is doing pretty well, until the drummer reaches a certain speed, which seems to be about 600 beats per min. Any higher speed and no beats are detected.

mmrfunk

  • Posts: 4
Re: BASS.NET API 2.4.10.1
« Reply #1180 on: 29 Apr '13 - 16:25 »
Strangely bassAsio isn't compatible yet with the new bass.net:

An incorrect version of BASSASIO was loaded!
Version loaded: 1.3
Version expected: 1.2

(64bit, on win 8 )
bass.dll : 2.4.10.0  : modified : 19/02/2013 18:16
bass.net: 2.4.10.1 : modified: 15/04/2013 11:30
bassasio: 1.3.0.0   : modified: 17/04/2013 17:03

Is this correct or am I missing something?

radio42

  • Posts: 4576
Re: BASS.NET API 2.4.10.1
« Reply #1181 on: 30 Apr '13 - 08:48 »
Please try to re-download the updated zip and replace the Bass.Net.dlls into your installation folder - it should be fixed them!

www.un4seen.com/filez/4/Bass24.Net_update.zip


radio42

  • Posts: 4576
Re: BASS.NET API 2.4.10.2
« Reply #1182 on: 14 Jun '13 - 09:17 »
13.06.2013: Version 2.4.10.2 is out!

BASS_FX: added support for v2.4.10.1
BASSmidi: added support for v2.4.8.0

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

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

esasse

  • Posts: 32
Re: BASS.NET API 2.4.10.2
« Reply #1183 on: 13 Jul '13 - 16:33 »
This is the first time I try BASS.NET, and I'm trying to create an iOS app using Xamarin Studio. I added a Native Reference do Bass.Net.iOS.dll and then tried using the Un4seen.Bass namespace, but I only get error that the namespace could no be found.

Am I missing any step? Thanks.

esasse

  • Posts: 32
Re: BASS.NET API 2.4.10.2
« Reply #1184 on: 13 Jul '13 - 16:43 »
Forget it, just figured out that I should not add a "Native Reference", but edit the "References" and then add BASS.NET there. I'm new to Xamarin Studio too, sorry. :)

esasse

  • Posts: 32
Re: BASS.NET API 2.4.10.2
« Reply #1185 on: 16 Jul '13 - 02:16 »
Does anyone have a sample Xamarin Studio solution using BASS.NET on iOS?

I've added a reference to Bass.Net.iOS.dll and a native reference to libbass.a, but when I try to build to debug on the device, I get:

Quote
Error MT5201: Native linking failed. Please review user flags provided to gcc: "-L/Users/erick/Downloads/bass24-iphone" "-lbass" -force_load "/Users/erick/Downloads/bass24-iphone/libbass.a" (MT5201)

When I try to debug using the simulator, I get the following error:

Quote
System.TypeInitializationException: An exception was thrown by the type initializer for Un4seen.Bass.Bass ---> System.Exception: You are using an unregistered version of BASS.NET!
  at Un4seen.Bass.Bass..cctor () [0x00000] in <filename unknown>:0
  --- End of inner exception stack trace ---
  at HelloXB.AppDelegate.FinishedLaunching (MonoTouch.UIKit.UIApplication app, MonoTouch.Foundation.NSDictionary options) [0x00000] in /Users/erick/Projects/HelloXB/HelloXB/AppDelegate.cs:28
  at at (wrapper managed-to-native) MonoTouch.UIKit.UIApplication:UIApplicationMain (int,string[],intptr,intptr)
  at MonoTouch.UIKit.UIApplication.Main (System.String[] args, System.String principalClassName, System.String delegateClassName) [0x0004c] in /Developer/MonoTouch/Source/monotouch/src/UIKit/UIApplication.cs:38
  at HelloXB.Application.Main (System.String[] args) [0x00000] in /Users/erick/Projects/HelloXB/HelloXB/Main.cs:16

serkanp

  • Posts: 67
bass.net a very basic streamserver example..
« Reply #1186 on: 17 Jul '13 - 15:52 »
Dear friends,
i am going to loose my eyes reading tones of forum topics.. and still i dont have enough knowledge about how to build a shoutcast or similar stream server that uses a playlist..

simply, i need a very dummy code (there is no sample in bass.net samples)
i have a playlist, i want to stream it to my clients.. all clients will play the same thing at the same time..

please help me, or "the developers of the bass.net component " please write a sample code and put it in your setup...

radio42

  • Posts: 4576
Re: BASS.NET API 2.4.10.2
« Reply #1187 on: 17 Jul '13 - 20:12 »
Regarding 'Streaming', there is a C# sample called 'Streaming' ;-) which explains the basics about it.
Regarding the playlist stuff...
The easiest thing is actually to use the BASSmix add-on and create a nonstop mixer stream and play it, onto which you then setup the streaming.
As the mixer stream is nonstop it simply produces silence as long as no source is added to it.

Then you can create a decoding stream for the 1st playlist file and add this one to the mixer as a source stream - which is the being played.
In addition setup a END SYNC onto this source to get notified once the stream reaches it ends.
When it ends you can create the next decoding stream for the 2nd playlist file and add this one to the mixer as a source stream - which is then being played.
etc. etc.

Mainly the following methods are needed:

Init Bass:
Code: [Select]
bool ok = Bass.BASS_Init(-1, 44100, BASSInit.BASS_DEVICE_DEFAULT, this.Handle);
Create the main mixer stream:
Code: [Select]
private int _mixerStream = 0;
...
_mixerStream = BassMix.BASS_Mixer_StreamCreate(44100, 2, BASSFlag.BASS_MIXER_RESUME | BASSFlag.BASS_SAMPLE_FLOAT | BASSFlag.BASS_MIXER_NONSTOP);
bool ok = Bass.BASS_ChannelPlay(_mixerStream, true);

Create a source decoding stream from a file:
Code: [Select]
int mixerSource = Bass.BASS_StreamCreateFile(filename, 0L, 0L, BASSFlag.BASS_STREAM_DECODE | BASSFlag.BASS_STREAM_PRESCAN | BASSFlag.BASS_SAMPLE_FLOAT);
Setup an END SYNC to get notified when the stream ends:
Code: [Select]
private SYNCPROC _syncProc;
...
_syncProc = new SYNCPROC(MySync);
int syncHandle = BassMix.BASS_Mixer_ChannelSetSync(mixerSource, BASSSync.BASS_SYNC_END | BASSSync.BASS_SYNC_MIXTIME, 0L, _syncProc, IntPtr.Zero);
...
private void MySync(int syncHandle, int channel, int data, IntPtr user)
{
    // Note, that will execute in a BASS thread and NOT the UI thread!
    // so if needed do this...
    BeginInvoke((MethodInvoker)delegate
    {
        // code to run on the UI thread goes here!
        ....
    });
}

Add the source to the mixer:
Code: [Select]
bool ok = BassMix.BASS_Mixer_StreamAddChannel(_mixerStream, mixerSource, BASSFlag.BASS_MIXER_DOWNMIX);
Setup the broadcasting (roughly) on the mixer stream:
Code: [Select]
private BroadCast _broadCast;
...
// create an encoder instance (e.g. for MP3 use EncoderLAME):
EncoderLAME lame = new EncoderLAME(_mixerStream);
lame.InputFile = null; //STDIN
lame.OutputFile = null; //STDOUT
lame.LAME_Bitrate = (int)EncoderLAME.BITRATE.kbps_128;
lame.LAME_TargetSampleRate = (int)EncoderLAME.SAMPLERATE.Hz_44100;

// create a StreamingServer instance (e.g. SHOUTcast) using the encoder:
SHOUTcast shoutcast = new SHOUTcast(lame);
shoutcast.ServerAddress = "localhost";
shoutcast.ServerPort = 8000;
shoutcast.Password = "changeme";
shoutcast.PublicFlag = true;

// use the BroadCast class to control streaming:
_broadCast = new BroadCast(shoutcast);
_broadCast.AutoReconnect = true;
_broadCast.Notification += new BroadCastEventHandler(OnBroadCast_Notification);
_broadCast.AutoConnect();

private void OnBroadCast_Notification(object sender, BroadCastEventArgs e)
{
  // Note: this method might be called from another thread (non UI thread)!
  if (_broadCast == null)
    return;
  if (_broadCast.IsConnected)
  {
    // we are connected...
  }
  else
  {
    // we are not connected...
  }
}

serkanp

  • Posts: 67
Re: BASS.NET API 2.4.10.2
« Reply #1188 on: 18 Jul '13 - 12:24 »
thank you,
now i understand it a little  :P
i already wrote a playlist player class, that have the endsync and get the list loop..
- i will then add this playlist player to a mixer channel,
- then i will give it to a lame encoder
- lame encoder to shoutcast class

this is the basics i think..
ok i will try it :))

ps: the "streaming" sample is not working.. i put all necessary dll's and lame.exe in the output folder.. but it gives errors and errors.. :) anyway.. i will use this method..


one more question :))
as it uses lame.exe as encoder.. is it possible to use an internal encoder?
since, i will make a big system that will play 4-5 different playlists and serves it.. so on the server side, i dont want to run an external exe..
how possible?


radio42

  • Posts: 4576
Re: BASS.NET API 2.4.10.2
« Reply #1189 on: 19 Jul '13 - 10:51 »
BASSenc typically uses an external command-line encoder for its encoding. However, you might also use an ACM codec (if the Frauenhofer MP3 professional codec is installed)...
See the ACM functions within BassEnc for details...In Bass.Net there is also an EncoderACM class existing...however generially using ACM can be a bit tricky...!

And what errors do you actually get with the Streaming sample...here it seems to just work...?

serkanp

  • Posts: 67
Re: BASS.NET API 2.4.10.2
« Reply #1190 on: 22 Jul '13 - 13:24 »
i finally wrote my own streamer and player classes..
one class (player) gets the playlists , creates sync on end for each file,at sync event, gets the next music file, and it loops ..

second class, creates a mixer, creates the stream server, plays the mixer..  on each file change on first class, an event triggers the second class' mixer
adds the current playing file's id to mixer, removes the old one.. so the mixer plays..

but after 5-6 file, the bass gives a garbage collector error..
would you mind if i send you the both 2 class and you check it?



serkanp

  • Posts: 67
Re: BASS.NET API 2.4.10.2
« Reply #1191 on: 22 Jul '13 - 13:28 »
also i have one more question :)
i dont want to give output to the speakers..
i just want to stream it to icecast..
how can i disable sound output? :)

i will play 10-15 different playlist at the sametime.. so i dont want to give the output..

serkanp

  • Posts: 67
Re: BASS.NET API 2.4.10.2
« Reply #1192 on: 22 Jul '13 - 15:19 »
And what errors do you actually get with the Streaming sample...here it seems to just work...?

i got this error

radio42

  • Posts: 4576
Re: BASS.NET API 2.4.10.2
« Reply #1193 on: 22 Jul '13 - 15:22 »
a) GC issue:
Take a look here: http://www.bass.radio42.com/help/html/9b9af3f1-f0dd-42e8-898a-ed607b9d0f60.htm#Callbacks

b) No Output:
You can either mute the mixer channel (eg. call "Bass.BASS_ChannelSetAttribute(mixer, BASSAttribute.BASS_ATTRIB_VOL, 0f)")
or
you can also make the mixer channel a decoding one and the call BASS_ChannelGetData yourself (in a constant loop).

serkanp

  • Posts: 67
Re: BASS.NET API 2.4.10.2
« Reply #1194 on: 23 Jul '13 - 14:13 »
a) GC issue:
Take a look here: http://www.bass.radio42.com/help/html/9b9af3f1-f0dd-42e8-898a-ed607b9d0f60.htm#Callbacks

b) No Output:
You can either mute the mixer channel (eg. call "Bass.BASS_ChannelSetAttribute(mixer, BASSAttribute.BASS_ATTRIB_VOL, 0f)")
or
you can also make the mixer channel a decoding one and the call BASS_ChannelGetData yourself (in a constant loop).

Thank You  :) finally all working perfectly..
the problem about the gc issue is, the syncproc object was inside the sub, i took it as a global variable.. then used as
Code: [Select]
try { if (trackSync != 0) {  Bass.BASS_ChannelRemoveSync(_stream, trackSync); } }
                        catch (Exception ex) { Console.WriteLine("track sync error:" + ex.Message); }

                        _sync = new SYNCPROC(OnTrackSync);
                        trackSync = Bass.BASS_ChannelSetSync(_stream, BASSSync.BASS_SYNC_END, 0L, _sync, IntPtr.Zero);

today i will try acm functions .. really thanks for the help.. ;)
« Last Edit: 23 Jul '13 - 14:20 by serkanp »

serkanp

  • Posts: 67
Re: BASS.NET API 2.4.10.2
« Reply #1195 on: 23 Jul '13 - 15:00 »
again me :))))
now i have a new problem..
Code: [Select]
if (ServerPath.ToLower().StartsWith("http://") )
                {
                    _stream = Bass.BASS_StreamCreateURL(ServerPath + filename, 0, BASSFlag.BASS_DEFAULT | BASSFlag.BASS_STREAM_AUTOFREE, null, IntPtr.Zero);
                    Bass.BASS_ChannelPlay(_stream, false);
                }
                else
                {
                    _stream = Bass.BASS_StreamCreateFile(Path.Combine(FilesPath, filename), 0, 0, BASSFlag.BASS_STREAM_DECODE | BASSFlag.BASS_STREAM_PRESCAN | BASSFlag.BASS_SAMPLE_FLOAT | BASSFlag.BASS_STREAM_AUTOFREE);
                }

-when loading local disk files, it is ok.. the flags works well.. and it plays the file without any problem..
but when i use same flags with BASS_StreamCreateURL it is not working.. (error code : BASS_ERROR_HANDLE, _stream becomes 0)

-when i use the BASSFlag.BASS_DEFAULT | BASSFlag.BASS_STREAM_AUTOFREE it does not start automatically.. but no error..
when i add Bass.BASS_ChannelPlay(_stream, false);
it seems it is playing, but there is no sound output on player and also on sender..

if i don't use icecast etc.. then the above code works well without streaming to icecast.. and this time Bass.BASS_ChannelPlay(_stream, false); is not needed.. it starts automatically.. and i can hear the output..


Ian @ un4seen

  • Administrator
  • Posts: 20437
Re: BASS.NET API 2.4.10.2
« Reply #1196 on: 23 Jul '13 - 17:05 »
Please check the error code (via BASS_ErrorGetCode) after the BASS_StreamCreateURL call, to find out why that call failed. The BASS_ERROR_HANDLE error from BASS_ChannelPlay just confirms that the BASS_StreamCreateURL call failed :)

Note your BASS_StreamCreateFile call will fail too, as it is not possible to combine the BASS_STREAM_DECODE and BASS_STREAM_AUTOFREE flags.

serkanp

  • Posts: 67
Re: BASS.NET API 2.4.10.2
« Reply #1197 on: 24 Jul '13 - 09:28 »
all done..BASS_STREAM_AUTOFREE removed and all solved.. after starting 3 different instance of stream player and server at the same time,
13 hours later, still each of the server has 11mb ram and 0.01 cpu.. its perfect for me..  no more questions :))

thanks both of you for your fast and super answers..


ps: if anyone interested in these looping playlist player + icecast streamserver code, please contact me.. 
i tried to post it here but forum does not allowed a post larger than 12000 words.. :P

Ian @ un4seen

  • Administrator
  • Posts: 20437
Re: BASS.NET API 2.4.10.2
« Reply #1198 on: 24 Jul '13 - 16:30 »
Good to hear that you have got things working well. Regarding posting the code, you could put in an attachment; that allows any supporting files (project/etc) to be included too :)

JMaura

  • Posts: 2
Re: BASS.NET API 2.4.10.2
« Reply #1199 on: 1 Aug '13 - 16:21 »
I've just downloaded the BassNet library. I would like to use it on android using Xamarin Studio.

I've created a new project, and added the android library. Intellissense doesn't work, but i can add the 'using' statement and try the basic example.

But nothing works when deploying to the device. The line:

     // init BASS using the default output device

      if ( Bass.BASS_Init(-1, 44100, BASSInit.BASS_DEVICE_DEFAULT, IntPtr.Zero) )

makes an exception. As this is the first line, i know i'm doing something really wrong, but .... i can't found any solution :(

Docs talks about adding the bass.dll library, but How this could be done?

Thanks a lot!!