@@ -0,0 +1,2028 @@
+#!/usr/bin/env python3%0A# Copyright 2016 Curtis Sand%0A#%0A# Licensed under the Apache License, Version 2.0 (the %22License%22);%0A# you may not use this file except in compliance with the License.%0A# You may obtain a copy of the License at%0A#%0A#     http://www.apache.org/licenses/LICENSE-2.0%0A#%0A#     Unless required by applicable law or agreed to in writing, software%0A#     distributed under the License is distributed on an %22AS IS%22 BASIS,%0A#     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.%0A#     See the License for the specific language governing permissions and%0A#     limitations under the License.%0A%0A%22%22%22A Continuous Signal Generator program.%22%22%22%0A%0Afrom potty_oh import common%0Afrom potty_oh.signal_generator import PhasorGenerator%0A%0A%0Adef main():%0A    parser = common.get_cmd_line_parser(description=__doc__)%0A    common.ParserArguments.filename(parser)%0A    common.ParserArguments.plot(parser)%0A    common.ParserArguments.length(parser)%0A    common.ParserArguments.set_defaults(parser, type='constant')%0A%0A    default_freqs = %5B300, 800%5D%0A    parser.add_argument(%0A        '-f', '--frequencies', action='append', dest='freqs', type=float,%0A        default=%5B%5D, help=%22Specify the frequencies to use. Defaults to %22%0A                         %22%25s.%22 %25 default_freqs)%0A    args = parser.parse_args()%0A%0A    freqs = default_freqs%0A    if len(args.freqs) %3E 0:%0A        freqs = args.freqs%0A%0A    sg = PhasorGenerator(framerate=args.framerate, length=args.length,%0A                         verbose=args.debug)%0A    for freq in freqs%5B:-1%5D:%0A        sg.generate(freq, args.length)%0A    sg.generate(freqs%5B-1%5D, args.length)%0A    waveform = sg.waveform%0A%0A    if args.plot:%0A        import potty_oh.plot as plot%0A        plot.plot_waveform(waveform.frames, waveform.channels, 0,%0A                           len(waveform))%0A    else:%0A        from potty_oh.wav_file import wav_file_context%0A        with wav_file_context(args.filename) as fout:%0A            fout.write_frames(waveform.frames)%0A%0A    return 0%0A%0A%0Aif __name__ == %22__main__%22:%0A    common.call_main(main)%0A

add experiment script for phasor generator