|
toob
Posts: 112
|
 |
« Reply #120 on: 6 Apr '12 - 12:56 » |
Quote
|
Meanwhile... a partial BASS_FX port is now up in the first post. The reverse/tempo/bpm/beat stuff is included, but not the BASS_FX_BFX_xxx effects, which need more work regarding conversion to fixed-point. One difference to note compared to other platforms is that the BASS_ATTRIB_TEMPO_OPTION_USE_QUICKALGO option is enabled by default on tempo streams for lower CPU usage, but it can be disabled via BASS_ChannelSetAttribute if wanted. A BASS library update is also up in the first post, which is required by the BASS_FX port.
Woo Hoo, Brilliant ! Thank you for the quick response. BASS_FX reverse and tempo working great. Big big thanks to all concerned!
|
|
|
|
|
Logged
|
|
|
|
|
slaveoffear
Posts: 4
|
 |
« Reply #121 on: 8 Apr '12 - 22:38 » |
Quote
|
How to make a limit for the preamp in the equalizer? Or Can the limit 'according to peak level' be checked for replaygain+pre-amp adjustments together? If I use +12db pre-amp with the limit option on , only use the maximum possible portion out of the 12db that won't cause any clipping.
|
|
|
|
|
Logged
|
|
|
|
|
Ian @ un4seen
Administrator
Posts: 15259
|
 |
« Reply #122 on: 10 Apr '12 - 18:13 » |
Quote
|
From the quoted text, it sounds like you/they want to use the Replaygain peak level to normalize the stream, so that the level is just short of clipping. To do that, you can set the pre-amp gain to 1/peak. Note that applying EQ (and most other effects) will affect the level though, pretty much invalidating the Replaygain information.
Meanwhile... a BASS_FX update is up in the first post, which adds support for the BASS_FX_BFX_VOLUME effect. That can be used instead of a DSP function (eg. the one I posted earlier) to implement a pre-amp control. A BASS library update is also up, which is needed by the BASS_FX update (for Java effect parameter support). The BASSWV add-on has also been updated to the latest version (2.4.3).
|
|
|
|
|
Logged
|
|
|
|
|
Guy
Guest
|
 |
« Reply #123 on: 11 Apr '12 - 10:24 » |
Quote
|
Hello, has anyone tried the BPM functions on Android?
I tried using int chan = BASS.BASS_StreamCreateFile(file, 0, 0, BASS.BASS_STREAM_DECODE);
and then: boolean error = BASS_FX.BASS_FX_BPM_CallbackSet(chan,new CallbackHolder(),10,0,BASS_FX.BASS_FX_BPM_MULT2,null );
but it crashes with
04-11 12:07:58.742: A/libc(8247): Fatal signal 11 (SIGSEGV) at 0x000007d0 (code=1)
can someone help me, am I supposed to do some aditional calls? Is there a BPM decode/Pitch shifting example for Android?
Thanks
|
|
|
|
|
Logged
|
|
|
|
|
Ian @ un4seen
Administrator
Posts: 15259
|
 |
« Reply #124 on: 11 Apr '12 - 16:33 » |
Quote
|
Something like this should work... BASS_FX.BPMPROC bpmproc=new BASS_FX.BPMPROC() { public void BPMPROC(int chan, float bpm, Object user) { // do something here } };
BASS_FX.BASS_FX_BPM_CallbackSet(chan, bpmproc, 10, 0, BASS_FX.BASS_FX_BPM_MULT2, null);
|
|
|
|
|
Logged
|
|
|
|
|
Andeee
Guest
|
 |
« Reply #125 on: 12 Apr '12 - 08:01 » |
Quote
|
Apologies if the answer to this question is somewhat obvious  I am using BASS for Android in a Marmalde application. When marmalade builds the .apk file it puts assets (such as audio) in an assets folder in the apk. How can I play these audio files using BASS? The problem I see is that you can only pass a string to the BASS_StreamCreateFile call. I have tried passing in '/data/data/my.app.name/assets/mysong.mp3' which didn't work - I received error code 2 back. I realise this may not entirely be a BASS question but I just wondered if anyone had solved anything similar. For example, I think you'd have the same problem if you wanted to play a file out of the res/raw folder in a standard android application - is this possible? Or is it only possible to play files off an sd card? Thanks
|
|
|
|
|
Logged
|
|
|
|
|
Andeee
Guest
|
 |
« Reply #126 on: 12 Apr '12 - 15:42 » |
Quote
|
Nevermind, achieved it by passing a ByteBuffer to BASS instead of a string 
|
|
|
|
|
Logged
|
|
|
|
|
Ian @ un4seen
Administrator
Posts: 15259
|
 |
« Reply #127 on: 12 Apr '12 - 17:24 » |
Quote
|
Yep, you could read the asset into a ByteBuffer and pass that to BASS_StreamCreateFile (as you have done), or wrap the asset access in BASS_FILEPROCS functions and pass that to BASS_StreamCreateFileUser. I'll see if some built-in asset support can be added to BASS for greater convenience.
|
|
|
|
|
Logged
|
|
|
|
|
Ian @ un4seen
Administrator
Posts: 15259
|
 |
« Reply #128 on: 13 Apr '12 - 16:01 » |
Quote
|
An update is now up in the 1st post, including support for passing assets to the stream/sample/music creation functions. An example snippet for that has also been added to the post.
|
|
|
|
|
Logged
|
|
|
|
|
Mr.Green2
Guest
|
 |
« Reply #129 on: 14 Apr '12 - 00:33 » |
Quote
|
From the quoted text, it sounds like you/they want to use the Replaygain peak level to normalize the stream, so that the level is just short of clipping. To do that, you can set the pre-amp gain to 1/peak. Note that applying EQ (and most other effects) will affect the level though, pretty much invalidating the Replaygain information.
Meanwhile... a BASS_FX update is up in the first post, which adds support for the BASS_FX_BFX_VOLUME effect. That can be used instead of a DSP function (eg. the one I posted earlier) to implement a pre-amp control. A BASS library update is also up, which is needed by the BASS_FX update (for Java effect parameter support). The BASSWV add-on has also been updated to the latest version (2.4.3).
BASS_FX_BFX_VOLUME effect works exectly the same as DSP function. Is it possible to make dinamic preamp to reduce only too high volume on some frequencies and not affect other frequences with correct volume?
|
|
|
|
|
Logged
|
|
|
|
|
Mr.Green2
Guest
|
 |
« Reply #130 on: 15 Apr '12 - 22:19 » |
Quote
|
Did you test last bass and bass_fx release on Android < 2.3 ? I have error:
java.lang.UnsatisfiedLinkError: Library bass not found at java.lang.Runtime.loadLibrary(Runtime.java:461) at java.lang.System.loadLibrary(System.java:557)
|
|
|
|
|
Logged
|
|
|
|
|
Mr.Green2
Guest
|
 |
« Reply #131 on: 15 Apr '12 - 22:20 » |
Quote
|
And libbass.so is present in apk
|
|
|
|
|
Logged
|
|
|
|
|
Ian @ un4seen
Administrator
Posts: 15259
|
 |
« Reply #132 on: 16 Apr '12 - 14:45 » |
Quote
|
BASS_FX_BFX_VOLUME effect works exectly the same as DSP function. Is it possible to make dinamic preamp to reduce only too high volume on some frequencies and not affect other frequences with correct volume?
It sounds like a multiband compressor is what you want. BASS doesn't provide that, but perhaps there are 3rd-party implementations available. If so, that could be applied via a DSP function; you would want to give it a low "priority" in the BASS_ChannelSetDSP call so that it's applied last (after any other effects). Did you test last bass and bass_fx release on Android < 2.3 ? I have error:
java.lang.UnsatisfiedLinkError: Library bass not found at java.lang.Runtime.loadLibrary(Runtime.java:461) at java.lang.System.loadLibrary(System.java:557)
Make sure the BASS library is loaded before the BASS_FX library by making a BASS call before you make a BASS_FX call. For example, you could do this first thing in your app to enforce the correct load order... BASS.BASS_GetVersion(); BASS_FX.BASS_FX_GetVersion();
|
|
|
|
|
Logged
|
|
|
|
|
gnag
Posts: 160
|
 |
« Reply #133 on: 17 Apr '12 - 10:44 » |
Quote
|
Hello, I want to generate a Sine Wave Tone using Bass for Android (2.2.3) , I use a similar Code in C#, it works there. Can you give me a Tip what I could have made wrong? All I hear from the Speakers is some strange Noise, it is not the generated Wave. The Code makes the ByteBuffer an ShortBuffer (2 Byte per 16 Bit Number), fills the Buffer and puts it back as far as I understand and returns the number of Bytes written, what did I overlook here? I am using a StreamProc because I want to change the Frequency while playing. int loopChannel; float theta = 0; float angle = 0; int _sampleRate = 44100; public double frequency = 440.0;
private void StartLoopChan() { // Init Theta theta = (float) (Math.PI * frequency * 2) / (float) (_sampleRate);
// LoopChan
STREAMPROC streamProc = new STREAMPROC() { public int STREAMPROC(int handle, ByteBuffer buffer, int length, Object user) {
// Sine Wave Test (16Bit = 2Bytes for 1Short Value) ShortBuffer ibuffer = buffer.asShortBuffer(); short[] b = new short[length / 2]; // allocate an "short" array // for the sample data
// Sine Init double amplitude = 32767.0;
for (int a = 0; a < length / 2; a++) { b[a] = (short) ((amplitude * Math.sin(angle))); angle += theta;
}
// Buffer Operations ibuffer.put(b); // put the array back into the buffer
return length * 2; } };
//Set Buffer Size (default 30ms) -- BASS.BASS_SetConfig(BASS.BASS_CONFIG_DEV_BUFFER, 10000); loopChannel = BASS.BASS_StreamCreate(_sampleRate, 1, BASS.BASS_SAMPLE_LOOP, streamProc, 0);
// int err = BASS.BASS_ErrorGetCode(); BASS.BASS_ChannelPlay(loopChannel, false);
}
|
|
|
|
|
Logged
|
|
|
|
|
gnag
Posts: 160
|
 |
« Reply #134 on: 17 Apr '12 - 15:38 » |
Quote
|
I was able to solve my Problem by adding "buffer.order(null);" to the first line of the StreamProc, however I am still NOT getting the correct Results, I now have some kind of Pause/Break in my Sine Waves, can anyone tell me why is that so, is there some kind of unfilled Space or Buffer Problem ? Again it must be Java/Android specific since on Windows I dont have the Problem. Sound Waves look like this (Recorded via Line In/Speaker Loop) 
|
|
|
|
|
Logged
|
|
|
|
|
Ian @ un4seen
Administrator
Posts: 15259
|
 |
« Reply #135 on: 17 Apr '12 - 16:40 » |
Quote
|
I was able to solve my Problem by adding "buffer.order(null);" to the first line of the StreamProc
Yep, that is necessary because Android is natively little-endian while Java's default is big-endian, so it needs to be told that the data in the buffer is little-endian. Regarding the other problem, it may be due to this line... return length * 2;
The "length" value shouldn't be multiplied, as it hasn't previously been divided 
|
|
|
|
|
Logged
|
|
|
|
|
gnag
Posts: 160
|
 |
« Reply #136 on: 17 Apr '12 - 18:40 » |
Quote
|
Thanks Ian for this suggestion, my Code looks now like this and I still get the Pauses/Breaks, what could be the Problem ?
|
|
|
|
|
Logged
|
|
|
|
|
Ian @ un4seen
Administrator
Posts: 15259
|
 |
« Reply #137 on: 18 Apr '12 - 15:39 » |
Quote
|
Do you happen to be running your app under the debugger, ie. using Eclipse's "Debug" option? If so, you could try using the "Run" option instead, or "Disconnect" the debugger once it is started. I have noticed that array/buffer manipulation (perhaps other things too) seems to be quite a bit slower when running under the debugger, and perhaps that is causing your gaps, ie. the STREAMPROC function is taking too long to sustain playback.
|
|
|
|
|
Logged
|
|
|
|
|
gnag
Posts: 160
|
 |
« Reply #138 on: 18 Apr '12 - 18:46 » |
Quote
|
Thanks, I just found out the same thing before I read your post by just trying out things, it seems that the Eclipse Debugger slows the Process down too much and the Playback gets "Gaps", when just using "Run" it works almost without gaps, only very short ones. It is amazing how Ian can always find all the Bugs, I needed hours of wild trying out Stuff 
|
|
|
|
|
Logged
|
|
|
|
|
Mr.Green2
Guest
|
 |
« Reply #139 on: 19 Apr '12 - 09:46 » |
Quote
|
Make sure the BASS library is loaded before the BASS_FX library by making a BASS call before you make a BASS_FX call. For example, you could do this first thing in your app to enforce the correct load order... BASS.BASS_GetVersion(); BASS_FX.BASS_FX_GetVersion();
It didn't help. But if I just replace libbass.so with older one then everything start working. Could you test it on Android < 2.3, please?
|
|
|
|
|
Logged
|
|
|
|
|