iphone – 基于声音频率移动图像?

iphone – 基于声音频率移动图像?,第1张

概述我正在尝试制作类似的东西,我正在录制声音,并且基于声音(音高,频率,不确定),图像应该移动. 我能够实现录制,也可以实现图像序列,但是可以单独进行. 我不知道如何链接,只是为了信息,我试图实现类似的东西 嘴巴移动应用程序: app url here 我的问题是,我如何根据声音频率移动/动画图像. 谢谢 我完成了解决方案.使用Dirac和问题解决了. 编辑: 它是什么? DiracAudioPlay 我正在尝试制作类似的东西,我正在录制声音,并且基于声音(音高,频率,不确定),图像应该移动.

我能够实现录制,也可以实现图像序列,但是可以单独进行.
我不知道如何链接,只是为了信息,我试图实现类似的东西
嘴巴移动应用程序:
app url here

我的问题是,我如何根据声音频率移动/动画图像.

谢谢

解决方法 我完成了解决方案.使用Dirac和问题解决了.

编辑:

它是什么?

DiracAudioPlayer是一组新的Cocoa类,它以方便的方式包装整个Dirac功能,暴露出与AVAudioPlayer类似的API.请注意,这不是AVAudioPlayer子类.
以下是API的核心功能和说明.

DiracAudioPlayer核心功能

DiracAudioPlayer是一组类,允许基于文件的各种音频格式(包括MPMediaItems)播放,同时实时改变音频文件的速度和音高.版本3.6由DiracAudioPlayerBase(负责文件IO和回放的基类),DiracAudioPlayer(包装Dirac Core API)和DiracFxAudioPlayer(包装DiracFx API)组成.

确保在项目中包含所有3个类以及“ExtAudiofile”和“util”文件夹,并将Accelerate.framework和CoreAudio.framework添加到项目中.在MacOS X上你也必须添加AudioUnit.framework,在iOS上你必须添加AudioToolBox.framework,AVFoundation.framework,MediaPlayer.framework和CoreMedia.framework.

DiracAudioPlayer是……

… Apple兼容的类可播放适用于iOS(版本4及更高版本)和MacOS X(版本10.6及更高版本)的时间拉伸音频
……非常容易使用
……完全兼容ARC
…交付给您,包括完整的源代码

DiracAudioPlayer API

2012年11月发布的3.6版提供以下呼叫:

- (ID) initWithContentsOfURL:(NSURL*)inUrl channels:(int)channels error: (NSError **)error;Initializes and returns an audio player for playing a designated sound file. A URL IDentifying the sound file to play. The audio data must be in a format supported by Core Audio. Pass in the address of a nil-initialized NSError object. If an error occurs,upon return the NSError object describes the error. To use an item from the user's iPod library supply the URL that you get via MPMediaItem's MPMediaItemPropertyAssetURL property as inUrl. Note that FairPlay protected content can NOT be processed.- (voID) setDelegate:(ID)delegate;- (ID) delegate;

设置/获取类的委托.如果您实现委托协议,DiracAudioPlayer将调用您的实现

- (voID)diracPlayerDIDFinishPlaying:(DiracAudioPlayerBase *)player successfully:(BOol)flag

当它完成播放

- (voID) changeDuration:(float)duration;- (voID) changePitch:(float)pitch;

改变播放速度和音高

- (NSInteger) numberOfLoops;- (voID) setNumberOfLoops:(NSInteger)loops;A value of 0,which is the default,means to play the sound once. Set a positive integer value to specify the number of times to return to the start and play again. For example,specifying a value of 1 results in a total of two plays of the sound. Set any negative integer value to loop the sound indefinitely until you call the stop method.- (voID) updateMeters;

必须在调用-peakPowerForChannel之前调用,以便更新其内部测量值

- (float) peakPowerForChannel:(NSUInteger)channelNumber;A floating-point representation,in decibels,of a given audio channel’s current peak power. A return value of 0 dB indicates full scale,or maximum power; a return value of -160 dB indicates minimum power (that is,near silence). If the signal provIDed to the audio player exceeds ±full scale,then the return value may exceed 0 (that is,it may enter the positive range). To obtain a current peak power value,you must call the updateMeters method before calling this method.- (BOol) preparetoPlay;Starts the Dirac processing thread and prepares the sound file for playback. If you don't call this explicitly it will be called when calling -play- (NSUInteger) numberOfChannels;

与音频播放器关联的声音中的音频通道数. (只读)

- (NSTimeInterval) fileDuration;

返回与音频播放器关联的声音的总持续时间(以秒为单位). (只读)

- (NSTimeInterval) currentTime;- (voID) setCurrentTime:(NSTimeInterval)timeReturns the current play time in the input file. Note that if you apply time stretching,-currentTime will reflect the slowed down time depending on the time stretch factor. important CHANGE: In prevIoUs versions this value returned the total play time independent of the position in the file. Please update your code accordingly to reflect the changeSetting this property causes playback to fast forward or rewind to the specifIEd play time.- (voID) play;Plays a sound asynchronously. Returns YES on success,or NO on failure. Calling this method implicitly calls the -preparetoPlay method if the audio player is not already prepared to play.- (NSURL*) url;

与音频播放器关联的声音的URL. (只读)

- (voID) setVolume:(float)volume;- (float) volume;

音频播放器的播放增益,范围从0.0到1.0.

- (BOol) playing;A Boolean value that indicates whether the audio player is playing (YES) or not (NO). (read-only). To find out when playback has stopped,use the diracPlayerDIDFinishPlaying:successfully: delegate method.- (voID) pause;Pauses playback; sound remains ready to resume playback from where it left off. Calling pause leaves the audio player prepared to play; it does not release the audio harDWare that was acquired upon calling -play or -preparetoPlay.- (voID) stop;Stops playback and undoes the setup needed for playback. Calling this method,or allowing a sound to finish playing,undoes the setup performed upon calling the -play or -preparetoPlay methods.
总结

以上是内存溢出为你收集整理的iphone – 基于声音频率移动图像?全部内容,希望文章能够帮你解决iphone – 基于声音频率移动图像?所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址: https://outofmemory.cn/web/1084062.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-05-27
下一篇 2022-05-27

发表评论

登录后才能评论

评论列表(0条)

保存