When I run my webserver program the audio output is working (which is continuous Tone)and the Slider works too (I mean the Slider does update the values). But the problem is this Slider widget doesn't have any control over my frequency value (which determines the Tone sound)! Both of them (Slider and Audio Tone) are working but sounds like they don't communicate with each other.
Kindly, I need your help to guide to what I am doing wrong here.
Here is an image about how it looks when values are live updated when I move the slider:
![[Image: QnRj3G.png]](https://imagizer.imageshack.com/img922/1673/QnRj3G.png)
Here is my Flask webserver code (thats where I run my app.py from through the Terminal):
Kindly, I need your help to guide to what I am doing wrong here.
Here is an image about how it looks when values are live updated when I move the slider:
![[Image: QnRj3G.png]](https://imagizer.imageshack.com/img922/1673/QnRj3G.png)
Here is my Flask webserver code (thats where I run my app.py from through the Terminal):
from flask import Flask, render_template, jsonify, request, redirect, url_for from random import randint from top_block_22 import top_block_22 tb = top_block_22() tb.start() app = Flask(__name__) @app.route('/') def slide_func(): return render_template("index.html") if __name__ == '__main__': app.run(host='0.0.0.0', port=5000, debug=True)And this is my Audio tone python code (which is generated from gnuradio software):
#!/usr/bin/env python2 # -*- coding: utf-8 -*- ################################################## # GNU Radio Python Flow Graph # Title: Top Block 22 # Generated: Tue Jul 23 15:54:16 2019 ################################################## from gnuradio import analog from gnuradio import audio from gnuradio import blocks from gnuradio import eng_notation from gnuradio import gr from gnuradio.eng_option import eng_option from gnuradio.filter import firdes from optparse import OptionParser from flask import Flask, render_template, jsonify, request, redirect, url_for from random import randint app = Flask(__name__) @app.route('/') def slide_func(): return render_template("index.html") @app.route('/valueofslider') def slide(): slide_val = request.args.get('slide_val') return top_block_22(slide_val) class top_block_22(gr.top_block): def __init__(self, slide_val): self.slide_val = slide_val #gr.top_block.__init__(self, "Top Block 22") gr.top_block.__init__(self, "Top Block 22") ################################################## # Variables ################################################## self.samp_rate = samp_rate = 32000 ################################################## # Blocks ################################################## self.blocks_add_xx = blocks.add_vff(1) self.audio_sink = audio.sink(32000, '', True) self.analog_sig_source_x_1 = analog.sig_source_f(samp_rate, analog.GR_COS_WAVE, 440, 0.4, 0) self.analog_sig_source_x_0 = analog.sig_source_f(samp_rate, analog.GR_COS_WAVE, 350, 0.4, 0) self.analog_noise_source_x_0 = analog.noise_source_f(analog.GR_GAUSSIAN, 0.005, -42) ################################################## # Connections ################################################## self.connect((self.analog_noise_source_x_0, 0), (self.blocks_add_xx, 2)) self.connect((self.analog_sig_source_x_0, 0), (self.blocks_add_xx, 0)) self.connect((self.analog_sig_source_x_1, 0), (self.blocks_add_xx, 1)) self.connect((self.blocks_add_xx, 0), (self.audio_sink, 0)) def main(top_block_cls=top_block_22, options=None): tb = top_block_cls() tb.start() try: raw_input('Press Enter to quit: ') except EOFError: pass tb.stop() tb.wait() samp_rate = int(slide_val) + 40000 print(samp_rate) return(slide_val) # Still need to return or get TypeError if __name__ == '__main__': app.run(debug=True)