• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
raw data extraction
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

raw data extraction


  • Subject: raw data extraction
  • From: Judith Suttrup <email@hidden>
  • Date: Wed, 01 Oct 2008 22:46:38 +0200
  • Organization: http://freemail.web.de/

 I am trying to get the raw audio data out of a two-channel quicktime movie. These are the movie audio extraction properties.

 format flags		= 41
 sample rate		= 48000.000000
 bytes/packet            = 4
 frames/packe           = 1
 bytes/frame             = 4
 channels/frame	= 2
 bits/channel             = 32

Could someone please specify this format (float, int (signed, unsigned)?) Is the extraction below correct? When I am displaying the data in a graph there seem to be lots of interferences.




error = MovieAudioExtractionBegin(soundToPlay, 0, &extractionSessionRef);

	error = MovieAudioExtractionGetProperty(extractionSessionRef,
											kQTPropertyClass_MovieAudioExtraction_Audio,
											kQTMovieAudioExtractionAudioPropertyID_AudioStreamBasicDescription,
											sizeof (asbd), &asbd, nil);


	Boolean allChannelsDicrete = TRUE;

	error = MovieAudioExtractionSetProperty(extractionSessionRef,
											kQTPropertyClass_MovieAudioExtraction_Movie,
											kQTMovieAudioExtractionMoviePropertyID_AllChannelsDiscrete,
											sizeof (Boolean), &allChannelsDicrete);

	asbd.mSampleRate = 48000;
	asbd.mFormatID = kAudioFormatLinearPCM;
	asbd.mFormatFlags = kLinearPCMFormatFlagIsNonInterleaved |
	kLinearPCMFormatFlagIsPacked |
	kLinearPCMFormatFlagIsFloat;
	asbd.mBytesPerPacket = 4;
	asbd.mFramesPerPacket = 1;
	asbd.mBytesPerFrame = 4;
	asbd.mChannelsPerFrame = 2;
	asbd.mBitsPerChannel = 32;


	error = MovieAudioExtractionSetProperty(extractionSessionRef,
											kQTPropertyClass_MovieAudioExtraction_Audio,
											kQTMovieAudioExtractionAudioPropertyID_AudioStreamBasicDescription,
											sizeof (asbd), &asbd);



	float				numFramesF				= asbd.mSampleRate * ((float) GetMovieDuration(soundToPlay) / (float) GetMovieTimeScale(soundToPlay));
	UInt32			numFrames			        = (UInt32) numFramesF;
	UInt32			extractionFlags			        = 0;
	AudioBufferList*	abl 					        = (AudioBufferList *)malloc(sizeof(AudioBufferList) + sizeof(AudioBuffer));



	abl->mNumberBuffers = asbd.mChannelsPerFrame;

	unsigned i;
	for(i = 0; i < abl->mNumberBuffers; i++) {
		abl->mBuffers[i].mNumberChannels = 1;
		abl->mBuffers[i].mDataByteSize = sizeof(Float32) * abl->mBuffers[0].mNumberChannels * numFrames;
		abl->mBuffers[i].mData = malloc(abl->mBuffers[i].mDataByteSize);
	}



	[self setSampleCount: numFrames / 2];
	[self setSamples:calloc(abl->mBuffers[0].mDataByteSize, 1)];
	abl->mBuffers[0].mData = samples;                                                      / samples is a *Byte (wont display any data when set up as a *Float)

	[self setSecSampleCount: numFrames / 2];
	[self setSecSamples:calloc(abl->mBuffers[1].mDataByteSize, 1)];
	abl->mBuffers[1].mData = secSamples;                                                 / secSamples is a *Byte

	error = MovieAudioExtractionFillBuffer(extractionSessionRef, &numFrames, abl, &extractionFlags);
        error = MovieAudioExtractionEnd(extractionSessionRef);


Thanks,
Judith Suttrup


____________________________________________________________________
Psssst! Schon vom neuen WEB.DE MultiMessenger gehört?
Der kann`s mit allen: http://www.produkte.web.de/messenger/?did=3123

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Coreaudio-api mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Follow-Ups:
    • Re: raw data extraction
      • From: Brad Ford <email@hidden>
  • Prev by Date: Re: Multiport midi sequencing
  • Next by Date: Re: How can I get an audio queue to stop playing immediately?
  • Previous by thread: Re: AudioHardwareGetPropertyInfo and Core Audio Java
  • Next by thread: Re: raw data extraction
  • Index(es):
    • Date
    • Thread