AllenDowney / ThinkDSP

Think DSP: Digital Signal Processing in Python, by Allen B. Downey.
https://allendowney.github.io/ThinkDSP/
3.93k stars 3.2k forks source link

Playback audio #64

Closed Israelojo closed 5 years ago

Israelojo commented 5 years ago

I can't get the wav files to playback when I run the code in spyder

Israelojo commented 5 years ago

make_audio() and Audio() don't seem to work. Any help in solving this is highly appreciated!

RonFredericks commented 5 years ago

One problem is that the wav player included in this package called aplay is only available for linux boxes. If you have linux than make sure it is installed where ThinkDSP can find it. Otherwise you will need to find an alternative wav player. I am on Windows so I came up with this open source alternative that should work on linux or windows using the simpleaudio module - see attached. audio_player2.zip

AllenDowney commented 5 years ago

In Chapter 1 I show two ways to play sound, one using an external player, aplay. If you can install aplay for your system, it should work. If not, you can try the second way, which uses the Audio object from Ipython.display. That should work on any system with a complete Jupyter installation.

I don't recommend running the notebooks in Spyder.

AllenDowney commented 5 years ago

Closing for now, but please reopen if you have questions.

jwickard commented 4 years ago

On Mac you can brew install sox and edit thinkdsp.py to use play instead of aplay as the cli command.