简体   繁体   English

如何快速更改声波

[英]How to Change Sound Wave Swift

I found how to create Sound wave From FDWaveformView Pods , but I can't modify to create a this type of wave screenshot below:我发现了如何从FDWaveformView Pods创建声波,但是我无法修改以在下面创建这种类型的声波屏幕截图:

Here is what I am trying to do:这是我正在尝试做的事情:

屏幕截图一

The screenshot is taken from Iphone:屏幕截图来自Iphone:

屏幕截图秒

This code creates sine wave but I need to create pulse waves:这段代码创建了正弦波,但是我需要创建脉冲波:

    soundWaveView.delegate = self
    soundWaveView.alpha = 0.0
    soundWaveView.audioURL = mainTrackURL
    soundWaveView.zoomSamples = 0 ..< soundWaveView.totalSamples / 3
    soundWaveView.doesAllowScrubbing = false
    soundWaveView.doesAllowStretch = false
    soundWaveView.doesAllowScroll = false
    soundWaveView.wavesColor = UIColor(red: 46/255, green: 188/255, blue: 191/255, alpha: 1)
    soundWaveView.progressColor = UIColor(red: 251/255, green: 237/255, blue: 101/255, alpha: 1)
    do {
        try AVAudioSession.sharedInstance().setActive(true)
        playerSoundWave = try AVAudioPlayer(contentsOf: mainTrackURL!, fileTypeHint: AVFileType.mp4.rawValue)
        songTotalTime = Double((playerSoundWave?.duration)!)
    }
    catch let error {
        print(error.localizedDescription)
    }

Question: How to modify or create sound wave?问题:如何修改或创建声波?

Can someone please explain to me how to create and modify sound wave, i've tried to modify but no results yet.有人可以向我解释如何创建和修改声波,我已经尝试修改但没有结果。 Any help would be greatly appreciated.任何帮助将不胜感激。

Thanks in advance.提前致谢。

I found how to create Sound wave From FDWaveformView Pods , but I can't modify to create a this type of wave screenshot below:我发现了如何从FDWaveformView Pods创建声波,但是我无法修改以在下面创建这种类型的声波屏幕截图:

Here is what I am trying to do:这是我正在尝试做的事情:

屏幕截图一

The screenshot is taken from Iphone:屏幕截图来自Iphone:

屏幕截图秒

This code creates sine wave but I need to create pulse waves:这段代码创建了正弦波,但是我需要创建脉冲波:

    soundWaveView.delegate = self
    soundWaveView.alpha = 0.0
    soundWaveView.audioURL = mainTrackURL
    soundWaveView.zoomSamples = 0 ..< soundWaveView.totalSamples / 3
    soundWaveView.doesAllowScrubbing = false
    soundWaveView.doesAllowStretch = false
    soundWaveView.doesAllowScroll = false
    soundWaveView.wavesColor = UIColor(red: 46/255, green: 188/255, blue: 191/255, alpha: 1)
    soundWaveView.progressColor = UIColor(red: 251/255, green: 237/255, blue: 101/255, alpha: 1)
    do {
        try AVAudioSession.sharedInstance().setActive(true)
        playerSoundWave = try AVAudioPlayer(contentsOf: mainTrackURL!, fileTypeHint: AVFileType.mp4.rawValue)
        songTotalTime = Double((playerSoundWave?.duration)!)
    }
    catch let error {
        print(error.localizedDescription)
    }

Question: How to modify or create sound wave?问题:如何修改或创建声波?

Can someone please explain to me how to create and modify sound wave, i've tried to modify but no results yet.有人可以向我解释如何创建和修改声波,我已经尝试修改但没有结果。 Any help would be greatly appreciated.任何帮助将不胜感激。

Thanks in advance.提前致谢。

I found how to create Sound wave From FDWaveformView Pods , but I can't modify to create a this type of wave screenshot below:我发现了如何从FDWaveformView Pods创建声波,但是我无法修改以在下面创建这种类型的声波屏幕截图:

Here is what I am trying to do:这是我正在尝试做的事情:

屏幕截图一

The screenshot is taken from Iphone:屏幕截图来自Iphone:

屏幕截图秒

This code creates sine wave but I need to create pulse waves:这段代码创建了正弦波,但是我需要创建脉冲波:

    soundWaveView.delegate = self
    soundWaveView.alpha = 0.0
    soundWaveView.audioURL = mainTrackURL
    soundWaveView.zoomSamples = 0 ..< soundWaveView.totalSamples / 3
    soundWaveView.doesAllowScrubbing = false
    soundWaveView.doesAllowStretch = false
    soundWaveView.doesAllowScroll = false
    soundWaveView.wavesColor = UIColor(red: 46/255, green: 188/255, blue: 191/255, alpha: 1)
    soundWaveView.progressColor = UIColor(red: 251/255, green: 237/255, blue: 101/255, alpha: 1)
    do {
        try AVAudioSession.sharedInstance().setActive(true)
        playerSoundWave = try AVAudioPlayer(contentsOf: mainTrackURL!, fileTypeHint: AVFileType.mp4.rawValue)
        songTotalTime = Double((playerSoundWave?.duration)!)
    }
    catch let error {
        print(error.localizedDescription)
    }

Question: How to modify or create sound wave?问题:如何修改或创建声波?

Can someone please explain to me how to create and modify sound wave, i've tried to modify but no results yet.有人可以向我解释如何创建和修改声波,我已经尝试修改但没有结果。 Any help would be greatly appreciated.任何帮助将不胜感激。

Thanks in advance.提前致谢。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM