• First thing is that I need to know when a conversation happen.
  • Based on what I test briefly.
    • If I speak cautiously the pitch is around 100.
    • If I speak cautiously the volume is around 0,001.
    • If I speak normally the pitch is around 100
    • If I speak normally the volume is around 0,0005.
  • Which means that speaking normally happens around 100 pitch and 0,0001 volume.
  • Another problem would be that when the web cam started the program takes time to initiate connections to the webcam. Hence, web cam need to be started when the program start and not when the conversation happen.
    • I can do this by letting the webcam take a sample frame when the badge boots.
  • There is also a bit of lag when webcam tries to detect faces. My current solutions would be like this.
    • Tell web cam to take one frame when boot.
    • Then calculate when a conversation happen to take another frame.
  • Or these solutions could work as well.
    • Multi threading and asynchronize (the hard way).
    • Using 2 separate terminal instances of Python (the simple way).
  • Using multi threading works like a charm.
  • Now, I need to make sure that I can terminate the program, because this when using multi threading the program will not be closed in normal way.

./20161121-0049-cet-5-1.png

  • In Python you can use str(a_variable_here) to cast anything into string.
  • Example of creating empty array in Python, my_array_name = [].
  • Python string formatting guide, https://pyformat.info/.
  • Full screenshot of the article.

./20161121-0049-cet-5-2.png

  • This is a good thing to remember, Python documentation for string formatting, https://docs.python.org/3/library/string.html. Specifically look at how to format string example.
  • Python has one of the best string manipulation out of other programming languages that I have ever tried.

./20161121-0049-cet-5-3.png

  • Up until this moment I have trouble on killing multi threaded Python script.
  • My current solution is to do os._exit(1) which is to terminate the running Python script the hard way.
    • This means atexit function will not be run.
    • This is not the ideal solution on terminating a running script.
    • I need to search the proper way to terminate a running Python script. At least I need to make sure that I can still execute a function/method before the running script terminated.
  • I made a Reddit thread over here, https://www.reddit.com/r/learnpython/comments/5dxum0/trouble_on_killing_multi_threaded_program/, to ask about closing multi threaded script. However, there is no good answer yet.
  • Here is the full screenshot of the Reddit thread.

./20161121-0049-cet-5-4.png

20161121-0049-gmt+2-project-log-5-5.png

./20161121-0049-cet-5-5.png

./20161121-0049-cet-5-6.png