Open dantarakan opened 8 years ago
Just a quick update:
Upon inspecting waveformData
, which is the Array extracted from the file, I noticed that I'm getting 56 zeros in the beginning of the array. So perhaps the problem lies within EZAudioFile
.
As a temporary (dirty) workaround, I stripped zeros from the beginning:
// Get data from file
let waveformData = audioFile!.getWaveformData()
// Get buffer size
let bufferSize = waveformData.bufferSize
// Get the pointer
let dataPointer = waveformData.buffers[0]
// Initialise output array
var dataArray = [Float]()
// Append all non-zero elements
for i in 0..<Int(bufferSize) {
if dataPointer[i] != Float(0.0) {
dataArray.append(dataPointer[i])
}
}
// Update audio plot
self.audioPlot.updateBuffer(&dataArray, withBufferSize: UInt32(dataArray.count))
I understand that this is not the correct way to do it, but it works for my purposes.
Hello Syed, thank you (and others) very much for your hard work on this amazing library!
I've been experiencing this weird issue when I try to plot a waveform from audio file with the GL plots, where the plot begins with an offset, like so:![image2](https://cloud.githubusercontent.com/assets/6733934/15456814/92acd4b6-2073-11e6-9d11-dbef8dec79c3.PNG)
I'm using the following code to initialise the plot:
And this code to draw the waveform:
This issue does not occur on simulator, but only on the real device
When I plot the same recording in real time using the EZAudioPlayer, this issue disappears:![image1](https://cloud.githubusercontent.com/assets/6733934/15456813/8da54afc-2073-11e6-8cac-ed588c5b8482.PNG)
Interestingly, the non-GL plot doesn't have this issue, but it introduces a bunch of other bugs instead.
Any help would be much appreciated!