Re: Data Types for Extracting samples from Audio Buffer
Re: Data Types for Extracting samples from Audio Buffer
- Subject: Re: Data Types for Extracting samples from Audio Buffer
- From: Joseph Ayers <email@hidden>
- Date: Mon, 06 Oct 2008 09:12:44 -0400
That doesn't seem to be it.
The audio extraction interface
http://developer.apple.com/quicktime/audioextraction.html
returns:
2008-10-06 09:08:03.106 Roboplasm[33253:813] format flags = 41
2008-10-06 09:08:03.106 Roboplasm[33253:813] sample rate =
48000.000000
2008-10-06 09:08:03.107 Roboplasm[33253:813] bytes/packet = 4
2008-10-06 09:08:03.108 Roboplasm[33253:813] frames/packe = 1
2008-10-06 09:08:03.108 Roboplasm[33253:813] bytes/frame = 4
2008-10-06 09:08:03.109 Roboplasm[33253:813] channels/frame = 2
2008-10-06 09:08:03.109 Roboplasm[33253:813] bits/channel = 32
2008-10-06 09:08:03.109 Roboplasm[33253:813] format flags = 41
2008-10-06 09:08:03.110 Roboplasm[33253:813] sample rate =
48000.000000
2008-10-06 09:08:03.110 Roboplasm[33253:813] bytes/packet = 4
2008-10-06 09:08:03.110 Roboplasm[33253:813] frames/packet = 1
2008-10-06 09:08:03.110 Roboplasm[33253:813] bytes/frame = 4
2008-10-06 09:08:03.111 Roboplasm[33253:813] channels/frame = 2
2008-10-06 09:08:03.111 Roboplasm[33253:813] bits/channel = 32
Indicating that there are two bytes per channel.
Results from
unsigned long *ippointer = (unsigned long *)abl->mBuffers[0].mData;
unsigned long *idpointer = (unsigned long *)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 numberWithUnsignedLong:(unsigned
long)ippointer[isamp]];
[ipbufaddObject:ipsamp];
idsamp = [NSNumber numberWithUnsignedLong:(unsigned
long)idpointer[isamp]];
[idbufaddObject:idsamp];
if (isamp < 100) {
NSLog(@" isamp %d ipsamp %@ idsamp %@",isamp,ipsamp,idsamp);
}
}
Are:
2008-10-06 09:08:03.150 Roboplasm[33253:813] isamp 0 ipsamp 995885056
idsamp 997064704
2008-10-06 09:08:03.152 Roboplasm[33253:813] isamp 1 ipsamp 997326848
idsamp 998834176
2008-10-06 09:08:03.152 Roboplasm[33253:813] isamp 2 ipsamp 999424000
idsamp 1000931328
2008-10-06 09:08:03.152 Roboplasm[33253:813] isamp 3 ipsamp 999292928
idsamp 1004470272
2008-10-06 09:08:03.153 Roboplasm[33253:813] isamp 4 ipsamp 995622912
idsamp 1006370816
2008-10-06 09:08:03.153 Roboplasm[33253:813] isamp 5 ipsamp 991428608
idsamp 1005584384
2008-10-06 09:08:03.153 Roboplasm[33253:813] isamp 6 ipsamp 991035392
idsamp 1005387776
2008-10-06 09:08:03.154 Roboplasm[33253:813] isamp 7 ipsamp 992215040
idsamp 1007288320
2008-10-06 09:08:03.154 Roboplasm[33253:813] isamp 8 ipsamp 993787904
idsamp 1008435200
2008-10-06 09:08:03.154 Roboplasm[33253:813] isamp 9 ipsamp 997064704
idsamp 1007616000
2008-10-06 09:08:03.154 Roboplasm[33253:813] isamp 10 ipsamp
999030784 idsamp 1004929024
2008-10-06 09:08:03.155 Roboplasm[33253:813] isamp 11 ipsamp
998572032 idsamp 1003749376
2008-10-06 09:08:03.155 Roboplasm[33253:813] isamp 12 ipsamp
994836480 idsamp 1005715456
2008-10-06 09:08:03.158 Roboplasm[33253:813] isamp 13 ipsamp
991428608 idsamp 1007321088
2008-10-06 09:08:03.158 Roboplasm[33253:813] isamp 14 ipsamp
991559680 idsamp 1008074752
2008-10-06 09:08:03.158 Roboplasm[33253:813] isamp 15 ipsamp
995622912 idsamp 1008599040
2008-10-06 09:08:03.159 Roboplasm[33253:813] isamp 16 ipsamp
999948288 idsamp 1008566272
2008-10-06 09:08:03.159 Roboplasm[33253:813] isamp 17 ipsamp
1002176512 idsamp 1008041984
2008-10-06 09:08:03.159 Roboplasm[33253:813] isamp 18 ipsamp
1002962944 idsamp 1007943680
2008-10-06 09:08:03.160 Roboplasm[33253:813] isamp 19 ipsamp
1002700800 idsamp 1008173056
2008-10-06 09:08:03.160 Roboplasm[33253:813] isamp 20 ipsamp
1002242048 idsamp 1007616000
2008-10-06 09:08:03.160 Roboplasm[33253:813] isamp 21 ipsamp
1002766336 idsamp 1006731264
2008-10-06 09:08:03.160 Roboplasm[33253:813] isamp 22 ipsamp
1005256704 idsamp 1006764032
2008-10-06 09:08:03.161 Roboplasm[33253:813] isamp 23 ipsamp
1007517696 idsamp 1007157248
2008-10-06 09:08:03.161 Roboplasm[33253:813] isamp 24 ipsamp
1008140288 idsamp 1007058944
2008-10-06 09:08:03.162 Roboplasm[33253:813] isamp 25 ipsamp
1007779840 idsamp 1007321088
2008-10-06 09:08:03.162 Roboplasm[33253:813] isamp 26 ipsamp
1007779840 idsamp 1008500736
2008-10-06 09:08:03.163 Roboplasm[33253:813] isamp 27 ipsamp
1008795648 idsamp 1008893952
2008-10-06 09:08:03.163 Roboplasm[33253:813] isamp 28 ipsamp
1009385472 idsamp 1007779840
2008-10-06 09:08:03.163 Roboplasm[33253:813] isamp 29 ipsamp
1008402432 idsamp 1006665728
2008-10-06 09:08:03.163 Roboplasm[33253:813] isamp 30 ipsamp
1006993408 idsamp 1006567424
2008-10-06 09:08:03.164 Roboplasm[33253:813] isamp 31 ipsamp
1006862336 idsamp 1006796800
2008-10-06 09:08:03.164 Roboplasm[33253:813] isamp 32 ipsamp
1007583232 idsamp 1006796800
2008-10-06 09:08:03.164 Roboplasm[33253:813] isamp 33 ipsamp
1008041984 idsamp 1007255552
2008-10-06 09:08:03.165 Roboplasm[33253:813] isamp 34 ipsamp
1008107520 idsamp 1008336896
2008-10-06 09:08:03.170 Roboplasm[33253:813] isamp 35 ipsamp
1007583232 idsamp 1009451008
2008-10-06 09:08:03.173 Roboplasm[33253:813] isamp 36 ipsamp
1006632960 idsamp 1010106368
2008-10-06 09:08:03.174 Roboplasm[33253:813] isamp 37 ipsamp
1006632960 idsamp 1009909760
2008-10-06 09:08:03.174 Roboplasm[33253:813] isamp 38 ipsamp
1008205824 idsamp 1008893952
2008-10-06 09:08:03.174 Roboplasm[33253:813] isamp 39 ipsamp
1009647616 idsamp 1007812608
2008-10-06 09:08:03.175 Roboplasm[33253:813] isamp 40 ipsamp
1009582080 idsamp 1007321088
2008-10-06 09:08:03.175 Roboplasm[33253:813] isamp 41 ipsamp
1009582080 idsamp 1006960640
2008-10-06 09:08:03.175 Roboplasm[33253:813] isamp 42 ipsamp
1010892800 idsamp 1005912064
2008-10-06 09:08:03.175 Roboplasm[33253:813] isamp 43 ipsamp
1011908608 idsamp 1005256704
2008-10-06 09:08:03.176 Roboplasm[33253:813] isamp 44 ipsamp
1011286016 idsamp 1006501888
2008-10-06 09:08:03.176 Roboplasm[33253:813] isamp 45 ipsamp
1010270208 idsamp 1007190016
2008-10-06 09:08:03.176 Roboplasm[33253:813] isamp 46 ipsamp
1010139136 idsamp 1006698496
2008-10-06 09:08:03.183 Roboplasm[33253:813] isamp 47 ipsamp
1009975296 idsamp 1005125632
2008-10-06 09:08:03.184 Roboplasm[33253:813] isamp 48 ipsamp
1008992256 idsamp 1005846528
2008-10-06 09:08:03.185 Roboplasm[33253:813] isamp 49 ipsamp
1008271360 idsamp 1007484928
2008-10-06 09:08:03.185 Roboplasm[33253:813] isamp 50 ipsamp
1008435200 idsamp 1007648768
2008-10-06 09:08:03.185 Roboplasm[33253:813] isamp 51 ipsamp
1008664576 idsamp 1005060096
2008-10-06 09:08:03.186 Roboplasm[33253:813] isamp 52 ipsamp
1008992256 idsamp 1000275968
2008-10-06 09:08:03.187 Roboplasm[33253:813] isamp 53 ipsamp
1010499584 idsamp 997064704
2008-10-06 09:08:03.188 Roboplasm[33253:813] isamp 54 ipsamp
1012465664 idsamp 995753984
2008-10-06 09:08:03.188 Roboplasm[33253:813] isamp 55 ipsamp
1013252096 idsamp 993656832
2008-10-06 09:08:03.188 Roboplasm[33253:813] isamp 56 ipsamp
1013153792 idsamp 990380032
2008-10-06 09:08:03.189 Roboplasm[33253:813] isamp 57 ipsamp
1013350400 idsamp 988020736
2008-10-06 09:08:03.189 Roboplasm[33253:813] isamp 58 ipsamp
1013514240 idsamp 985137152
2008-10-06 09:08:03.193 Roboplasm[33253:813] isamp 59 ipsamp
1013252096 idsamp 972029952
2008-10-06 09:08:03.194 Roboplasm[33253:813] isamp 60 ipsamp
1013219328 idsamp 3103784960
2008-10-06 09:08:03.194 Roboplasm[33253:813] isamp 61 ipsamp
1013317632 idsamp 973602816
2008-10-06 09:08:03.195 Roboplasm[33253:813] isamp 62 ipsamp
1012891648 idsamp 982777856
2008-10-06 09:08:03.196 Roboplasm[33253:813] isamp 63 ipsamp
1012563968 idsamp 974127104
2008-10-06 09:08:03.196 Roboplasm[33253:813] isamp 64 ipsamp
1013284864 idsamp 3117416448
2008-10-06 09:08:03.197 Roboplasm[33253:813] isamp 65 ipsamp
1014038528 idsamp 3126329344
2008-10-06 09:08:03.198 Roboplasm[33253:813] isamp 66 ipsamp
1013317632 idsamp 3130261504
2008-10-06 09:08:03.199 Roboplasm[33253:813] isamp 67 ipsamp
1011580928 idsamp 3134455808
2008-10-06 09:08:03.199 Roboplasm[33253:813] isamp 68 ipsamp
1010040832 idsamp 3138650112
2008-10-06 09:08:03.199 Roboplasm[33253:813] isamp 69 ipsamp
1009385472 idsamp 3141926912
2008-10-06 09:08:03.200 Roboplasm[33253:813] isamp 70 ipsamp
1009811456 idsamp 3146121216
2008-10-06 09:08:03.200 Roboplasm[33253:813] isamp 71 ipsamp
1011449856 idsamp 3149660160
2008-10-06 09:08:03.200 Roboplasm[33253:813] isamp 72 ipsamp
1013612544 idsamp 3154116608
2008-10-06 09:08:03.201 Roboplasm[33253:813] isamp 73 ipsamp
1015037952 idsamp 3155591168
2008-10-06 09:08:03.201 Roboplasm[33253:813] isamp 74 ipsamp
1015087104 idsamp 3155492864
2008-10-06 09:08:03.201 Roboplasm[33253:813] isamp 75 ipsamp
1014464512 idsamp 3154542592
2008-10-06 09:08:03.202 Roboplasm[33253:813] isamp 76 ipsamp
1013743616 idsamp 3153592320
2008-10-06 09:08:03.202 Roboplasm[33253:813] isamp 77 ipsamp
1013186560 idsamp 3153133568
2008-10-06 09:08:03.202 Roboplasm[33253:813] isamp 78 ipsamp
1012727808 idsamp 3153920000
2008-10-06 09:08:03.203 Roboplasm[33253:813] isamp 79 ipsamp
1012367360 idsamp 3155263488
2008-10-06 09:08:03.203 Roboplasm[33253:813] isamp 80 ipsamp
1011941376 idsamp 3156541440
2008-10-06 09:08:03.203 Roboplasm[33253:813] isamp 81 ipsamp
1011286016 idsamp 3157000192
2008-10-06 09:08:03.204 Roboplasm[33253:813] isamp 82 ipsamp
1010794496 idsamp 3157098496
2008-10-06 09:08:03.204 Roboplasm[33253:813] isamp 83 ipsamp
1011220480 idsamp 3157753856
2008-10-06 09:08:03.204 Roboplasm[33253:813] isamp 84 ipsamp
1012563968 idsamp 3158769664
2008-10-06 09:08:03.205 Roboplasm[33253:813] isamp 85 ipsamp
1013481472 idsamp 3159523328
2008-10-06 09:08:03.206 Roboplasm[33253:813] isamp 86 ipsamp
1013153792 idsamp 3160309760
2008-10-06 09:08:03.207 Roboplasm[33253:813] isamp 87 ipsamp
1012596736 idsamp 3161063424
2008-10-06 09:08:03.208 Roboplasm[33253:813] isamp 88 ipsamp
1012465664 idsamp 3160440832
2008-10-06 09:08:03.208 Roboplasm[33253:813] isamp 89 ipsamp
1012137984 idsamp 3158409216
2008-10-06 09:08:03.209 Roboplasm[33253:813] isamp 90 ipsamp
1011744768 idsamp 3157360640
2008-10-06 09:08:03.210 Roboplasm[33253:813] isamp 91 ipsamp
1011777536 idsamp 3158867968
2008-10-06 09:08:03.211 Roboplasm[33253:813] isamp 92 ipsamp
1011515392 idsamp 3160965120
2008-10-06 09:08:03.212 Roboplasm[33253:813] isamp 93 ipsamp
1010237440 idsamp 3161456640
2008-10-06 09:08:03.212 Roboplasm[33253:813] isamp 94 ipsamp
1009025024 idsamp 3161260032
2008-10-06 09:08:03.213 Roboplasm[33253:813] isamp 95 ipsamp
1008861184 idsamp 3162013696
2008-10-06 09:08:03.213 Roboplasm[33253:813] isamp 96 ipsamp
1008926720 idsamp 3162783744
2008-10-06 09:08:03.213 Roboplasm[33253:813] isamp 97 ipsamp
1008697344 idsamp 3162882048
2008-10-06 09:08:03.214 Roboplasm[33253:813] isamp 98 ipsamp
1008238592 idsamp 3162865664
2008-10-06 09:08:03.214 Roboplasm[33253:813] isamp 99 ipsamp
1007157248 idsamp 3163078656
Many thanks:
Joseph
On Oct 6, 2008, at 9:01 AM, Graham Cox wrote:
On 6 Oct 2008, at 11:45 pm, Joseph Ayers wrote:
Note the occurrence of samples with the value of 0 alternating with
samples that are reasonable. However,
this alternation is not rigid as the 0's can be substituted with
reasonable numbers.
Any idea what's going on here?
Are you *sure* that the samples are 16 bit values? Maybe they're 32-
bit values, and what you're seeing is the 2 high bytes of each
sample being set to zero, but not always.
Where has the data come from?
If they are 32-bit, make your pointers unsigned long* and divide the
bytecount by 4. Also use [NSNumber numberWithUnsignedLong:];
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