-
Notifications
You must be signed in to change notification settings - Fork 149
Open
Description
Hi there!
context
I'm working on a morse code generator app. I've based my code on oto's example (sine wave is exactly what I needed).
My issue
After implementing the code in my app I noticed 2 issues:
(*SinWave).Readsometimes panics withindex out of range [:-3XXXX]or, sometimes sound was corrupted (longer and glitchy). I managed to fix that by addingsync.Mutex(For some reason Read was called twice by oto, idk why).- the other issue may be specific to my app, where it must not appear, and may be wanted here in example to keep it as simple as possible: when the sound starts playing and when it ends, you can hear a "tap". It is a hardware thing imo. It could be removed by the following:
b := int16(math.Sin(2*math.Pi*float64(p)/length) * 0.3 * max)
if p <= stuckReduction {
b = int16(float64(p) / (stuckReduction) * math.Sin(2*math.Pi*float64(p)/length) * 0.3 *
}stuckReduction is a constant, which for me is 300 but could be reducd probably to about 100/200.
Let me know if my notes are worth adding to the example 😄.
Metadata
Metadata
Assignees
Labels
No labels