Show Posts
|
|
Pages: [1] 2
|
|
2
|
Developments / BASS / Re: BASS for iOS (iPhone/iPad)
|
on: 16 Jul '12 - 14:53
|
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(); }
|
Reply
Quote
|
|
|
3
|
Developments / BASS / Re: BASS for iOS (iPhone/iPad)
|
on: 5 Jul '12 - 10:53
|
|
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...
|
Reply
Quote
|
|
|
4
|
Developments / BASS / Re: BASS for iOS (iPhone/iPad)
|
on: 4 Jul '12 - 13:25
|
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! 
|
Reply
Quote
|
|
|
5
|
Developments / BASS / Re: BASS for iOS (iPhone/iPad)
|
on: 4 Jul '12 - 10:06
|
@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 
|
Reply
Quote
|
|
|
6
|
Developments / BASS / Re: BASS for iOS (iPhone/iPad)
|
on: 2 Jul '12 - 18:00
|
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?
|
Reply
Quote
|
|
|
9
|
Developments / BASS / Re: BASS for iOS (iPhone/iPad)
|
on: 21 Jun '12 - 11:07
|
Here's the other question you were looking forward ^^ For the scratching stuff I need very small buffer so that's what I did setting: BASS_SetConfig(BASS_CONFIG_UPDATEPERIOD, 5); BASS_SetConfig(BASS_CONFIG_BUFFER, 15);
When scratching slow it is fine but when the channel is playing normally it gets choppy. I don't know which values I have to set to have a very accurate thing and a normal playing.
|
Reply
Quote
|
|
|
11
|
Developments / BASS / Re: BASS for iOS (iPhone/iPad)
|
on: 18 Jun '12 - 15:19
|
Lol I kinda feel stupid. your first solution was correct. I thought I had to use Bass_ChannelStop to flush buffers. angleAccum is calculated like this: float GetBestAngleDiff(float a) { float a1 = a - 2.0f * M_PI; float a2 = a + 2.0f * M_PI; if (fabsf(a) < fabsf(a1)) { if (fabsf(a) < fabsf(a2)) return a; return a2; } if (fabsf(a2) < fabsf(a1)) return a2; return a1; }
- (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event { UITouch* touch = [touches anyObject]; CGPoint position = [touch locationInView:self.superview]; const float angle = -atan2f(position.x - 160.0f, position.y - 240.0f); if (isnan(prevAngle)) prevAngle = angle; const float diff = Sys::GetBestAngleDiff(angle - prevAngle) / 0.00001f; angleAccum += diff; prevAngle = angle;
In your second solution, what could be the difference from the first one? Your guess is right about getRevChannel and my stream arrangement The 'scratchVelocity' can be out of range when you move the jog wheel very fast (forward or reverse), then the value could be for example: 230000 or -230000
|
Reply
Quote
|
|
|
12
|
Developments / BASS / Re: BASS for iOS (iPhone/iPad)
|
on: 18 Jun '12 - 09:34
|
You told me to read the topic named "Vinyl scratching demo" so I read it. I implemented the scratching and it works fine at least when I reverse or forward scratching it really changes at the correct position. The only thing I want to do is to hear the real scracthing as we did in a real turntable. The crackle sound occurs when I scratch slowly in both directions: Here's my scratching code: if (scratchVelocity < 100 && scratchVelocity > -100000) { BASS_ChannelStop([bassPointer getChannel]); BASS_ChannelSetPosition([bassPointer getChannel], initialScratchPos + angleAccum, BASS_POS_BYTE | BASS_POS_DECODE); BASS_ChannelSetAttribute([bassPointer getRevChannel], BASS_ATTRIB_REVERSE_DIR, BASS_FX_RVS_REVERSE); BASS_ChannelPlay([bassPointer getChannel], false); NSLog(@"scratchVelocity %f", -scratchVelocity); BASS_ChannelSlideAttribute([bassPointer getChannel], BASS_ATTRIB_FREQ, -scratchVelocity, 100); } else if (scratchVelocity > 100 && scratchVelocity < 100000) { BASS_ChannelStop([bassPointer getChannel]); BASS_ChannelSetPosition([bassPointer getChannel], initialScratchPos + angleAccum, BASS_POS_BYTE | BASS_POS_DECODE); BASS_ChannelSetAttribute([bassPointer getRevChannel], BASS_ATTRIB_REVERSE_DIR, BASS_FX_RVS_FORWARD); BASS_ChannelPlay([bassPointer getChannel], false); NSLog(@"scratchVelocity %f", scratchVelocity); BASS_ChannelSlideAttribute([bassPointer getChannel], BASS_ATTRIB_FREQ, scratchVelocity, 100); }
The 'initialScratchPos' variable is the position in bytes when I start the scratching and 'angleAccum' variable is the number of bytes to add to have the correct position while scratching. When the freq parameter is out of range (100 < freq < 100000): BASS_ChannelStop([bassPointer getChannel]); BASS_ChannelPlay([bassPointer getChannel], false); BASS_ChannelSlideAttribute([bassPointer getChannel], BASS_ATTRIB_FREQ, 88200, 100);
|
Reply
Quote
|
|
|
13
|
Developments / BASS / Re: BASS for iOS (iPhone/iPad)
|
on: 15 Jun '12 - 15:45
|
Hi, I continue with vinyl scratching issue. The only remaining problem is that when scratching slowly I got crackle sounds. This may be related to CONFIG_BUFFER or CONFIG_UPDATEPERIOD, but I don't rellay know which values are possibly correct. I've setted these values BASS_SetConfig(BASS_CONFIG_UPDATEPERIOD, 15); BASS_SetConfig(BASS_CONFIG_BUFFER, 100); May be there are others explanations to crackle sounds? any ideas?
|
Reply
Quote
|
|
|
15
|
Developments / BASS / Re: BASS for iOS (iPhone/iPad)
|
on: 9 May '12 - 12:23
|
|
It doesn't change anything, plus I don't see the BASS_ATTRIB_NOBUFFER attribute.
In my app each touch on the screen will trigger the loop and play it and changes the pitch if touch move. So if we touch with two finger it will trigger and play it twice e.g two different stream
Do I have to use BASSmix instead of lauching two or more stream?
|
Reply
Quote
|
|
|
17
|
Developments / BASS / Re: BASS for iOS (iPhone/iPad)
|
on: 4 May '12 - 18:11
|
Ok thanks  . That was another problem but it helps though I also notice that changing the pitch take a little time before being applied. I touch the screen at a certain x then on another x and it takes time to hear the new pitch value.
|
Reply
Quote
|
|
|
19
|
Developments / BASS / Re: BASS for iOS (iPhone/iPad)
|
on: 4 May '12 - 16:19
|
|
Argh sorry the problem was I call ChannelSetFX each time a value changed, so I set this juste once at the begining. Like this effect works.
Now I notice someting, when I touch the screen and then stop touching it, it doesn't end the loop instantly as if it continues to be in the loop. So what's the cause of it?
|
Reply
Quote
|
|
|
20
|
Developments / BASS / Re: BASS for iOS (iPhone/iPad)
|
on: 4 May '12 - 14:56
|
if ((BASS_Init(-1, 44100, 0, 0, NULL)) == FALSE) { NSLog(@"BASS INIT FAILED %d", BASS_ErrorGetCode()); return NO; } const char *fileName=[[[NSBundle mainBundle] pathForResource:@"voixeric.wav" ofType:nil] UTF8String]; chan = BASS_StreamCreateFile(0, fileName, 0, 0, BASS_STREAM_DECODE | BASS_STREAM_PRESCAN | BASS_SAMPLE_FLOAT); if (chan == 0) { NSLog(@"StreamCreateFile failed %d", BASS_ErrorGetCode()); return NO; } chan = BASS_FX_TempoCreate(chan, BASS_FX_FREESOURCE); if (chan == 0) { NSLog(@"TempoCreate failed %d", BASS_ErrorGetCode()); return NO; } return YES;
void CALLBACK LoopSyncProc(HSYNC handle, DWORD channel, DWORD data, void* user) { DWORD pos = BASS_ChannelGetPosition(channel, BASS_POS_BYTE | BASS_POS_DECODE); NSLog(@"Loop Sync Get pos %u", pos);
BASS_ChannelSetPosition(channel, STARTLOOP, BASS_POS_BYTE | BASS_POS_DECODE); pos = BASS_ChannelGetPosition(channel, BASS_POS_BYTE | BASS_POS_DECODE); NSLog(@"Loop Sync Set pos %u", pos); }
- (void) setSync { sync = BASS_ChannelSetSync(BASS_FX_TempoGetSource(chan), BASS_SYNC_POS, ENDLOOP, (SYNCPROC *)&LoopSyncProc, 0); if (sync == 0) NSLog(@"SYNC FAILED %d", BASS_ErrorGetCode()); }
- (void) Play { if ((BASS_ChannelPlay(chan, FALSE)) == FALSE) NSLog(@"Play channel failed %d", BASS_ErrorGetCode()); }
I call setSync then the play function. The looping code works. Then depending on where I touch the screen in x it modifies the pitch so I just call BASS_ChannelSetAttribute(chan, BASS_ATTRIB_TEMPO_PITCH, value) where value is the x value
|
Reply
Quote
|
|
|