如何使用Matlab以特定间隔播放音频文件?

时间:2015-11-11 15:47:00

标签: matlab matlab-figure audio-player

照常:

@IBAction func emailLoginButtonPressed(sender: UIButton) {

    UIView.animateWithDuration(1, animations: { () -> Void in
        self.facebookButton.center = CGPointMake(self.facebookButton.center.x - 500, self.facebookButton.center.y)
        self.twitterButton.center = CGPointMake(self.twitterButton.center.x - 500, self.twitterButton.center.y)
        self.emailButton.center = CGPointMake(self.emailButton.center.x - 500, self.emailButton.center.y)
        self.emailTextField.center = CGPointMake(self.emailTextField.center.x - 500, self.emailTextField.center.y)
        self.passwordTextField.center = CGPointMake(self.passwordTextField.center.x - 500, self.passwordTextField.center.y)
        self.loginButton.center = CGPointMake(self.loginButton.center.x - 500, self.loginButton.center.y)

    })

}

2 个答案:

答案 0 :(得分:6)

您可以使用play(playerObj,[start,stop])功能指定Spot modelstart

stop

或者,您可以计算总数据的子样本,并将其提供给audioplayer

load handel;
playerObj = audioplayer(y,Fs);
start = 1;
stop = playerObj.SampleRate * 3;

play(playerObj,[start,stop]);

答案 1 :(得分:2)

audioplayer的PLAY方法支持名为[startSample stopSample]的其他输入参数。因此,如果您想在5到7秒之间播放音频,则必须指定的范围为[player.SampleRate*5 player.SampleRate*7]