|
Ian @ un4seen
Administrator
Posts: 15253
|
 |
« Reply #520 on: 29 Jun '12 - 17:38 » |
Quote
|
The latest BASSMIDI version (2.4.7) is now up in the iOS package, in the 1st post.
|
|
|
|
|
Logged
|
|
|
|
|
Delphinus
Posts: 39
|
 |
« Reply #521 on: 2 Jul '12 - 18:00 » |
Quote
|
Hi, here's my weekly question  . I tried to get the file BPM and it works... sometimes. I can get most of my mp3 files BPM but for some reason there are a few files I can't. Here's the code void CALLBACK getBpmProc(DWORD chan, float percent) { percent = percent; }
- (void) decodeBPM { HSTREAM bpmChan = BASS_StreamCreateFile(0, [[self filePath] UTF8String], 0, 0, BASS_SAMPLE_FLOAT | BASS_STREAM_PRESCAN | BASS_STREAM_DECODE); if (bpmChan == 0) NSLog(@"BPM CHAN FAILED %d", BASS_ErrorGetCode()); double endSec = BASS_ChannelBytes2Seconds(bpmChan, BASS_ChannelGetLength(bpmChan, BASS_POS_BYTE)); float bpm = BASS_FX_BPM_DecodeGet(bpmChan, 0.0, endSec, 0, BASS_FX_BPM_MULT2, (BPMPROCESSPROC *)&getBpmProc); BPMFile = bpm; currentBPM = bpm; // NSLog(@"BPM decode BPM %f", bpm); BOOL val = BASS_FX_BPM_Free(bpmChan); if (val == FALSE) NSLog(@"BPM FREE FAILED %d", BASS_ErrorGetCode()); }
What could be the error since it works for other files? Another question: It seems that when I put some FX effect like phaser or whatever it always increase the volume. How can I disable this increasing?
|
|
|
|
« Last Edit: 3 Jul '12 - 15:39 by Delphinus »
|
Logged
|
|
|
|
|
Ian @ un4seen
Administrator
Posts: 15253
|
 |
« Reply #522 on: 3 Jul '12 - 17:14 » |
Quote
|
I tried to get the file BPM and it works... sometimes. I can get most of my mp3 files BPM but for some reason there are a few files I can't. Here's the code...
Does the BASS_FX_BPM_DecodeGet call fail, or is it just that the BPM value is incorrect? Unfortunately, the BPM detection may not work well on some types of music and it'll give an incorrect BPM value. Another question: It seems that when I put some FX effect like phaser or whatever it always increase the volume. How can I disable this increasing?
The level of that effect will mainly be affected by the fDryMix/fWetMix parameters (fFeedback too), so you could try playing around with those to get it more to your liking.
|
|
|
|
|
Logged
|
|
|
|
|
JoaoFLF
Posts: 2
|
 |
« Reply #523 on: 3 Jul '12 - 20:38 » |
Quote
|
Hello,
I am trying to include libbass.a in my project but I am struggling a bit. I added it to "Link binaries with.." but if I try to import "bass.h" it says not found and if I try to import libbass.a it thows 20 odd errors. Can anyone point me to some examples on how to setup bass on ios? The only functionality I need from BASS is to calculate bpm. Can anyone point me in the right direction?
Thank you,
|
|
|
|
|
Logged
|
|
|
|
|
Delphinus
Posts: 39
|
 |
« Reply #524 on: 4 Jul '12 - 10:06 » |
Quote
|
@Ian: the bpm value return by BPM_DecodeGet is 0 and in the callback function the "percent" value reached 100. So I guess the function work it is just that it cannot retrieve well the bpm @JoaoFLF: For my project I added libbass.a and libbass_fx.a via "Link binaries with..." and just drag the .h files to the project. In the first post it is said to add multiple frameworks such as Accelerate.framework, CFNetwork, AudioToolboc etc. So add them. Finally in the Build Settings in the Linking parts add "-lstdc++" to the "Other Linker Flags". All combined you should be able to run the project. All these configuration are mentionned in the first post 
|
|
|
|
« Last Edit: 4 Jul '12 - 10:38 by Delphinus »
|
Logged
|
|
|
|
|
JoaoFLF
Posts: 2
|
 |
« Reply #525 on: 4 Jul '12 - 12:39 » |
Quote
|
@Delphinus
Thank you very much for your help. The only thing I was missing was adding the .h files. Strangely it is not mentioned in the first post. As for calculating bpm from songs in the ipod library, do you know where should I start? I am a total novice in BASS.
Again thank you so much for your help!
|
|
|
|
|
Logged
|
|
|
|
|
Delphinus
Posts: 39
|
 |
« Reply #526 on: 4 Jul '12 - 13:25 » |
Quote
|
Yep, maybe because adding .h files is obvious in order to tell the compiler which function you are refering to  . First, get your mp3 file from the ipod library is kinda complicated if you want to do it yourself? Fortunately there's a library doing it for you: https://bitbucket.org/artgillespie/tslibraryimport. It copies the file in your app and this way you can access the file imported. Then you can retrieve the path of your file and give it to bass when you create a stream via BASS_StreamCreateFile function. To calculate the BPM you have to use bass_fx function especially the DecodeGet function. See the documentation of bassFX it really helps a lot. It's complicated at first when you don't know the library but with the documentation and searching in this forum helps a lot. And Ian will help you for any problem you will encounter. In any case he really helps me  So first I advice you to start playing a file (shouldn't be complicated ^^) and read the documentation to know how to use the bpm function. It may be painful at first but I think it is necessary to understand the library. When you ask something int the forum I also advice you to post some of your code that way someone will correct it and you will see your error. It is the best way to progress! 
|
|
|
|
|
Logged
|
|
|
|
|
Ian @ un4seen
Administrator
Posts: 15253
|
 |
« Reply #527 on: 4 Jul '12 - 17:31 » |
Quote
|
@Ian: the bpm value return by BPM_DecodeGet is 0 and in the callback function the "percent" value reached 100. So I guess the function work it is just that it cannot retrieve well the bpm
Yep, that does sound like it probably just can't detect the file's BPM. I notice you're processing the entire file in the BASS_FX_BPM_DecodeGet call, but perhaps the BPM varies? To confirm things, you could try playing the file with the BPM example from the Win32 or OSX BASS_FX package.
|
|
|
|
|
Logged
|
|
|
|
|
Delphinus
Posts: 39
|
 |
« Reply #528 on: 5 Jul '12 - 10:53 » |
Quote
|
Yep I'm processing the entire file to get a much more accurate BPM but perhaps it is not that necessary?. With the bpm binary from the Win32 (for OSX there's just the reverse and tempo code) it gets the BPM of 30 seconds from the start and this way it does retrieve the BPM. But when I try to decode with the same time, it still doesn't retrieve the bpm... weird...
|
|
|
|
|
Logged
|
|
|
|
|
Delphinus
Posts: 39
|
 |
« Reply #529 on: 16 Jul '12 - 14:53 » |
Quote
|
Hi, I tried to create another stream with the same file so that way I get two channel. When touching a certain part of the screen it creates a channel on the fly and so I can perform cutom loop on it. The problem is that when creating the channel BASS_StreamCreateFile is returnin BASS_ERROR_FILEFORM. But I managed to create the first channel with the same file so I don't know where that error could possibly comes from. Sometimes it did play the file but like just once or twice then it returns Error 41 QWORD entryPoint = BASS_ChannelGetPosition(chan, BASS_POS_BYTE);
rollChan = BASS_StreamCreateFile(0, [[self filePath] UTF8String], entryPoint, 0, BASS_MP3_SETPOS | BASS_STREAM_PRESCAN | BASS_SAMPLE_FLOAT); if (rollChan == 0) { NSLog(@"Stream create file rollChan failed %d", BASS_ErrorGetCode()); return BASS_ErrorGetCode(); }
|
|
|
|
|
Logged
|
|
|
|
|
Ian @ un4seen
Administrator
Posts: 15253
|
 |
« Reply #530 on: 16 Jul '12 - 16:33 » |
Quote
|
Is that only happening with a particular file or file format, or does it apply to everything? If it's a particular file, please upload it to have a look at here... ftp.un4seen.com/incoming/If it's a particular file format and that format is MP3, does it apply to both the normal and "mp3-free" BASS library versions?
|
|
|
|
|
Logged
|
|
|
|
|
Delphinus
Posts: 39
|
 |
« Reply #531 on: 17 Jul '12 - 09:53 » |
Quote
|
Nevermind I created the stream at the beginning but I retried to create on the fly it seems not returnin any error.
What's the difference between the normal .a and the mp3-free .a?
|
|
|
|
|
Logged
|
|
|
|
|
Ian @ un4seen
Administrator
Posts: 15253
|
 |
« Reply #532 on: 17 Jul '12 - 17:44 » |
Quote
|
The "mp3-free" BASS version doesn't include an MP3 decoder, and instead uses the OS's MP3 decoder. That is primarily to avoid patent issues, but I would suggest always using the "mp3-free" version on iOS anyway, as the MP3 decoding can be hardware accelerated.
|
|
|
|
|
Logged
|
|
|
|
|
tonik76
Posts: 3
|
 |
« Reply #533 on: 19 Jul '12 - 12:48 » |
Quote
|
Hi! I'm working on a Delphi XE2 Firemonkey iOS app and would really need to use BASS for the project. Is there seriously no tutorial/examples on how to do this ??
|
|
|
|
|
Logged
|
|
|
|
|
Leniad
Guest
|
 |
« Reply #534 on: 25 Jul '12 - 12:39 » |
Quote
|
Hi! I'm trying to make Delphi XE2/Firemonkey application run with BASS. In Windows runs and compile fine, but in Xcode don't work (never loads the 'libbass.a' library) What i'm doing wrong? Here is my code
libName := {$IFDEF WIN32}ExtractFilePath(paramstr(0))+'bass.dll'{$ELSE}ExtractFilePath(paramstr(0))+'libbass.a'{$ENDIF}; libLoaded := Load_BASSDLL(libName); libInit := BASS_Init( -1, 44100, 0, Handle, nil); wav_name:=ExtractFilePath(paramstr(0))+'Tick.wav'; snd_Tick:= BASS_StreamCreateFile(False, PChar(wav_name), 0, 0, BASS_SPEAKER_FRONT {$IFDEF UNICODE} or BASS_UNICODE {$ENDIF}); BASS_ChannelPlay(snd_Tick, False);
Thanks in advance!
|
|
|
|
|
Logged
|
|
|
|
|
iancast
Posts: 27
|
 |
« Reply #535 on: 10 Aug '12 - 01:30 » |
Quote
|
Hello, I'm trying to encode a recording stream in AAC (with a MP4 container) using the BASS_Encode_StartCAFile method. Unfortunately, the application crashes frequently during recording on the iPhone 3GS and iPhone 4S, but less frequently with the iPhone 4. It crashes only when I add the AAC encoder; using ALAC or saving the stream in a WAV file seems to work. There's no errors coming out of the BASS methods. In fact, the application crashes right after recording one or two seconds of data. FYI, I'm not calling these methods from different threads. I tried to add BASS_SAMPLE_FLOAT, stop the encoder manually rather than using BASS_ENCODE_AUTOFREE, but it doesn't fix the random crashes. I'm using MonoTouch; here's the native stack trace when the application crashes (the crash logs always contain the BASS_RecordGetInputName method): Native stacktrace:
0 RCAppRadio 0x006e4ea4 mono_handle_native_sigsegv + 280 1 RCAppRadio 0x006c31d0 mono_sigsegv_signal_handler + 196 2 libsystem_c.dylib 0x32c337ed _sigtramp + 48 3 RCAppRadio 0x0080e858 BASS_RecordGetInputName + 22720 4 RCAppRadio 0x0080e858 BASS_RecordGetInputName + 22720 5 AudioToolbox 0x31efc375 _ZN20ClientMessageHandler19InputBufferCompleteEjjRK15XAudioTimeStampjPK28AudioStreamPacketDescription + 192 6 AudioToolbox 0x31efdf01 _ZN29AQClientCallbackMessageReader17DispatchCallbacksEPhjPvj + 344 7 AudioToolbox 0x31efc17b AQCallbackReceiver_CallbackNotificationsAvailable + 370 8 AudioToolbox 0x31ea9ea1 _XCallbackNotificationsAvailable + 60 9 AudioToolbox 0x31e9fce3 mshMIGPerform + 374 10 CoreFoundation 0x357fb523 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 38 11 CoreFoundation 0x357fb4c5 __CFRunLoopDoSource1 + 140 12 CoreFoundation 0x357fa313 __CFRunLoopRun + 1370 13 CoreFoundation 0x3577d4a5 CFRunLoopRunSpecific + 300 14 CoreFoundation 0x3577d36d CFRunLoopRunInMode + 104 15 AudioToolbox 0x31ef8b2f _ZN20GenericRunLoopThread5EntryEPv + 122 16 AudioToolbox 0x31e7fca3 _ZN9CAPThread5EntryEPS_ + 214 17 libsystem_c.dylib 0x32bea735 _pthread_start + 320 18 libsystem_c.dylib 0x32bea5f0 thread_start + 8
Here are snippets of the source code I'm using: // Initialize BASS if (BASS.BASS_Init(-1, 44100) == -1) GetError("BASS_Init");
public void StartRecording(string filePath, SoundFormat soundFormat) { // Initialize recording (lowers the playback volume) if (!BASS.BASS_RecordInit(0)) GetError("BASS_RecordInit");
// Set device if (!BASS.BASS_RecordSetDevice(0)) GetError("BASS_RecordSetDevice");
#if IOS // Set BASS_CONFIG_IOS_MIXAUDIO to 0 when encoding in AAC (http://www.un4seen.com/forum/?topic=10910.msg76056#msg76056) if (soundFormat == SoundFormat.AAC) { BASS.BASS_SetConfig(BASS.BASS_CONFIG_IOS_MIXAUDIO, 0); } #endif
// Prepare to start recording delegateRecord = new RecordProcDelegate(RecordProc); handleRecording = BASS.BASS_RecordStart(44100, 1, BASS.BASS_SAMPLE_FLOAT, delegateRecord, IntPtr.Zero); if (handleRecording == -1) GetError("BASS_RecordStart");
// Check enconder if (soundFormat == SoundFormat.AAC) { #if IOS // Prepare encoding int handleEncoder = BASS.BASS_Encode_StartCAFile(handleRecording, BASS.COCOA_AUDIOUNIT_MP4F, BASS.COCOA_AUDIOUNIT_AAC, BASS.BASS_SAMPLE_FLOAT, 64000, filePath); if (handleEncoder == 0) GetError("BASS_Encode_StartCAFile"); #endif } else if (soundFormat == SoundFormat.ALAC) { #if IOS // Prepare encoding int handleEncoder = BASS.BASS_Encode_StartCAFile(handleRecording, BASS.COCOA_AUDIOUNIT_M4AF, BASS.COCOA_AUDIOUNIT_ALAC, BASS.BASS_SAMPLE_FLOAT, 0, filePath); if (handleEncoder == 0) GetError("BASS_Encode_StartCAFile"); #endif
}
// Start recording int success = BASS.BASS_ChannelPlay(handleRecording, false); if(success == -1) GetError("BASS_ChannelPlay"); }
public void StopRecording() { // Stop encoding if(!BASS.BASS_Encode_Stop(handleRecording)) GetError("BASS_Encode_Stop");
// Stop recording if(BASS.BASS_ChannelStop(handleRecording) == -1) GetError("BASS_ChannelStop");
// Free recording resources (the playback volume is restored) if (!BASS.BASS_RecordFree()) GetError("BASS_RecordFree");
#if IOS // Set BASS_CONFIG_IOS_MIXAUDIO to 1 (default) BASS.BASS_SetConfig(BASS.BASS_CONFIG_IOS_MIXAUDIO, 1); #endif }
I'm using the latest version of BASS provided on the first post of this thread. Thanks for any help on this issue!
|
|
|
|
« Last Edit: 10 Aug '12 - 01:37 by iancast »
|
Logged
|
|
|
|
|
Ian @ un4seen
Administrator
Posts: 15253
|
 |
« Reply #536 on: 10 Aug '12 - 16:08 » |
Quote
|
I'll send you a debug version to get some more info on what's happening.
|
|
|
|
|
Logged
|
|
|
|
|
Ian @ un4seen
Administrator
Posts: 15253
|
 |
« Reply #537 on: 23 Aug '12 - 16:54 » |
Quote
|
An iOS version of the new BASSOPUS add-on is now included in the package in the 1st post.
|
|
|
|
|
Logged
|
|
|
|
|
|
|
Konstantin
Posts: 8
|
 |
« Reply #539 on: 6 Sep '12 - 12:15 » |
Quote
|
Hello! I'm a newbie in Bass and really need help with it. I'm writting simple test application on MonoTouch. My steps: - creating simple 1-view-application
- Add reference Base.Net.iPhone.dll
- Put bass.dll into bin/iPhone folder (etc.)
- Write some code like
if (Bass.BASS_RecordInit(-1)) {
} (or int device = Bass.BASS_RecordGetDevice() ),etc.[/li]
And trying to deploy it. In result I got something like that: Unable to resolve pinvoke method 'Un4seen.Bass.Bass:BASS_GetVersion ()' Re-run with MONO_LOG_LEVEL=debug for more information.
Stacktrace:
at (wrapper managed-to-native) Un4seen.Bass.Bass.BASS_GetVersion () <0xffffffff> at Un4seen.Bass.Bass.a () <IL 0x00000, 0x00083> at Un4seen.Bass.Bass.b () <IL 0x00007, 0x000bb> at Un4seen.Bass.Bass..cctor () <IL 0x0004d, 0x002f7> at (wrapper runtime-invoke) object.runtime_invoke_dynamic (intptr,intptr,intptr,intptr) <0xffffffff> at RecordingAudioHelloWorld.Player..ctor () [0x0001c] in /Users/konstantinloginov/Projects/RecordingAudioHelloWorld/RecordingAudioHelloWorld/Player.cs:24 at RecordingAudioHelloWorld.RecordingAudioHelloWorldViewController..ctor () <IL 0x00001, 0x0009b> at RecordingAudioHelloWorld.AppDelegate.FinishedLaunching (MonoTouch.UIKit.UIApplication,MonoTouch.Foundation.NSDictionary) [0x00015] in /Users/konstantinloginov/Projects/RecordingAudioHelloWorld/RecordingAudioHelloWorld/AppDelegate.cs:31 at (wrapper runtime-invoke) object.runtime_invoke_dynamic (intptr,intptr,intptr,intptr) <0xffffffff> at MonoTouch.UIKit.UIApplication.Main (string[],string,string) [0x00042] in /Developer/MonoTouch/Source/monotouch/src/UIKit/UIApplication.cs:29 at RecordingAudioHelloWorld.Application.Main (string[]) [0x00000] in /Users/konstantinloginov/Projects/RecordingAudioHelloWorld/RecordingAudioHelloWorld/Main.cs:17 at (wrapper runtime-invoke) object.runtime_invoke_dynamic (intptr,intptr,intptr,intptr) <0xffffffff>
Am I forget something? Should I add anything in project settings? (any mtouch args, etc.) Spent a lot of time to solve the problem, but without any success.  After that I tried at least to write test console application. I did the same steps (but adding Base.Net.dll). Compile and try to run it. But got "DllNotFoundException". Re-run the application with MONO_LOG_LEVEL=debug. In result - I found such debug-info: Mono: DllImport loading: 'bass.dll'. Mono: DllImport error loading library 'dlopen(bass.dll, 9): image not found'. Mono: DllImport loading library: '/Users/konstantinloginov/Projects/ConsoleBaseNetProject/ConsoleBaseNetProject/bin/Debug/libbass'. Mono: DllImport error loading library 'dlopen(/Users/konstantinloginov/Projects/ConsoleBaseNetProject/ConsoleBaseNetProject/bin/Debug/libbass, 9): image not found'. Mono: DllImport loading library: '/Users/konstantinloginov/Projects/ConsoleBaseNetProject/ConsoleBaseNetProject/bin/Debug/libbass.dylib'. Mono: DllImport error loading library 'dlopen(/Users/konstantinloginov/Projects/ConsoleBaseNetProject/ConsoleBaseNetProject/bin/Debug/libbass.dylib, 9): image not found'. Mono: DllImport loading library: '/Users/konstantinloginov/Projects/ConsoleBaseNetProject/ConsoleBaseNetProject/bin/Debug/libbass.so'. Mono: DllImport error loading library 'dlopen(/Users/konstantinloginov/Projects/ConsoleBaseNetProject/ConsoleBaseNetProject/bin/Debug/libbass.so, 9): image not found'. Mono: DllImport loading library: '/Users/konstantinloginov/Projects/ConsoleBaseNetProject/ConsoleBaseNetProject/bin/Debug/libbass.bundle'. Mono: DllImport error loading library 'dlopen(/Users/konstantinloginov/Projects/ConsoleBaseNetProject/ConsoleBaseNetProject/bin/Debug/libbass.bundle, 9): image not found'. i.e. it seems, that mono trying to find lib with other name(but simple renaming didn't help). I'll be extremely grateful for any help. Even ready to pay(PayPal, etc.) for anyone, who can send me test project for MonoTouch.  Thank you!
|
|
|
|
|
Logged
|
|
|
|
|