[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Discuss-gnuradio] unable to get sound from alsa sink
From: |
Chris Gorman |
Subject: |
[Discuss-gnuradio] unable to get sound from alsa sink |
Date: |
Sun, 25 Aug 2019 17:27:31 -0400 |
Hello All,
I have been hacking at a python script with an attempt to pass two
frequencies to be added to audio sink. I can't seem to get any sound
out of the sound card, though. When I run the script I get "gr::log
:INFO: audio source - Audio sink arch: alsa". The script follows. My
python and QT skills are very poor, I simply started with
gnuradio-companion code and tried to hack the result. Can anyone see
where I might fix this?
Thanks in advance.
Chris
from PyQt4 import Qt
from gnuradio import gr
from gnuradio import audio
from gnuradio import analog
from gnuradio import eng_notation
from gnuradio.eng_option import eng_option
from gnuradio.filter import firdes
from optparse import OptionParser
import sys
from gnuradio import qtgui
if __name__ == '__main__':
import ctypes
import sys
if sys.platform.startswith('linux'):
try:
x11 = ctypes.cdll.LoadLibrary('libX11.so')
x11.XInitThreads()
except:
print "Warning: failed to XInitThreads()"
class top_block(gr.top_block, Qt.QWidget):
def __init__(self):
gr.top_block.__init__(self)
Qt.QWidget.__init__(self)
self.setWindowTitle("Top Block")
qtgui.util.check_set_qss()
try:
self.setWindowIcon(Qt.QIcon.fromTheme('gnuradio-grc'))
except:
pass
self.top_scroll_layout = Qt.QVBoxLayout()
self.setLayout(self.top_scroll_layout)
self.top_scroll = Qt.QScrollArea()
self.top_scroll.setFrameStyle(Qt.QFrame.NoFrame)
self.top_scroll_layout.addWidget(self.top_scroll)
self.top_scroll.setWidgetResizable(True)
self.top_widget = Qt.QWidget()
self.top_scroll.setWidget(self.top_widget)
self.top_layout = Qt.QVBoxLayout(self.top_widget)
self.top_grid_layout = Qt.QGridLayout()
self.top_layout.addLayout(self.top_grid_layout)
self.settings = Qt.QSettings("GNU Radio", "top_block")
self.restoreGeometry(self.settings.value("geometry").toByteArray())
sample_rate = 32000
ampl = 0.5
_Zero_push_button = Qt.QPushButton('0')
_Zero_push_button.pressed.connect(lambda: dtmf(self, 941,
1336, sample_rate, ampl))
_Zero_push_button.released.connect(lambda: dtmf(self, 0, 0,
sample_rate, ampl))
self.top_grid_layout.addWidget(_Zero_push_button, 3, 1, 1, 1)
for r in range(3, 4):
self.top_grid_layout.setRowStretch(r, 1)
for c in range(1, 2):
self.top_grid_layout.setColumnStretch(c, 1)
def dtmf(self, freq_one, freq_two, sample_rate, ampl):
src0 = analog.sig_source_f(sample_rate, analog.GR_SIN_WAVE, freq_one, ampl)
src1 = analog.sig_source_f(sample_rate, analog.GR_SIN_WAVE, freq_two, ampl)
dst = audio.sink(sample_rate, "")
self.connect(src0, (dst,0))
self.connect(src1, (dst,1))
def main(top_block_cls=top_block, options=None):
from distutils.version import StrictVersion
if StrictVersion(Qt.qVersion()) >= StrictVersion("4.5.0"):
style = gr.prefs().get_string('qtgui', 'style', 'raster')
Qt.QApplication.setGraphicsSystem(style)
qapp = Qt.QApplication(sys.argv)
tb = top_block_cls()
tb.start()
tb.show()
def quitting():
tb.stop()
tb.wait()
qapp.connect(qapp, Qt.SIGNAL("aboutToQuit()"), quitting)
qapp.exec_()
if __name__ == '__main__':
main()
- [Discuss-gnuradio] unable to get sound from alsa sink,
Chris Gorman <=
- Re: [Discuss-gnuradio] unable to get sound from alsa sink, Barry Duggan, 2019/08/26
- Re: [Discuss-gnuradio] unable to get sound from alsa sink, Chris Gorman, 2019/08/26
- Re: [Discuss-gnuradio] unable to get sound from alsa sink, Michael Dickens, 2019/08/26
- Message not available
- Message not available
- Re: [Discuss-gnuradio] unable to get sound from alsa sink, Chris Gorman, 2019/08/26
- Re: [Discuss-gnuradio] unable to get sound from alsa sink, Michael Dickens, 2019/08/26
- Re: [Discuss-gnuradio] unable to get sound from alsa sink, Chris Gorman, 2019/08/26
- Re: [Discuss-gnuradio] unable to get sound from alsa sink, Michael Dickens, 2019/08/26
- Re: [Discuss-gnuradio] unable to get sound from alsa sink, Chris Gorman, 2019/08/26
- Re: [Discuss-gnuradio] unable to get sound from alsa sink, Michael Dickens, 2019/08/26