• And the notification fires even if you are already at the ”top”.

    Might also make sense to restore the volume to what it was, to avoid always having the phone at full volume.

  • def draw(self): self.iv.image.draw(0,0,self.width,self.height)

    you can only fit your image or you might like to calculate the screen ratio first...

  • I uploaded a new version of the code.

    The "stop" method was a kludge before, and had some race conditions with the "run" method. While these never happened, they could happen if the timing was just right. Now the method is fully synchronized. All audio control, including stopping audio, is now handled in the "run" thread and the "stop" method became much simpler.

    Update: 11/10/2017 - I uploaded again. I did numerous numerical optimizations to make the code more efficient. Most significantly, the rise-fall envelope samples are now cached in a list so they don't have to be recomputed for every tone pulse. I did some polishing of names, methods, and comments. The code is now a bit shorter.

    Update: 11/11/2017 - I uploaded again. Now the tone generator uses raised cosine pulse-shaping.

    Update: 11/15/2017 - I updated the code yet again yesterday. I realized that the dot and dash tone pulses could be cached for a specific sending speed and a specific tone frequency, and then just used over and over again, as opposed to synthesizing the tone pulses repeatedly. I also synthesized some fixed-interval silences, which depend only on the sending speed. This greatly reduces the loading on the processor, at the expense of using some memory.

  • Thanks. I do know the proper way to solve this problem already though. My undergraduate degree is electrical engineering and I my graduate work is in a field called Digital Signal Processing. I did not implement a more complicated streaming solution because I don't want to load the iPhone down, this is just to control a program that does something else - and currently I only need to enter two sequential characters for all control options, although I have decoded sentences with my current Morse Code decoder.

    If I were to implement a full streaming solution, I'd create a separate processing thread to decode the Morse code (or up and down button events with times). The UI would write the up and down events to a thread-safe queue, and the decoder thread would read from that queue. The decode would write characters to a thread-safe output queue, which would be read by the UI thread.

    This would allow decoding while doing other processing. Perhaps I'll implement that someday.

    Currently there is no point in doing a dynamic adaptation to sending speed variations when I am only decoding very short blocks - currently only two characters.

    I did find that podcast interesting and entertaining though. Also, I had purchased the "Natural Language" Python book he mentioned over a year ago. It's a great book. The best part of that book is that it provides sources to various online resources, including a word corpus.

Internal error.

Oops! Looks like something went wrong!