[pitch detect example] rewrite with struct constructors