"This is a simple example how to create a simple acoustic scene in VA using Python."
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"#### Prerequisites\n",
"You can ignore this part, it is for preparation purposes only."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"import sys\n",
"sys.path.append( '../../Lib/site-packages' )\n",
"import os\n",
"print( 'Current working directory:', os.getcwd() )\n",
"import va\n",
"print( 'Successfully loaded VA Python extension')"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Connect"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"va.connect( \"localhost\" );"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Reset VA to clear the scene"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"va.reset()"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Control output gain"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"va.set_output_gain( 0.25 )"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Add the current working directory or any other relative or absolute directory as a search path to your VA application. From now on, only use relative paths or macros to paths.\n",
"> Pathes are relevant on server side, not on a remote client. The files must be available on the computer **where the VA application is running**!"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"va.add_search_path( os.getcwd() );"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Signal source\n",
"Create a signal source from a file and start playback with looping mode"
"va.set_listener_orientation_vu( listener_id, ( 0, 0, -1, ), ( 0, 1, 0 ) ) # Default view is to -Z (OpenGL)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Active listener\n",
"Set an active listener. This concept is deprecated, but should be used for compatibility until it is removed."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"va.set_active_listener( listener_id )"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Disconnect"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"va.disconnect();"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.6.2"
}
},
"nbformat": 4,
"nbformat_minor": 2
}
%% Cell type:markdown id: tags:
# VA simple acoustic scene
This is a simple example how to create a simple acoustic scene in VA using Python.
%% Cell type:markdown id: tags:
#### Prerequisites
You can ignore this part, it is for preparation purposes only.
%% Cell type:code id: tags:
``` python
importsys
sys.path.append('../../Lib/site-packages')
importos
print('Current working directory:',os.getcwd())
importva
print('Successfully loaded VA Python extension')
```
%% Cell type:markdown id: tags:
### Connect
%% Cell type:code id: tags:
``` python
va.connect("localhost");
```
%% Cell type:markdown id: tags:
Reset VA to clear the scene
%% Cell type:code id: tags:
``` python
va.reset()
```
%% Cell type:markdown id: tags:
Control output gain
%% Cell type:code id: tags:
``` python
va.set_output_gain(0.25)
```
%% Cell type:markdown id: tags:
Add the current working directory or any other relative or absolute directory as a search path to your VA application. From now on, only use relative paths or macros to paths.
> Pathes are relevant on server side, not on a remote client. The files must be available on the computer **where the VA application is running**!
%% Cell type:code id: tags:
``` python
va.add_search_path(os.getcwd());
```
%% Cell type:markdown id: tags:
### Signal source
Create a signal source from a file and start playback with looping mode