Re: Data Types for Extracting samples from Audio Buffer: Resolved
Re: Data Types for Extracting samples from Audio Buffer: Resolved
- Subject: Re: Data Types for Extracting samples from Audio Buffer: Resolved
- From: Joseph Ayers <email@hidden>
- Date: Mon, 06 Oct 2008 10:46:11 -0400
Graham:
Bingo.....
With
float *ippointer = (float *)abl->mBuffers[0].mData;
float *idpointer = (float *)abl->mBuffers[1].mData;
ipbuf = [[NSMutableArray alloc] init];
idbuf = [[NSMutableArray alloc] init];
NSNumber* ipsamp = [[NSNumber alloc] init];
NSNumber* idsamp = [[NSNumber alloc] init];
nsamples = (abl->mBuffers[0].mDataByteSize)/4;
for (isamp = 0; isamp<nsamples; ++isamp){
ipsamp = [NSNumber numberWithFloat:(float)ippointer[isamp]];
[ipbufaddObject:ipsamp];
idsamp = [NSNumber numberWithFloat:(float)idpointer[isamp]];
[idbufaddObject:idsamp];
if (isamp < 100) {
NSLog(@" isamp %d ipsamp %@ idsamp %@",isamp,ipsamp,idsamp);
}
}
I get:
2008-10-06 10:43:07.702 Roboplasm[1898:813] isamp 0 ipsamp
0.003356934 idsamp 0.003631592
2008-10-06 10:43:07.702 Roboplasm[1898:813] isamp 1 ipsamp
0.003692627 idsamp 0.004180908
2008-10-06 10:43:07.702 Roboplasm[1898:813] isamp 2 ipsamp
0.004455566 idsamp 0.005157471
2008-10-06 10:43:07.703 Roboplasm[1898:813] isamp 3 ipsamp
0.004394531 idsamp 0.00680542
2008-10-06 10:43:07.703 Roboplasm[1898:813] isamp 4 ipsamp
0.003295898 idsamp 0.00769043
2008-10-06 10:43:07.703 Roboplasm[1898:813] isamp 5 ipsamp
0.002319336 idsamp 0.007324219
2008-10-06 10:43:07.704 Roboplasm[1898:813] isamp 6 ipsamp
0.002227783 idsamp 0.007232666
2008-10-06 10:43:07.705 Roboplasm[1898:813] isamp 7 ipsamp
0.002502441 idsamp 0.008422852
2008-10-06 10:43:07.706 Roboplasm[1898:813] isamp 8 ipsamp
0.002868652 idsamp 0.009490967
2008-10-06 10:43:07.706 Roboplasm[1898:813] isamp 9 ipsamp
0.003631592 idsamp 0.008728027
2008-10-06 10:43:07.706 Roboplasm[1898:813] isamp 10 ipsamp
0.004272461 idsamp 0.007019043
2008-10-06 10:43:07.707 Roboplasm[1898:813] isamp 11 ipsamp
0.004058838 idsamp 0.006469727
2008-10-06 10:43:07.707 Roboplasm[1898:813] isamp 12 ipsamp
0.003112793 idsamp 0.007385254
2008-10-06 10:43:07.707 Roboplasm[1898:813] isamp 13 ipsamp
0.002319336 idsamp 0.008453369
2008-10-06 10:43:07.707 Roboplasm[1898:813] isamp 14 ipsamp
0.002349854 idsamp 0.009155273
2008-10-06 10:43:07.708 Roboplasm[1898:813] isamp 15 ipsamp
0.003295898 idsamp 0.009643555
2008-10-06 10:43:07.708 Roboplasm[1898:813] isamp 16 ipsamp
0.004699707 idsamp 0.009613037
2008-10-06 10:43:07.708 Roboplasm[1898:813] isamp 17 ipsamp
0.005737305 idsamp 0.009124756
2008-10-06 10:43:07.709 Roboplasm[1898:813] isamp 18 ipsamp
0.006103516 idsamp 0.009033203
2008-10-06 10:43:07.709 Roboplasm[1898:813] isamp 19 ipsamp
0.005981445 idsamp 0.009246826
2008-10-06 10:43:07.711 Roboplasm[1898:813] isamp 20 ipsamp
0.005767822 idsamp 0.008728027
2008-10-06 10:43:07.711 Roboplasm[1898:813] isamp 21 ipsamp
0.006011963 idsamp 0.007904053
2008-10-06 10:43:07.712 Roboplasm[1898:813] isamp 22 ipsamp
0.007171631 idsamp 0.00793457
2008-10-06 10:43:07.713 Roboplasm[1898:813] isamp 23 ipsamp
0.008636475 idsamp 0.008300781
2008-10-06 10:43:07.714 Roboplasm[1898:813] isamp 24 ipsamp
0.009216309 idsamp 0.008209229
2008-10-06 10:43:07.715 Roboplasm[1898:813] isamp 25 ipsamp
0.008880615 idsamp 0.008453369
2008-10-06 10:43:07.715 Roboplasm[1898:813] isamp 26 ipsamp
0.008880615 idsamp 0.009552002
2008-10-06 10:43:07.716 Roboplasm[1898:813] isamp 27 ipsamp
0.00982666 idsamp 0.009918213
2008-10-06 10:43:07.717 Roboplasm[1898:813] isamp 28 ipsamp
0.01037598 idsamp 0.008880615
2008-10-06 10:43:07.718 Roboplasm[1898:813] isamp 29 ipsamp
0.009460449 idsamp 0.007843018
2008-10-06 10:43:07.718 Roboplasm[1898:813] isamp 30 ipsamp
0.008148193 idsamp 0.007781982
2008-10-06 10:43:07.719 Roboplasm[1898:813] isamp 31 ipsamp
0.008026123 idsamp 0.007965088
2008-10-06 10:43:07.720 Roboplasm[1898:813] isamp 32 ipsamp
0.00869751 idsamp 0.007965088
2008-10-06 10:43:07.721 Roboplasm[1898:813] isamp 33 ipsamp
0.009124756 idsamp 0.008392334
2008-10-06 10:43:07.722 Roboplasm[1898:813] isamp 34 ipsamp
0.009185791 idsamp 0.009399414
2008-10-06 10:43:07.722 Roboplasm[1898:813] isamp 35 ipsamp
0.00869751 idsamp 0.01043701
2008-10-06 10:43:07.723 Roboplasm[1898:813] isamp 36 ipsamp 0.0078125
idsamp 0.01104736
2008-10-06 10:43:07.724 Roboplasm[1898:813] isamp 37 ipsamp 0.0078125
idsamp 0.01086426
2008-10-06 10:43:07.725 Roboplasm[1898:813] isamp 38 ipsamp
0.009277344 idsamp 0.009918213
2008-10-06 10:43:07.725 Roboplasm[1898:813] isamp 39 ipsamp
0.01062012 idsamp 0.008911133
2008-10-06 10:43:07.726 Roboplasm[1898:813] isamp 40 ipsamp
0.01055908 idsamp 0.008453369
2008-10-06 10:43:07.727 Roboplasm[1898:813] isamp 41 ipsamp
0.01055908 idsamp 0.008117676
2008-10-06 10:43:07.728 Roboplasm[1898:813] isamp 42 ipsamp
0.01177979 idsamp 0.007476807
2008-10-06 10:43:07.728 Roboplasm[1898:813] isamp 43 ipsamp
0.01272583 idsamp 0.007171631
2008-10-06 10:43:07.729 Roboplasm[1898:813] isamp 44 ipsamp 0.012146
idsamp 0.007751465
2008-10-06 10:43:07.730 Roboplasm[1898:813] isamp 45 ipsamp
0.01119995 idsamp 0.008331299
2008-10-06 10:43:07.731 Roboplasm[1898:813] isamp 46 ipsamp
0.01107788 idsamp 0.007873535
2008-10-06 10:43:07.731 Roboplasm[1898:813] isamp 47 ipsamp
0.01092529 idsamp 0.007110596
2008-10-06 10:43:07.732 Roboplasm[1898:813] isamp 48 ipsamp
0.01000977 idsamp 0.007446289
2008-10-06 10:43:07.733 Roboplasm[1898:813] isamp 49 ipsamp
0.009338379 idsamp 0.008605957
2008-10-06 10:43:07.734 Roboplasm[1898:813] isamp 50 ipsamp
0.009490967 idsamp 0.008758545
2008-10-06 10:43:07.735 Roboplasm[1898:813] isamp 51 ipsamp
0.00970459 idsamp 0.007080078
2008-10-06 10:43:07.744 Roboplasm[1898:813] isamp 52 ipsamp
0.01000977 idsamp 0.004852295
2008-10-06 10:43:07.744 Roboplasm[1898:813] isamp 53 ipsamp
0.01141357 idsamp 0.003631592
2008-10-06 10:43:07.745 Roboplasm[1898:813] isamp 54 ipsamp
0.01324463 idsamp 0.003326416
2008-10-06 10:43:07.745 Roboplasm[1898:813] isamp 55 ipsamp
0.01397705 idsamp 0.002838135
2008-10-06 10:43:07.745 Roboplasm[1898:813] isamp 56 ipsamp 0.0138855
idsamp 0.002075195
2008-10-06 10:43:07.746 Roboplasm[1898:813] isamp 57 ipsamp 0.0140686
idsamp 0.001739502
2008-10-06 10:43:07.746 Roboplasm[1898:813] isamp 58 ipsamp
0.01422119 idsamp 0.001403809
2008-10-06 10:43:07.746 Roboplasm[1898:813] isamp 59 ipsamp
0.01397705 idsamp 0.0004577637
2008-10-06 10:43:07.746 Roboplasm[1898:813] isamp 60 ipsamp
0.01394653 idsamp -0.0001220703
2008-10-06 10:43:07.747 Roboplasm[1898:813] isamp 61 ipsamp
0.01403809 idsamp 0.0005187988
2008-10-06 10:43:07.747 Roboplasm[1898:813] isamp 62 ipsamp
0.01364136 idsamp 0.00112915
2008-10-06 10:43:07.747 Roboplasm[1898:813] isamp 63 ipsamp
0.01333618 idsamp 0.0005493164
2008-10-06 10:43:07.752 Roboplasm[1898:813] isamp 64 ipsamp
0.01400757 idsamp -0.0003967285
2008-10-06 10:43:07.754 Roboplasm[1898:813] isamp 65 ipsamp
0.01470947 idsamp -0.0008239746
2008-10-06 10:43:07.754 Roboplasm[1898:813] isamp 66 ipsamp
0.01403809 idsamp -0.00112915
2008-10-06 10:43:07.755 Roboplasm[1898:813] isamp 67 ipsamp
0.01242065 idsamp -0.001617432
2008-10-06 10:43:07.757 Roboplasm[1898:813] isamp 68 ipsamp
0.01098633 idsamp -0.002258301
2008-10-06 10:43:07.757 Roboplasm[1898:813] isamp 69 ipsamp
0.01037598 idsamp -0.00302124
2008-10-06 10:43:07.757 Roboplasm[1898:813] isamp 70 ipsamp
0.01077271 idsamp -0.004089355
2008-10-06 10:43:07.758 Roboplasm[1898:813] isamp 71 ipsamp
0.01229858 idsamp -0.005737305
2008-10-06 10:43:07.758 Roboplasm[1898:813] isamp 72 ipsamp
0.01431274 idsamp -0.0078125
2008-10-06 10:43:07.758 Roboplasm[1898:813] isamp 73 ipsamp
0.01565552 idsamp -0.009185791
2008-10-06 10:43:07.759 Roboplasm[1898:813] isamp 74 ipsamp
0.01574707 idsamp -0.009094238
2008-10-06 10:43:07.759 Roboplasm[1898:813] isamp 75 ipsamp 0.0151062
idsamp -0.008209229
2008-10-06 10:43:07.761 Roboplasm[1898:813] isamp 76 ipsamp
0.01443481 idsamp -0.007568359
2008-10-06 10:43:07.761 Roboplasm[1898:813] isamp 77 ipsamp
0.01391602 idsamp -0.007354736
2008-10-06 10:43:07.762 Roboplasm[1898:813] isamp 78 ipsamp
0.01348877 idsamp -0.007720947
2008-10-06 10:43:07.762 Roboplasm[1898:813] isamp 79 ipsamp
0.01315308 idsamp -0.008880615
2008-10-06 10:43:07.763 Roboplasm[1898:813] isamp 80 ipsamp
0.01275635 idsamp -0.0100708
2008-10-06 10:43:07.764 Roboplasm[1898:813] isamp 81 ipsamp 0.012146
idsamp -0.01049805
2008-10-06 10:43:07.764 Roboplasm[1898:813] isamp 82 ipsamp
0.01168823 idsamp -0.0105896
2008-10-06 10:43:07.765 Roboplasm[1898:813] isamp 83 ipsamp
0.01208496 idsamp -0.01119995
2008-10-06 10:43:07.766 Roboplasm[1898:813] isamp 84 ipsamp
0.01333618 idsamp -0.012146
2008-10-06 10:43:07.766 Roboplasm[1898:813] isamp 85 ipsamp
0.01419067 idsamp -0.0128479
2008-10-06 10:43:07.767 Roboplasm[1898:813] isamp 86 ipsamp 0.0138855
idsamp -0.01358032
2008-10-06 10:43:07.768 Roboplasm[1898:813] isamp 87 ipsamp 0.0133667
idsamp -0.01428223
2008-10-06 10:43:07.768 Roboplasm[1898:813] isamp 88 ipsamp
0.01324463 idsamp -0.01370239
2008-10-06 10:43:07.769 Roboplasm[1898:813] isamp 89 ipsamp
0.01293945 idsamp -0.0118103
2008-10-06 10:43:07.769 Roboplasm[1898:813] isamp 90 ipsamp
0.01257324 idsamp -0.01083374
2008-10-06 10:43:07.770 Roboplasm[1898:813] isamp 91 ipsamp
0.01260376 idsamp -0.01223755
2008-10-06 10:43:07.772 Roboplasm[1898:813] isamp 92 ipsamp
0.01235962 idsamp -0.01419067
2008-10-06 10:43:07.772 Roboplasm[1898:813] isamp 93 ipsamp
0.01116943 idsamp -0.01464844
2008-10-06 10:43:07.773 Roboplasm[1898:813] isamp 94 ipsamp
0.01004028 idsamp -0.01446533
2008-10-06 10:43:07.773 Roboplasm[1898:813] isamp 95 ipsamp
0.009887695 idsamp -0.01516724
2008-10-06 10:43:07.773 Roboplasm[1898:813] isamp 96 ipsamp
0.00994873 idsamp -0.0161438
2008-10-06 10:43:07.774 Roboplasm[1898:813] isamp 97 ipsamp
0.009735107 idsamp -0.0163269
2008-10-06 10:43:07.774 Roboplasm[1898:813] isamp 98 ipsamp
0.009307861 idsamp -0.01629639
2008-10-06 10:43:07.774 Roboplasm[1898:813] isamp 99 ipsamp
0.008300781 idsamp -0.01669312
This looks like the real thing.
Many thanks,
Joseph
On Oct 6, 2008, at 10:15 AM, Graham Cox wrote:
On 7 Oct 2008, at 12:34 am, Graham Cox wrote:
2008-10-06 09:08:03.109 Roboplasm[33253:813] format flags = 41
[]
2008-10-06 09:08:03.111 Roboplasm[33253:813] bits/channel =
32
format flags = 41 = 0x29 = 0b101001
flags:
enum
{
kAudioFormatFlagIsFloat = (1L << 0), //
<------ 1
kAudioFormatFlagIsBigEndian = (1L << 1), //
<------ 0
kAudioFormatFlagIsSignedInteger = (1L << 2), //
<------ 0
kAudioFormatFlagIsPacked = (1L << 3), //
<------ 1
kAudioFormatFlagIsAlignedHigh = (1L << 4), //
<------ 0
kAudioFormatFlagIsNonInterleaved = (1L << 5), //
<------ 1
kAudioFormatFlagIsNonMixable = (1L << 6),
kAudioFormatFlagsAreAllClear = (1L << 31)
};
Thus we have:
kAudioFormatFlagIsFloat | kAudioFormatFlagIsPacked |
kAudioFormatFlagIsNonInterleaved;
so you have 32 bit float values for each sample. Divide the byte
count by 4 and use [NSNumber numberWithFloat:], and use a float*
pointer type.
Note - the docs also state that this is the default format you get
from the audio extraction API.
hth,
Graham
Joseph Ayers, Professor
Department of Biology and
Marine Science Center
Northeastern University
East Point, Nahant, MA 01908
Phone (781) 581-7370 x309(office), x335(lab)
Boston: 444 Richards Hall (617) 373-4044
Cellular (617) 755-7523, FAX: (781) 581-6076
eMail: email@hidden
http://www.neurotechnology.neu.edu/
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden