Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Hertz-Lab
Research
Intelligent Museum
Language Identifier
Commits
309701f1
Commit
309701f1
authored
Aug 12, 2021
by
Dan Wilcox
Browse files
added osc /autostop message, updated readme
parent
898d0f8e
Changes
3
Hide whitespace changes
Inline
Side-by-side
README.md
View file @
309701f1
...
...
@@ -118,6 +118,7 @@ Usage: LanguageIdentifier [OPTIONS]
Options:
-h
,--help Print this
help
message and
exit
-s
,--senders TEXT ... OSC sender addr:port host pairs, ex.
"192.168.0.100:5555"
or multicast
"239.200.200.200:6666"
, default
"localhost:9999"
-p
,--port INT OSC receiver port, default 9898
-c
,--confidence FLOAT:FLOAT bounded to
[
0 - 1]
min confidence, default 0.75
-t
,--threshold FLOAT:INT bounded to
[
0 - 100]
...
...
@@ -127,6 +128,8 @@ Options:
--inputname
TEXT audio input device name, can
do
partial match, ex.
"Microphone"
--inputchan
INT audio input device channel, default 1
-r
,--samplerate INT audio input device samplerate, can be 441000 or a multiple of 16000, default 48000
--nolisten
do
not listen on start
--autostop
stop listening automatically after detection
-v
,--verbose verbose printing
--version
print version and
exit
```
...
...
@@ -137,6 +140,17 @@ For example, to send OSC to multiple addresses use the `-s` option:
% bin/LanguageIdentifier
-s
localhost:9999 localhost:6666 192.168.0.101:7777
```
#### OSC spec
LanguageIdentifier listens on port 9898 by default and responds to the following OSC messages:
*
**/listen**
: start listening
*
**/listen _state_**
: start/stop listening
-
state: bool, 0 - stop, 1 - start
*
**/autostop**
: enable listening auto stop after detection
*
**/autostop _state_**
: enable/disable listening auto stop after detection
-
state: bool, 0 - keep listening, 1 - stop on detection
#### macOS
For macOS, the application binary can be invoked from within the .app bundle to pass commandline arguments:
...
...
src/ofApp.cpp
View file @
309701f1
...
...
@@ -311,13 +311,23 @@ void ofApp::audioIn(ofSoundBuffer & input) {
//--------------------------------------------------------------
void
ofApp
::
keyPressed
(
int
key
)
{
if
(
key
==
'l'
)
{
if
(
listening
)
{
stopListening
();
}
else
{
startListening
();
}
switch
(
key
)
{
case
'l'
:
if
(
listening
)
{
stopListening
();
}
else
{
startListening
();
}
break
;
case
'a'
:
if
(
autostop
)
{
enableAutostop
();
}
else
{
disableAutostop
();
}
break
;
}
}
...
...
@@ -399,10 +409,31 @@ void ofApp::stopListening() {
ofLogVerbose
(
PACKAGE
)
<<
"listening "
<<
listening
;
}
//--------------------------------------------------------------
void
ofApp
::
enableAutostop
()
{
if
(
!
autostop
)
{
ofLogVerbose
(
PACKAGE
)
<<
"autostop "
<<
autostop
;
}
autostop
=
true
;
}
//--------------------------------------------------------------
void
ofApp
::
disableAutostop
()
{
if
(
autostop
)
{
ofLogVerbose
(
PACKAGE
)
<<
"autostop "
<<
autostop
;
}
autostop
=
false
;
}
//--------------------------------------------------------------
void
ofApp
::
oscReceived
(
const
ofxOscMessage
&
message
)
{
if
(
message
.
getAddress
()
==
"/listen"
)
{
if
(
message
.
getNumArgs
()
>
0
)
{
if
(
message
.
getNumArgs
()
==
0
)
{
if
(
!
listening
)
{
startListening
();
}
}
else
if
(
message
.
getNumArgs
()
==
1
)
{
if
(
message
.
getArgAsBool
(
0
))
{
startListening
();
}
...
...
@@ -411,4 +442,17 @@ void ofApp::oscReceived(const ofxOscMessage &message) {
}
}
}
else
if
(
message
.
getAddress
()
==
"/autostop"
)
{
if
(
message
.
getNumArgs
()
==
0
)
{
enableAutostop
();
}
else
if
(
message
.
getNumArgs
()
==
1
)
{
if
(
message
.
getArgAsBool
(
0
))
{
enableAutostop
();
}
else
{
disableAutostop
();
}
}
}
}
src/ofApp.h
View file @
309701f1
...
...
@@ -56,6 +56,12 @@ class ofApp : public ofBaseApp {
/// stop listening
void
stopListening
();
/// enable listening auto stop after detection
void
enableAutostop
();
/// disable listening auto stop after detection
void
disableAutostop
();
/// osc receiver callback
void
oscReceived
(
const
ofxOscMessage
&
message
);
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment