Author Topic: BASS for iOS (iPhone/iPad)  (Read 344243 times)

AnthonyM

  • Posts: 53
Re: BASS for iOS (iPhone/iPad)
« Reply #350 on: 13 Jan '12 - 04:24 »
@Ian - Thanks, I ended up using basically the same method, works like a charm and copies the file in approx 1 second or less.

AnthonyM

  • Posts: 53
Re: BASS for iOS (iPhone/iPad)
« Reply #351 on: 14 Jan '12 - 08:53 »
I'm currently doing the following:

Code: [Select]
BASS_ChannelSetSync(deckHandle, BASS_SYNC_END, 0, &EndSyncCallback, self);

void CALLBACK EndSyncCallback(HSYNC handle, DWORD channel, DWORD data, void *user)
{
    DeckViewController *me = (DeckViewController*)user;
    // Insert other code that uses 'self'/me here
}
This code is within the DeckViewController class.

I am doing this because I can't access any of the classes functions from within the callback.
Is there a better way of doing this?

Thanks :)

Ian @ un4seen

  • Administrator
  • Posts: 18809
Re: BASS for iOS (iPhone/iPad)
« Reply #352 on: 17 Jan '12 - 14:21 »
That is the correct/best way to do it as far as I'm aware, but I'm no Objective-C expert :)

sui

  • Guest
Re: BASS for iOS (iPhone/iPad)
« Reply #353 on: 20 Jan '12 - 07:45 »
Hello !

I have a problem, I hope someone can help me.
I want to stream an AAC using BASS, but I don't know how to do it. I understood I must use BASS_StreamCreateFileUser and BASS_StreamPutFileData, but I don't know how to write callbacks (I'm really a newbie).

Here is my code :

Code: [Select]
- (void) prepare {
   int error;
   BASS_Init(-1, 44100, 0, 0, NULL);
   error = BASS_ErrorGetCode();
   NSURLRequest *request = [NSURLRequest requestWithURL:@"myURL"];
   NSURLConnection *connection = [[NSURLConnection alloc] initWithRequest:request delegate:self];
   [connection start];
}

- (void)connection:(NSURLConnection *)connection didReceiveResponse:(NSURLResponse *)response {
    data = [[NSMutableData data] retain];
   
    BASS_FILEPROCS fileprocs={MyFileCloseProc, MyFileLenProc, MyFileReadProc, MyFileSeekProc};
    stream = BASS_StreamCreateFileUser(STREAMFILE_BUFFERPUSH, 0, &fileprocs, data);
   
    int error = BASS_ErrorGetCode();
    DLog(@"error %d", error); // Stream is null, I don't know why
   
    BASS_ChannelPlay(stream, NO);
   
    error = BASS_ErrorGetCode();
   
}

- (void)connection:(NSURLConnection *)connection didReceiveData:(NSData *)new_data {
    [data appendData:new_data];
   
    BASS_StreamPutFileData(stream1, [new_data bytes],new_data.length);
    int error = BASS_ErrorGetCode();
    DLog(@"error %d", error);
   
}

void CALLBACK MyFileCloseProc(void *user)
{
    fclose(user); // close the file
}

QWORD CALLBACK MyFileLenProc(void *user)
{
    NSMutableData *data = (NSMutableData *)user;
    return [data length];
}

DWORD CALLBACK MyFileReadProc(void *buffer, DWORD length, void *user)
{
    return fread(buffer, 1, length, user); // I think it does not work with NSMutableData
}

BOOL CALLBACK MyFileSeekProc(QWORD offset, void *user)
{
    return !fseek(user, offset, SEEK_SET); // seek to offset
}

Ian @ un4seen

  • Administrator
  • Posts: 18809
Re: BASS for iOS (iPhone/iPad)
« Reply #354 on: 20 Jan '12 - 17:12 »
Streaming AAC from the internet on iOS is pretty complicated. Probably not the best choice for a 1st project :)

The problem is that the buffered file system isn't supported when using a CoreAudio codec (eg. for AAC); if it was supported, you could simply use BASS_StreamCreateURL and not bother with BASS_StreamCreateFileUser. That means you can't use STREAMFILE_BUFFERPUSH in your BASS_StreamCreateFileUser call; FILESYSTEM_NOBUFFER (the unbuffered file system) is the only option available when playing AAC. That introduces another problem in that it expects the data to be available immediately and any delays (eg. waiting for data to download) will block the decoding thread, possibly resulting in breaks in the output, but that can be mitigated by having a dedicated thread hosting the stream decoding. Here's a previous thread on the subject...

   www.un4seen.com/forum/?topic=13185

arlomedia

  • Posts: 9
Re: BASS for iOS (iPhone/iPad)
« Reply #355 on: 21 Jan '12 - 21:11 »
I'm using BASS for real-time effects processing in two different apps. I've heard from a few users saying they don't hear any sound on the iPhone 4s. Is there any known incompatibility between the current BASS for iOS and the 4s hardware?

I don't have a 4s to test with, but I'll borrow one this week.

einsteinx2

  • Posts: 67
Re: BASS for iOS (iPhone/iPad)
« Reply #356 on: 22 Jan '12 - 20:32 »
I'm using BASS for real-time effects processing in two different apps. I've heard from a few users saying they don't hear any sound on the iPhone 4s. Is there any known incompatibility between the current BASS for iOS and the 4s hardware?

I don't have a 4s to test with, but I'll borrow one this week.
I'm using a 4S and I haven't had any issues with BASS not playing any sound on my device, though maybe you're using some BASS function I'm not.

einsteinx2

  • Posts: 67
Re: BASS for iOS (iPhone/iPad)
« Reply #357 on: 22 Jan '12 - 20:40 »
@Ian, I'm am having an issue properly down/upsampling and audio stream. I had posted a little while back about some sound quality issues I was having with BASS compared to Audio Queue Services. Mainly volume being much lower and not as "thick" in the mid/low end. I'm not sure what framework you're using internally in BASS for audio playback, but I was able to fix my sound quality issues by using BASS only for decoding and passing sample data to an audio queue. (maybe you could incorporate that internally at some point?)

The issue I have is that only files with the same sample rate as the audio queue play properly. If I have say a 96KHz file and try to play that in a 44.1KHz queue, it plays very slowly, and a 22.05KHz file plays double speed. Obviously because there are more or less samples than expected.

I'm having trouble getting BASS to change the sample rate. I've tried a few different things and none have worked. I assumed if I create a BASSMix stream in DECODE mode and set it's sample rate to the same as the audio queue, it should down/upsample for me. When I do this, the files play at the correct speed but sound very bad (hard to explain the sound, like loud clicking I guess). I've tried using the declick option and that didn't work.

Is there a proper way I should be doing this? I saw somewhere in the forums a function to manually change sample rate, but I'd rather use a built in BASS function if possible. When I was previously using BASS to output my audio, it was dealing with sample rates just fine (except for files over 96KHz then there was loud whitenoise, which I sent you a test file for) so it obviously has the capability to resample audio streams, I just haven't figured out how to get that resampling to happen when just decoding.

Ian @ un4seen

  • Administrator
  • Posts: 18809
Re: BASS for iOS (iPhone/iPad)
« Reply #358 on: 23 Jan '12 - 17:21 »
I'm using BASS for real-time effects processing in two different apps. I've heard from a few users saying they don't hear any sound on the iPhone 4s. Is there any known incompatibility between the current BASS for iOS and the 4s hardware?

I don't have a 4s to test with, but I'll borrow one this week.

Is BASS handling the device input/output as well as applying effects, or is that handled in some other way? If the latter, it might be that something has changed in that stuff, eg. perhaps the sample format has changed?

@Ian, I'm am having an issue properly down/upsampling and audio stream. I had posted a little while back about some sound quality issues I was having with BASS compared to Audio Queue Services. Mainly volume being much lower and not as "thick" in the mid/low end. I'm not sure what framework you're using internally in BASS for audio playback, but I was able to fix my sound quality issues by using BASS only for decoding and passing sample data to an audio queue. (maybe you could incorporate that internally at some point?)

The sound quality problem with the 192KHz test file that you uploaded previously is caused by the resampling. For performance reasons, BASS uses linear interpolation when resampling on iOS, which doesn't give the greatest quality. I'm looking into adding a higher quality option for when quality is more important than performance.

The issue I have is that only files with the same sample rate as the audio queue play properly. If I have say a 96KHz file and try to play that in a 44.1KHz queue, it plays very slowly, and a 22.05KHz file plays double speed. Obviously because there are more or less samples than expected.

I'm having trouble getting BASS to change the sample rate. I've tried a few different things and none have worked. I assumed if I create a BASSMix stream in DECODE mode and set it's sample rate to the same as the audio queue, it should down/upsample for me. When I do this, the files play at the correct speed but sound very bad (hard to explain the sound, like loud clicking I guess). I've tried using the declick option and that didn't work.

You're on the right track with BASSmix; it will resample "decoding channels". Like BASS, it currently uses linear interpolation on iOS, but it also has an extra filter option (BASS_MIXER_FILTER) that should help.

Regarding the clicking problem, please post your code to see if there is anything in that to cause it. You could also try going back to letting BASS handle the output, but have BASSmix do the resampling (with the filter enabled). That could look something like this...

Code: [Select]
BASS_INFO info;
BASS_GetInfo(&info); // get output device info
mixer=BASS_Mixer_StreamCreate(info.freq, 2, BASS_MIXER_END); // create a mixer with same sample rate
decoder=BASS_StreamCreateFile(FALSE, filename, 0, 0, BASS_STREAM_DECODE); // create a "decoding channel" for the file to play
BASS_Mixer_StreamAddChannel(mixer, decoder, BASS_MIXER_FILTER); // add it to the mixer with extra filtering enabled
BASS_ChannelPlay(mixer, FALSE); // start the mixer

Please see the documentation for details on the aforementioned functions.

skinnyTod

  • Posts: 23
Re: BASS for iOS (iPhone/iPad)
« Reply #359 on: 23 Jan '12 - 20:16 »
-
« Last Edit: 26 Jan '12 - 10:29 by skinnyTod »

sui

  • Guest
Re: BASS for iOS (iPhone/iPad)
« Reply #360 on: 24 Jan '12 - 07:45 »
Streaming AAC from the internet on iOS is pretty complicated. Probably not the best choice for a 1st project :)

The problem is that the buffered file system isn't supported when using a CoreAudio codec (eg. for AAC); if it was supported, you could simply use BASS_StreamCreateURL and not bother with BASS_StreamCreateFileUser. That means you can't use STREAMFILE_BUFFERPUSH in your BASS_StreamCreateFileUser call; FILESYSTEM_NOBUFFER (the unbuffered file system) is the only option available when playing AAC. That introduces another problem in that it expects the data to be available immediately and any delays (eg. waiting for data to download) will block the decoding thread, possibly resulting in breaks in the output, but that can be mitigated by having a dedicated thread hosting the stream decoding. Here's a previous thread on the subject...

   www.un4seen.com/forum/?topic=13185

OK, I read this subject and I try to write a decoding channel. But I need some help to write my callbacks. When I create this stream by calling :

Code: [Select]
decoder = BASS_StreamCreateFileUser(STREAMFILE_BUFFERPUSH, BASS_STREAM_DECODE, &fileprocs, data);
I always get an error (41, BASS_ERROR_FILEFORM), even if I feed 'data' with a MP3 file...

Someone can help me to write my callbacks ? I don't know how to read data from a NSMutableData.

Thanks :)

einsteinx2

  • Posts: 67
Re: BASS for iOS (iPhone/iPad)
« Reply #361 on: 24 Jan '12 - 19:18 »
@sui, In createFileUser, you would generally not send your audio data in the user parameter, that would usually be some identifying information about that stream, or a reference to self so you can access class properties and methods, however you certainly can in the case of reading directly from an NSData object.

As a quick example, you could do a simple stream like this (assuming you have initialized BASS already):

Creating the stream:
Code: [Select]
BASS_FILEPROCS fileProcs = {MyFileCloseProc, MyFileLenProc, MyFileReadProc, MyFileSeekProc}; // callback table
HSTREAM stream = BASS_StreamCreateFileUser(STREAMFILE_NOBUFFER, BASS_STREAM_DECODE, &fileProcs, userInfo); // Note userInfo is a custom object I created to hold information about that stream, it can be anything you want
BASS_ChannelSetSync(fileStream1, BASS_SYNC_FREE, 0, MyStreamFreeCallback, userInfo); // call back I created to release my userInfo object

The callbacks:
Code: [Select]
NSUInteger filePosition = 0;
void CALLBACK MyStreamFreeCallback(HSYNC handle, DWORD channel, DWORD data, void *user)
{
// Stream is done, release the user info object
BassUserInfo *userInfo = (BassUserInfo *)user;
[userInfo release];
// also maybe release your NSData object
}

void CALLBACK MyFileCloseProc(void *user)
{
// Close the file handle
BassUserInfo *userInfo = (BassUserInfo *)user;
//fclose(userInfo.myFileHandle); // Only used if reading from a file, if reading from NSData then not needed
}

QWORD CALLBACK MyFileLenProc(void *user)
{
BassUserInfo *userInfo = (BassUserInfo *)user;
//return [[[NSFileManager defaultManager] attributesOfItemAtPath:userInfo.mySong.localPath error:NULL] fileSize]; // that's for file on disk
return [userInfo.myData length]; // return size of nsdata
}

DWORD CALLBACK MyFileReadProc(void *buffer, DWORD length, void *user)
{
// Read from the file
BassUserInfo *userInfo = (BassUserInfo *)user;
//return fread(buffer, 1, length, userInfo.myFileHandle); // this would be for reading from a file
[userInfo.myData getBytes:buffer range:NSRangeMake(filePosition, length)];
NSUInteger numBytesGrabbed = filePosition + length <= [userInfo.myData length] ? length : [userInfo.myData length] - filePosition;
filePosition += numBytesGrabbed;
return numBytesGrabbed;
}

BOOL CALLBACK MyFileSeekProc(QWORD offset, void *user)
{
// Seek to the requested offset (returns false if data not that large)
BassUserInfo *userInfo = (BassUserInfo *)user;
//return !fseek(userInfo.myFileHandle, offset, SEEK_SET); // this would be for reading from a file
if (offset > [userInfo.myData length])
return NO;
filePosition = offset;
return YES;
}

Note none of this code is tested (I'm reading from files in my own code) but it's adapted directly from my code.

Hope that helps :)
« Last Edit: 24 Jan '12 - 19:34 by einsteinx2 »

einsteinx2

  • Posts: 67
Re: BASS for iOS (iPhone/iPad)
« Reply #362 on: 24 Jan '12 - 19:32 »
@Ian, Sorry, I need to clarify what I wrote. In re-reading it I realize it is misleading.

The sound quality issue I'm having with BASS is for all music played back using BASS to handle the output. It's not the quality of the resampling I'm worried about there (with the exception of those higher than 96KHz files I was having issues with the hiss). For whatever reason, any music played using BASS for the audio output results in about 20-30% lower volume than using Audio Queue Services and has less thickness in the mids and low end, sounding kind of tinny.

At first I was worried it was some problem deep in BASS's audio processing and it was just producing poor quality audio, so to verify, I tried using just the decoded output from a BASS file stream and passing those audio packets to an Audio Queue. That totally fixed the audio quality issues I was experiencing. So it seems like either the Audio Queue does some kind of special processing that BASS's audio output doesn't do, or there is some bug in the way BASS outputs audio on the iOS platform that causes lower volume and perceived quality.

Where I ran into the resampling issue, is when I tried to take non-44.1KHz files decoded with BASS and run them through an Audio Queue at 44.1KHz. First I was getting audio playing at different speeds, then I used BASSMix but got poor results. This is different from the issues I have with >96KHz files, as when passing audio to an audio queue and resampling using BASSMix, even files that played perfectly using BASS's output don't play well now. Essentially anything but 44.1KHz files don't play properly.

I'll try and get a recording today and upload it to your FTP, but here's the code I'm using to resample that's not working. It plays at the correct speed but it very choppy:

Code: [Select]
// Choose the proper sample rate
NSInteger streamSampleRate = [self bassStreamSampleRate:fileStream1];
NSInteger preferredSampleRate = [self preferredSampleRate:streamSampleRate];

// Initialize the audio queue with the preferred sample rate
[self aqsInit:preferredSampleRate];

// Check the actual sample rate and modify the stream if necessary
NSInteger audioQueueSampleRate = [self audioQueueSampleRate];
if (audioQueueSampleRate != streamSampleRate)
{
fileStreamResample1 = BASS_Mixer_StreamCreate(audioQueueSampleRate, 2, BASS_STREAM_DECODE|BASS_MIXER_END);
BASS_Mixer_StreamAddChannel(fileStreamResample1, fileStream1, 0);
}
« Last Edit: 24 Jan '12 - 19:36 by einsteinx2 »

Ian @ un4seen

  • Administrator
  • Posts: 18809
Re: BASS for iOS (iPhone/iPad)
« Reply #363 on: 25 Jan '12 - 13:21 »
Hi - I am trying to track down and fix the cause of a freeze/deadlock issue like the one described here...

To narrow-down the cause, please try running your app under the debugger, and then post each thread's callstack when the deadlock occurs.

OK, I read this subject and I try to write a decoding channel. But I need some help to write my callbacks. When I create this stream by calling :

Code: [Select]
decoder = BASS_StreamCreateFileUser(STREAMFILE_BUFFERPUSH, BASS_STREAM_DECODE, &fileprocs, data);
I always get an error (41, BASS_ERROR_FILEFORM), even if I feed 'data' with a MP3 file...

Someone can help me to write my callbacks ? I don't know how to read data from a NSMutableData.

I'm not sure it's worthwhile bothering with that, as it won't help you to play AAC due to the lack of support for the buffered file system (eg. STREAMFILE_BUFFERPUSH). I'll see if something can be done to add support for the buffered file system (including BASS_StreamCreateURL) when using CoreAudio codecs.

For whatever reason, any music played using BASS for the audio output results in about 20-30% lower volume than using Audio Queue Services and has less thickness in the mids and low end, sounding kind of tinny.

That's strange. Would it be possible to create a little test app to reproduce the problem in order to investigate?

I'll try and get a recording today and upload it to your FTP, but here's the code I'm using to resample that's not working. It plays at the correct speed but it very choppy:

Please also post the code where you're calling BASS_ChannelGetData to get data from the mixer. It sounds like the problem may be in there, eg. perhaps not getting enough data.

Chun-Koo Park

  • Guest
Re: BASS for iOS (iPhone/iPad)
« Reply #364 on: 25 Jan '12 - 14:48 »
I tested BASS library(January 20/mp3_free version), with iOS native AVPlayer.
There is a notable volume difference between the two. I guess mp3_free version's
mp3 decoding uses native iOS decoder, but there's about 6 dB difference in the output.
AVPlayer's output is louder.

BASS_Init(-1, 44000, 0, self, NULL);
chan = BASS_StreamCreateFile(FALSE,[filepath UTF8String],0,0,0);
BASS_ChannelPlay(chan, YES);
//BASS_ChannelSetAttribute(chan, BASS_ATTRIB_VOL, 1.0);

setting the volume to 1.0 produces the same result.
I also tried using 32-bit float output, same result.

Any ideas why the output volume is so different?

Ian @ un4seen

  • Administrator
  • Posts: 18809
Re: BASS for iOS (iPhone/iPad)
« Reply #365 on: 25 Jan '12 - 18:03 »
You're right! Comparing the 2 just now, the BASS output does seem to be around 6dB lower. I'm not sure where that's coming from though (the output mix looks fine). I'll look into it.

einsteinx2

  • Posts: 67
Re: BASS for iOS (iPhone/iPad)
« Reply #366 on: 25 Jan '12 - 21:09 »
You're right! Comparing the 2 just now, the BASS output does seem to be around 6dB lower. I'm not sure where that's coming from though (the output mix looks fine). I'll look into it.

Glad to see you I'm not the only one :P

Also, it doesn't seem to just be the volume, it also has the side affect of the low/mid section not being as "thick" (only word I can think of to describe it) and the high end being extra sharp/tinny, even when adjusting volumes to match (e.g. lowering the volume when using an audio queue to match the BASS volume, then switching back and forth between the two app versions playing the same song).

-------

Regarding my resampling issue, here's the code in my get data method (has extra logic for gapless playback):

Code: [Select]
- (DWORD)bassGetOutputData:(void *)buffer length:(DWORD)length
{
DWORD r;
if (BASSisFilestream1 && BASS_ChannelIsActive(fileStream1))
{
//HSTREAM stream = fileStreamTempo1 ? fileStreamTempo1 : fileStream1;

// Read data from stream1
if (fileStreamTempo1)
r = BASS_ChannelGetData(fileStreamTempo1, buffer, length);
else
r = BASS_ChannelGetData(fileStream1, buffer, length);

// Check if stream1 is now complete
if (!BASS_ChannelIsActive(fileStream1))
{
// Stream1 is done, free the stream
DLog(@"stream 1 is done");
BASS_StreamFree(fileStream1);
if (fileStreamTempo1) BASS_StreamFree(fileStreamTempo1);
fileStreamTempo1 = 0;

// Increment current playlist index
[currPlaylistDAO performSelectorOnMainThread:@selector(incrementIndex) withObject:nil waitUntilDone:YES];

// Send song end notification
[NSNotificationCenter postNotificationToMainThreadWithName:ISMSNotification_SongPlaybackEnded];

// Check to see if there is another song to play
DLog(@"fileStream2: %i", fileStream2);
if (BASS_ChannelIsActive(fileStream2))
{
// Notify Subsonic that this song is being played

DLog(@"TEST starting stream2: %i", fileStream2);

// Send song start notification
[NSNotificationCenter postNotificationToMainThreadWithName:ISMSNotification_SongPlaybackStarted];

// Read data from stream2
[self setStartByteOffset:0];
BASSisFilestream1 = NO;
if (fileStreamTempo2)
r = BASS_ChannelGetData(fileStreamTempo2, buffer, length);
else
r = BASS_ChannelGetData(fileStream2, buffer, length);
DLog(@"error code: %i", BASS_ErrorGetCode());

// Prepare the next song for playback
[self prepareNextSongStreamInBackground];
}
}
}
else if (BASS_ChannelIsActive(fileStream2))
{
// Read data from stream2
if (fileStreamTempo2)
r = BASS_ChannelGetData(fileStreamTempo2, buffer, length);
else
r = BASS_ChannelGetData(fileStream2, buffer, length);

// Check if stream2 is now complete
if (!BASS_ChannelIsActive(fileStream2))
{
// Stream2 is done, free the stream
DLog(@"stream 2 is done");
BASS_StreamFree(fileStream2);
if (fileStreamTempo2) BASS_StreamFree(fileStreamTempo2);
fileStreamTempo2 = 0;

// Increment current playlist index
[currPlaylistDAO performSelectorOnMainThread:@selector(incrementIndex) withObject:nil waitUntilDone:YES];

// Send song done notification
[NSNotificationCenter postNotificationToMainThreadWithName:ISMSNotification_SongPlaybackEnded];

DLog(@"fileStream1: %i", fileStream1);
if (BASS_ChannelIsActive(fileStream1))
{
DLog(@"TEST starting stream1: %i", fileStream1);
// Send song start notification
[NSNotificationCenter postNotificationToMainThreadWithName:ISMSNotification_SongPlaybackStarted];

[self setStartByteOffset:0];
BASSisFilestream1 = YES;
if (fileStreamTempo1)
r = BASS_ChannelGetData(fileStreamTempo1, buffer, length);
else
r = BASS_ChannelGetData(fileStream1, buffer, length);
DLog(@"error code: %i", BASS_ErrorGetCode());

[self prepareNextSongStreamInBackground];
}
}
}
else
{
DLog(@"Stream not active, freeing BASS");
r = BASS_STREAMPROC_END;
[self performSelectorOnMainThread:@selector(bassFree) withObject:nil waitUntilDone:NO];
}

return r;
}

And my file read proc for the original stream is just calling fread(buffer, 1, length, userInfo.myFileHandle); and returning it's return value.

sui

  • Guest
Re: BASS for iOS (iPhone/iPad)
« Reply #367 on: 26 Jan '12 - 09:17 »
Thanks einsteinx2, I am now able to play an AAC from remote source. Do you know if it is possible to stream an AAC starting to an offset ? Like BASS_StreamCreateURL(
    char *url,
    DWORD offset,
    DWORD flags,
    DOWNLOADPROC *proc,
    void *user
);

einsteinx2

  • Posts: 67
Re: BASS for iOS (iPhone/iPad)
« Reply #368 on: 26 Jan '12 - 22:36 »
@sui, I haven't used BASS_StreamCreateURL because I'm doing the downloading myself, but it seems like there are some issues starting an aac file from the middle. I believe you have to start on a frame boundary or it doesn't work. In any case, I haven't been able to get a BASS file stream created from an AAC file that was downloaded in the middle. Working on that now actually.

einsteinx2

  • Posts: 67
Re: BASS for iOS (iPhone/iPad)
« Reply #369 on: 27 Jan '12 - 00:57 »
@Ian, strangely, the resampling seems to be working perfectly now! No idea why it's working now and it was playing so poorly before, as I didn't change anything in that area. Maybe something else I did over the course of the last two days fixed it, I must have been blocking the read thread in some way.

Also using the filter option drastically improved playback of very high sample rate files, so that seems to be fixed as well.

The only issue I have left now is that I can't start AAC files from within the middle of the file. So for example if someone wants to skip further into the song than has downloaded, I start a new download at the position they want to listen, and try and play that. BASS never seems to properly recognize that it's an AAC file though and fails to play. Doing that with other file types works fine though.

Btw, I want to thank you for being so active on your forum and providing all the help that you do. BASS is an amazingly powerful audio library, but I wouldn't have been able to use it were it not for all your help. 8)
« Last Edit: 27 Jan '12 - 01:13 by einsteinx2 »

Ian @ un4seen

  • Administrator
  • Posts: 18809
Re: BASS for iOS (iPhone/iPad)
« Reply #370 on: 27 Jan '12 - 18:17 »
@Ian, strangely, the resampling seems to be working perfectly now! No idea why it's working now and it was playing so poorly before, as I didn't change anything in that area. Maybe something else I did over the course of the last two days fixed it, I must have been blocking the read thread in some way.

Also using the filter option drastically improved playback of very high sample rate files, so that seems to be fixed as well.

Good to hear :)

The only issue I have left now is that I can't start AAC files from within the middle of the file. So for example if someone wants to skip further into the song than has downloaded, I start a new download at the position they want to listen, and try and play that. BASS never seems to properly recognize that it's an AAC file though and fails to play. Doing that with other file types works fine though.

BASS leaves the AAC detection to the CoreAudio codec/parser, but it does appear that the CoreAudio AAC codec/parser won't accept data that doesn't begin on a frame boundary. Here's an update to try, in which BASS will look for a frame for it...

   www.un4seen.com/stuff/libbass.a

This update should also sort the volume level issue. Please check if you still hear the low/mid section problem you mentioned with it, and if so, upload a file that is particularly affected to test with...

   ftp.un4seen.com/incoming/

mix1009

  • Posts: 9
Re: BASS for iOS (iPhone/iPad)
« Reply #371 on: 28 Jan '12 - 01:36 »
This update should also sort the volume level issue. Please check if you still hear the low/mid section problem you mentioned with it, and if so, upload a file that is particularly affected to test with...

Could you check if you updated the simulator version. On simulator the 6dB volume difference still exists.
I don't have usb cable now, so i'll test on device when i get hold of one.

thank you.

mix1009

  • Posts: 9
Re: BASS for iOS (iPhone/iPad)
« Reply #372 on: 28 Jan '12 - 06:28 »
This update should also sort the volume level issue. Please check if you still hear the low/mid section problem you mentioned with it, and if so, upload a file that is particularly affected to test with...

Could you check if you updated the simulator version. On simulator the 6dB volume difference still exists.
I don't have usb cable now, so i'll test on device when i get hold of one.

thank you.

I tested on my iPhone4S/iPad2 and the volume is still about 6dB lower.
I did not notice any distortion in sound, it's just lower.

Ian @ un4seen

  • Administrator
  • Posts: 18809
Re: BASS for iOS (iPhone/iPad)
« Reply #373 on: 30 Jan '12 - 14:46 »
That's strange. Are you definitely linking with the updated library? You can use BASS_GetVersion to check that: it should return 0x0204080A.

mix1009

  • Posts: 9
Re: BASS for iOS (iPhone/iPad)
« Reply #374 on: 30 Jan '12 - 23:01 »
That's strange. Are you definitely linking with the updated library? You can use BASS_GetVersion to check that: it should return 0x0204080A.

My xcode project was messed up.

It's now working :) Thank you.
« Last Edit: 31 Jan '12 - 00:04 by mix1009 »