Closed darasan closed 11 years ago
Thanks, yes, the current test implementation is optimized for average song length. It means that when an audio file loaded it is converted to 44k PCM data. It results a lot of values, which is not needed, therefore it is averaged by 50 samples (see WaveSampleProvider::calculateSampleFromArray). Try to decrease binSize. Also you should try to look into WaveSampleProvider::dataForResolution and increase pixelWide parameter (8000 now, should try with 16000...128000)
Hope this helps.
Btw: drawRect is place for change the way how the drawn waveform looks (color, thickness, etc.)
Hi, thanks for your quick reply! By the way, I'm using the iOS version.
I experimented with lowering the bin size (I needed to set it between 1 and 10 to look OK) and increasing the pixelWide parameter. This looks better and runs fine in the iPhone 6.0 simulator, but on my iPhone 4 it runs very slowly, and with latency between the audio and highlighted position in the waveform (even with pixelWide = 8000). I will try to improve it, but maybe OpenGL is better for me...
Interesting. All the two parameters are about how many points passed to bezier path to draw the wave. I have tested it with an old 3GS with the sample mp3 included in the project. Everything worked well, so I do not know what could be a problem. Btw, how can you run it in iOS emulator ? For me emulator do not let me start to play.
closed by mistake
I am closing this issue.
Hi, this sample is really useful, so thank you for submitting it!
I've noticed that when using short audio files (e.g. 5 seconds) the waveform resolution is not so good, it results in large "chunks" in the waveform rather than detailed peaks.
I've tried to play with the parameters in the drawRect method as you suggested, including CGContextSetLineWidth and CGContextSetLineCap, but I can't get it to change. Can you help?
Many thanks!