# Play a sound in script

**URL:** <https://discourse.slicer.org/t/play-a-sound-in-script/19171>\
**Category:** Development\
**Tags:** segmentation, python, qt\
**Created:** [August 12, 2021, 3:45pm UTC](https://discourse.slicer.org/t/play-a-sound-in-script/19171 "2021-08-12T15:45:54Z")\
**Posts on this page:** 1\
**Showing post:** 7

<div class="post-metadata">

**Author:** ![atracsys-sbt](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/atracsys-sbt/32/11434_2.png) [@atracsys-sbt](https://discourse.slicer.org/u/atracsys-sbt)\
**Post date:** [August 16, 2021, 3:25pm UTC](https://discourse.slicer.org/t/play-a-sound-in-script/19171/7 "2021-08-16T15:25:39Z")

</div>

So I cloned PythonQt from their repo [here](https://github.com/MeVisLab/pythonqt), and looked for “QSound” in all files and found a lot of hits, notably:

```auto
Search "qsound" (695 hits in 25 files of 708 searched)
  D:\dev-ext\src\pythonqt\generated_cpp_50\com_trolltech_qt_gui\com_trolltech_qt_gui7.cpp (29 hits)
	Line 6517: PythonQtShell_QSound::~PythonQtShell_QSound() {
	Line 6517: PythonQtShell_QSound::~PythonQtShell_QSound() {
	Line 6521: void PythonQtShell_QSound::childEvent(QChildEvent* arg__1)
	Line 6538: QSound::childEvent(arg__1);
	Line 6540: void PythonQtShell_QSound::customEvent(QEvent* arg__1)
	Line 6557: QSound::customEvent(arg__1);
	Line 6559: bool PythonQtShell_QSound::event(QEvent* arg__1)
	Line 6587: return QSound::event(arg__1);
	Line 6589: bool PythonQtShell_QSound::eventFilter(QObject* arg __1, QEvent* arg__ 2)
	Line 6617: return QSound::eventFilter(arg __1, arg__ 2);
	Line 6619: void PythonQtShell_QSound::timerEvent(QTimerEvent* arg__1)
	Line 6636: QSound::timerEvent(arg__1);
	Line 6638: QSound* PythonQtWrapper_QSound::new_QSound(const QString& filename, QObject* parent)
	Line 6638: QSound* PythonQtWrapper_QSound::new_QSound(const QString& filename, QObject* parent)
	Line 6638: QSound* PythonQtWrapper_QSound::new_QSound(const QString& filename, QObject* parent)
	Line 6640: return new PythonQtShell_QSound(filename, parent); }
	Line 6642: QString PythonQtWrapper_QSound::fileName(QSound* theWrappedObject) const
	Line 6642: QString PythonQtWrapper_QSound::fileName(QSound* theWrappedObject) const
	Line 6647: bool PythonQtWrapper_QSound::isFinished(QSound* theWrappedObject) const
	Line 6647: bool PythonQtWrapper_QSound::isFinished(QSound* theWrappedObject) const
	Line 6652: int PythonQtWrapper_QSound::loops(QSound* theWrappedObject) const
	Line 6652: int PythonQtWrapper_QSound::loops(QSound* theWrappedObject) const
	Line 6657: int PythonQtWrapper_QSound::loopsRemaining(QSound* theWrappedObject) const
	Line 6657: int PythonQtWrapper_QSound::loopsRemaining(QSound* theWrappedObject) const
	Line 6662: void PythonQtWrapper_QSound::static_QSound_play(const QString& filename)
	Line 6662: void PythonQtWrapper_QSound::static_QSound_play(const QString& filename)
	Line 6664: (QSound::play(filename));
	Line 6667: void PythonQtWrapper_QSound::setLoops(QSound* theWrappedObject, int arg__1)
	Line 6667: void PythonQtWrapper_QSound::setLoops(QSound* theWrappedObject, int arg__1)
  D:\dev-ext\src\pythonqt\generated_cpp_50\com_trolltech_qt_gui\com_trolltech_qt_gui7.h (18 hits)
	Line 55: #include <qsound.h>
	Line 869: class PythonQtShell_QSound : public QSound
	Line 869: class PythonQtShell_QSound : public QSound
	Line 872: PythonQtShell_QSound(const QString& filename, QObject* parent = 0):QSound(filename, parent),_wrapper(NULL) {};
	Line 872: PythonQtShell_QSound(const QString& filename, QObject* parent = 0):QSound(filename, parent),_wrapper(NULL) {};
	Line 874: ~PythonQtShell_QSound();
	Line 885: class PythonQtWrapper_QSound : public QObject
	Line 890: Infinite = QSound::Infinite};
	Line 892: QSound* new_QSound(const QString& filename, QObject* parent = 0);
	Line 892: QSound* new_QSound(const QString& filename, QObject* parent = 0);
	Line 893: void delete_QSound(QSound* obj) { delete obj; } 
	Line 893: void delete_QSound(QSound* obj) { delete obj; } 
	Line 894: QString fileName(QSound* theWrappedObject) const;
	Line 895: bool isFinished(QSound* theWrappedObject) const;
	Line 896: int loops(QSound* theWrappedObject) const;
	Line 897: int loopsRemaining(QSound* theWrappedObject) const;
	Line 898: void static_QSound_play(const QString& filename);
	Line 899: void setLoops(QSound* theWrappedObject, int arg__1);

```

---

_[View the full topic](https://discourse.slicer.org/t/play-a-sound-in-script/19171)._
