INNER CODE UNIT · Kotlin

color

Ayush0Chaudhary/blurr · app/src/main/java/com/blurr/voice/AudioWaveView.kt:145

            val color = waveColors[i % waveColors.size]
            paint.shader = LinearGradient(
                0f, h / 2f, 0f, h.toFloat(),
                color, Color.TRANSPARENT, Shader.TileMode.CLAMP
            )
        }
    }

    override fun onDraw(canvas: Canvas) {
        super.onDraw(canvas)

        for (i in 0 until waveCount) {
            wavePaths[i].reset()
            wavePaths[i].moveTo(0f, height.toFloat())
            val waveMaxHeight = height * audioAmplitude * waveAmplitudeMultipliers[i]
            val currentJitter = (Random.nextFloat() - 0.5f) * waveMaxHeight * jitterAmount
            for (x in 0..width step 5) {
                val sineInput = (x * (Math.PI * 2 / width) * waveFrequencies[i]) + wavePhaseShifts[i]

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…