Skip to content
Snippets Groups Projects
Commit fcd73dd9 authored by Dipl.-Ing. Jonas Stienen's avatar Dipl.-Ing. Jonas Stienen
Browse files

Removing output from ipython notebook example

parent 88bfe4e9
Branches
Tags
No related merge requests found
%% Cell type:markdown id: tags: %% Cell type:markdown id: tags:
# VA notebook test # VA notebook test
This is a simple test program that demonstrates the use of the VA Python binding within a jupyter notebook environment. This is a simple test program that demonstrates the use of the VA Python binding within a jupyter notebook environment.
Before we start scripting, let's make VA available for us. If it is not available system (or user) wide, this is how you can add the `va` module from the distribution folder structure. Before we start scripting, let's make VA available for us. If it is not available system (or user) wide, this is how you can add the `va` module from the distribution folder structure.
%% Cell type:code id: tags: %% Cell type:code id: tags:
``` python ``` python
import sys import sys
sys.path.append( "../Lib/site-packages" ) sys.path.append( "../Lib/site-packages" )
sys.path sys.path
``` ```
%% Output
['',
'c:\\users\\jonas\\appdata\\local\\programs\\python\\python36\\python36.zip',
'c:\\users\\jonas\\appdata\\local\\programs\\python\\python36\\DLLs',
'c:\\users\\jonas\\appdata\\local\\programs\\python\\python36\\lib',
'c:\\users\\jonas\\appdata\\local\\programs\\python\\python36',
'c:\\users\\jonas\\appdata\\local\\programs\\python\\python36\\lib\\site-packages',
'c:\\users\\jonas\\appdata\\local\\programs\\python\\python36\\lib\\site-packages\\IPython\\extensions',
'C:\\Users\\jonas\\.ipython',
'../../../build_win32-x64.vc14/python/Lib/site-packages',
'../../../build_win32-x64.vc14/python/Lib/site-packages',
'C:\\dev\\VA\\dist\\win32-x64.vc14\\python\\Lib\\site-packages',
'../../../build_win32-x64.vc14/python/Lib/site-packages',
'C:\\dev\\VA\\dist\\win32-x64.vc14\\python\\Lib\\site-packages']
%% Cell type:code id: tags: %% Cell type:code id: tags:
``` python ``` python
import va import va
``` ```
%% Cell type:markdown id: tags: %% Cell type:markdown id: tags:
We start by adding finding out where we are currently working and list the files available, i.e. to load them as HRIR, audio file or directivity. Ok. Now let's try to connect to a VA server running on the local machine. Remark: this local machine will be the one where this server jupyter notebook is running, not necessarily your PC.
%% Cell type:code id: tags: %% Cell type:code id: tags:
``` python ``` python
import os va.connect( "localhost" ) # default port is: 12340; can be given as second parameter
current_working_dir = os.getcwd()
print( "working directory: " + current_working_dir )
os.listdir( current_working_dir )
``` ```
%% Output
working directory: C:\dev\VA\VAPython\examples\jupyter_notebook
['.ipynb_checkpoints', 'VA notebook test.ipynb']
%% Cell type:markdown id: tags: %% Cell type:markdown id: tags:
Now lets add this folder to VA. This means that VA can find files that reside in this location. We first have to import va, though: We start by finding out where we are currently working and list the files available, i.e. to identify files that can be used as HRIR, audio file or directivity.
%% Cell type:code id: tags: %% Cell type:code id: tags:
``` python ``` python
va.add_search_path( current_working_dir ) import os
current_working_dir = os.getcwd()
print( "working directory: " + current_working_dir )
os.listdir( current_working_dir )
``` ```
%% Cell type:markdown id: tags: %% Cell type:markdown id: tags:
Ok. Now let's try to connect to a VA server running on the local machine. Remark: this local machine will be the one where this server jupyter notebook is running, not necessarily your PC. Now lets add this folder to VA. This means that VA can find files that reside in this location, all you have to use is the file name (or a relative path from the base path you have added as search path).
%% Cell type:code id: tags: %% Cell type:code id: tags:
``` python ``` python
va.connect( "localhost" ) # default port is: 12340; can be given as second parameter va.add_search_path( current_working_dir )
``` ```
%% Output
---------------------------------------------------------------------------
NameError Traceback (most recent call last)
<ipython-input-1-316881027ede> in <module>()
----> 1 va.connect( "localhost" ) # default port is: 12340; can be given as second parameter
NameError: name 'va' is not defined
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment