Network Interface for Soundscape Renderer in MATLAB

8 views
Skip to first unread message

alk...@vt.edu

unread,
May 17, 2016, 7:13:17 PM5/17/16
to SoundScape Renderer
Hello,

I am relatively new to SSR and I was trying to use SSR's network interface with MATLAB. I got stuck and while looking for an answer I found: https://groups.google.com/forum/#!topic/SoundScapeRenderer/_i-IsraJ97Q , where Richard Hughes mentioned his own ssrcontroller MATLAB function. Therefore, I thought you might be able to help me with my problem.

What I tried:
1) On the computer (OS X 10.11.4) where I run SSR, I listened to a port with netcat: nc -l 4000

2) I established a connection with MATLAB from a different computer (Ubuntu 14.04 and MATLAB R2014b):
%prep
t = tcpip('192.168.2.12', 4000); %define ip and port
fopen(t); %open connection
set(t, 'Terminator', '0'); %change terminator to desired terminator binary zero as documented in https://ssr.readthedocs.io/en/latest/network.html

3) I checked the connection via sudo lsof -i -n -P | grep TCP on the MAC. As expected my connections where listed.

4) I send data with MATLAB and looked at the nc output from step 1. It came out just the way I wanted it to.
%write data
fprintf(t, '%s\n', '<request><scene volume="6"/></request>');

5) I closed all connections and cleaned up.
%cleanup
fclose(t);
delete(t);
clear t;

6) I opened an instance of SSR on the Mac and set the port to 4000 with the option --ip-server=4000.
I repeated step 2 and 4, but nothing happened.

I tried a bunch of different ways to send the data and I tried different commands too. In the end I want to move a source to certain coordinates.
Unfortunately, I did not get it to work so far. If I try to read data in MATLAB to see if the connection works with
data = fscanf(t)
it works perfectly fine. I get a string with all parameters:
<update><volume>0</volume><transport>stop</transport><reference><position x="0 .....

My first guess was that something is wrong with the Terminator, but I tried different things and nothing worked.

I am sure I am doing a dumb mistake here, but I just can't figure it out. I would be very glad if someone could help me out.

Thanks,

Alex

Matthias Geier

unread,
May 18, 2016, 3:35:05 AM5/18/16
to alk...@vt.edu, SoundScape Renderer
Hi Alex.

I don't have the Instrument Control Toolbox installed (and I hate
Matlab), so I can't try it myself.

Nevertheless, looking at your code, this might be the problem:

set(t, 'Terminator', '0');

According to http://de.mathworks.com/help/instrument/terminator.html,
you may specify a number or an ASCII character for the "Terminator".

You gave '0', which is not the same as a binary zero!

Did you try this?

set(t, 'Terminator', 0);

Or this?

set(t, 'Terminator', '\0');

cheers,
Matthias
> --
> You received this message because you are subscribed to the Google Groups
> "SoundScape Renderer" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to SoundScapeRende...@googlegroups.com.
> To post to this group, send email to SoundScap...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/SoundScapeRenderer/0037b0bd-1372-4929-91af-8a270dfd66d3%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

Alexander Kern

unread,
May 18, 2016, 10:18:09 AM5/18/16
to Matthias Geier, SoundScape Renderer

Hello Matthias,

thank you for the quick reply. Thank you so much. I don't know why I have ' ' there... I did not try it out yet, but I am almost certain that this is it. Weird though, MATLAB should have thrown me an error since in the documentation it says only integers accepted.

Probable solution:

The character '0' is represented in binary data by the ASCII number 48. The binary 0 (Null) by the number 0. -> ASCII Table: http://www.asciitable.com/

Thus set(t, 'Terminator', 0); should do the trick.

I'll let you know as soon as I got it tested.

Thanks,

Alex

Alexander Kern

unread,
May 18, 2016, 7:02:53 PM5/18/16
to Matthias Geier, SoundScape Renderer
Hello,

set(t, 'Terminator', 0); solves the issue.

Thank you.

Alex


On 5/18/16 3:34 AM, Matthias Geier wrote:
Reply all
Reply to author
Forward
0 new messages