root / docs / exploring-gnuradio / dial_tone_example.xml @ 5d69a524
History | View | Annotate | Download (701 Bytes)
| 1 | <?xml version="1.0" encoding="ISO-8859-1"?>
|
|---|---|
| 2 | <example id="dial_tone_ex"><title>Dial Tone Output</title> |
| 3 | <programlisting>
|
| 4 | #!/usr/bin/env python |
| 5 | |
| 6 | from gnuradio import gr |
| 7 | from gnuradio import audio |
| 8 | |
| 9 | def build_graph (): |
| 10 | sampling_freq = 48000 |
| 11 | ampl = 0.1 |
| 12 | |
| 13 | fg = gr.flow_graph () |
| 14 | src0 = gr.sig_source_f (sampling_freq, gr.GR_SIN_WAVE, 350, ampl) |
| 15 | src1 = gr.sig_source_f (sampling_freq, gr.GR_SIN_WAVE, 440, ampl) |
| 16 | dst = audio.sink (sampling_freq) |
| 17 | fg.connect ((src0, 0), (dst, 0)) |
| 18 | fg.connect ((src1, 0), (dst, 1)) |
| 19 | |
| 20 | return fg |
| 21 | |
| 22 | if __name__ == '__main__': |
| 23 | fg = build_graph () |
| 24 | fg.start () |
| 25 | raw_input ('Press Enter to quit: ')
|
| 26 | fg.stop () |
| 27 | </programlisting>
|
| 28 | </example>
|