How to draw waveform using Amplituda data? #51
Labels
documentation
Improvements or additions to documentation
help wanted
Extra attention is needed
question
Further information is requested
Amplituda provides only extracted audio data and compress(custom number of samples)/cache features.
Here are some instructions, which help you draw a flexible waveform:
Canvas size - the area in which the wave will be drawn (
width
andheight
inpx
).You can find an android view example here or a jetpack compose example here.
Single spike size - sum of desired spike width and padding (
width
andpaddings
inpx
).Most likely desired width and padding will be specified by the user via function parameters or view attrs.
spike width
=desired spike width
+desired spike paddings
.Spikes
per canvas width - number of spikes that canvas can accommodate.spikes
=canvas width
/single spike size
Samples
(oramplitudes
) - list of average samples for each spike. You should divide the original amplitudes list into chunks and then average each chunk. Finally, you get average samples for each spike of your amplitude.Kotlin "pseudocode"
):This is how your code approximately should look like:
Compose
. I have recently created AudioWaveform library for Jetpack Compose which is compatible with Amplituda. I used the instructions described above to draw the waveform. So, you can check the full code here.XML
. If you're looking for an androidView
implementation, you can take a look at WaveformSeekBar, which is also compatible with Amplituda.The text was updated successfully, but these errors were encountered: