Open weegreenblobbie opened 7 years ago
Let's try the following:
import Nsound as ns
ns.AudioPlayback.getBackendType() == ns.BACKEND_TYPE_LIBPORTAUDIO
If this is False, perhaps Nsound didn't detect port audio. When compiling, check that you see:
pip install --user nsound
Downloading/unpacking nsound
Downloading Nsound-0.9.4.tar.gz (2.5MB): 2.5MB downloaded
Running setup.py (path:/tmp/pip_build_nhilton/nsound/setup.py) egg_info for package nsound
Checking for scons ... /usr/bin/scons
Checking for swig ... /usr/bin/swig
Configuring Nsound ... done
release : Nsound-0.9.4
ao : no
c++11 : yes
cuda : no
float64 : yes
little-endian : yes
matplotlib : yes
openmp : no
portaudio : yes
real-time-audio : yes
So the two lines that should say yes are
portaudio : yes
real-time-audio : yes
If not, make sure you have the package portaudio19-dev
installed and try again.
User sent email with:
I still continue to have problems... As your advice, I found that the problem was the not.installation of the package portaudio19-dev. So, I installed it, by terminal, but still, when I compile I have this problem:
sudo python setup.py install
Checking for scons ... /usr/local/bin/scons
Checking for swig ... /usr/bin/swig
Configuring Nsound ... done
release : Nsound-0.9.3
ao : no
c++11 : yes
cuda : no
float64 : yes
little-endian : yes
matplotlib : yes
openmp : no
portaudio : no
real-time-audio : no
running install
running build
running build_py
copying Nsound.py -> build/lib.linux-x86_64-2.7
running build_ext
running install_lib
copying build/lib.linux-x86_64-2.7/Nsound.py -> /usr/local/lib/python2.7/dist-packages
byte-compiling /usr/local/lib/python2.7/dist-packages/Nsound.py to Nsound.pyc
running install_egg_info
Removing /usr/local/lib/python2.7/dist-packages/Nsound-0.9.3.egg-info
Writing /usr/local/lib/python2.7/dist-packages/Nsound-0.9.3.egg-info
And I am sure that the installation was good because:
sudo apt-get install portaudio19-dev
Lettura elenco dei pacchetti... Fatto
Generazione albero delle dipendenze
Lettura informazioni sullo stato... Fatto
portaudio19-dev è già alla versione più recente.
I see that you're building from the source archive, so let's do the following:
scons setup_builder.py --config=force
And you will see this output:
scons: Reading SConscript files ...
Building with 4 threads
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
Help Nsound, please submit bug reports if things aren't working for you.
http://sourceforge.net/tracker/?atid=767640&group_id=147193&func=browse
Contact Nick for help: weegreenblobbie_yahoo_com
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
Using Python2.7.6
Building on linux2, AMD64
bindir = /tmp/nsound-0.9.4/bin
libdir = /tmp/nsound-0.9.4/lib
Checking whether the C++ compiler worksyes
detecting compiler version ... gcc 4 8 4
checking if compiler works ... good
checking for C++11 features ... yes
checking endianess ... (cached) little
checking if math.h defines M_PI ... yes
Checking for C++ header file Python.h... yes
checking for matplotlib.pylab ... (cached) yes
checking for Matplotlib C API ... yes
Checking for C++ header file portaudio.h... yes
checking for portaudio.h V18 ... no
...
checking for portaudio.h V19 ... yes
...
where the two most important line for audio play back is:
checking for portaudio.h V19 ... yes
checking for libportaudio ... yes
If it says no, we can look at the config.log
where it tried to detect portaudio:
less config.log
Then search the logfile for portaudio. You should start to find the gory details when you see the line:
scons: Configure: checking for portaudio.h V19 ...
It's trying to detect the protaudio.h
for V19, below the code snippet you will see the config result, on my system when it works I see this:
scons: Configure: checking for portaudio.h V19 ...
.sconf_temp/conftest_9.cpp <-
|
| #include <portaudio.h>
| #include <stdio.h>
|
| int main(void)
| {
| PaDeviceInfo info;
|
| double sr = info.defaultSampleRate;
|
| return 0;
| }
|
|
Compiling .sconf_temp/conftest_9.cpp
.sconf_temp/conftest_9.cpp: In function ‘int main()’:
.sconf_temp/conftest_9.cpp:9:24: warning: unused variable ‘sr’ [-Wunused-variable]
double sr = info.defaultSampleRate;
^
.sconf_temp/conftest_9.cpp:9:34: warning: ‘info.PaDeviceInfo::defaultSampleRate’ is used uninitialized in this function [-Wuninitialized]
double sr = info.defaultSampleRate;
^
scons: Configure: yes
Okay, if it finds the header, then the next section is where it actually links with libportaudio and logs a list of devices to portaudio.log
. In config.log
you will find:
scons: Configure: checking for libportaudio ...
... lots of output ...
scons: Configure: yes
I suspect you see a compiler or link error. This is where we'll get clues as to why it's not working. Please attach/send me the config.log
and portaudio.log
files.
Hi!
I'am here!
I did as indicated by you, but still...
When I executed this command :
scons setup_builder.py --config=force
`the audio back lines are:
Checking for C++ header file portaudio.h... yes
checking for portaudio.h V18 ... no
checking for portaudio.h V19 ... yes
I run
sudo python setup.py install
Checking for scons ... /usr/local/bin/scons
Checking for swig ... /usr/bin/swig
Configuring Nsound ... done
release : Nsound-0.9.4
ao : no
c++11 : yes
cuda : no
float64 : yes
little-endian : yes
matplotlib : yes
openmp : no
portaudio : yes
real-time-audio : yes
So, i tried to run the example:
python example1.py
src/Nsound/AudioPlayback.cc:130: Nsound::AudioPlayback::AudioPlayback():: failed to create AudioBackend!
Traceback (most recent call last):
File "example1.py", line 42, in <module>
pb = AudioPlayback(sr, 1, 16)
File "/usr/local/lib/python2.7/dist-packages/Nsound.py", line 2876, in __init__
this = _Nsound.new_AudioPlayback(sample_rate, channels, bits_per_sample)
RuntimeError: src/Nsound/AudioPlayback.cc:130: Nsound::AudioPlayback::AudioPlayback():: failed to create AudioBackend!
I don't have any idea to how continue! Sorry for the bothering!
Anna
No problem at all. The output looks good, that the library is present, so lets make sure audio works on your computer.
A user sent email with the following issue:
I'm getting start to use Nsound(I installed it this morning). I am trying to run the example 1, but I have always the same problem:
I am using ubunut 15.10 and I have installed all the pre-requirements.