Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add OSC support for sending analysis values on mouseover #17

Merged
merged 10 commits into from
Sep 18, 2024
1 change: 1 addition & 0 deletions BinaryData/Resource/ChangeLog.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@

- Add: Add OSC support for sending analysis values on mouseover
- Fix: The "Ignore Matrix Tracks" export option prevents these tracks from being exported independently
- Add: Add a logarithmic scale parameter to tracks that have frequency values in hertz enhancement

Expand Down
31 changes: 31 additions & 0 deletions BinaryData/Sonifier/smo-curve.pd
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
#N canvas 389 445 218 407 12;
#X obj 19 348 outlet~;
#X obj 19 9 inlet;
#X obj 19 167 route \$1;
#X obj 19 68 route mouseover;
#X obj 19 127 spigot;
#X obj 19 40 route list;
#X obj 37 288 line~;
#X obj 19 318 *~;
#X obj 19 191 list split 5;
#X obj 19 238 osc~;
#X obj 19 92 sel 0;
#X msg 37 264 0 20;
#X msg 77 264 1 20;
#X obj 59 215 unpack f;
#X connect 1 0 5 0;
#X connect 2 0 8 0;
#X connect 2 0 12 0;
#X connect 3 0 4 1;
#X connect 3 0 10 0;
#X connect 3 1 4 0;
#X connect 4 0 2 0;
#X connect 5 0 3 0;
#X connect 6 0 7 1;
#X connect 7 0 0 0;
#X connect 8 1 13 0;
#X connect 9 0 7 0;
#X connect 10 0 11 0;
#X connect 11 0 6 0;
#X connect 12 0 6 0;
#X connect 13 0 9 0;
14 changes: 14 additions & 0 deletions BinaryData/Sonifier/smo-example.pd
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#N canvas 1009 591 552 359 12;
#X obj 64 37 oscparse;
#X obj 64 12 netreceive -u -b 9001;
#X obj 64 93 smo-matrix 2476c2bd12534fc48f5612a755917925 1024;
#X obj 122 155 smo-marker d9dc8ffb44944467a7099d1f9877f1ac;
#X obj 108 240 output~;
#X obj 94 123 smo-curve 03570fdcd3f14391a13d069fcabdf7ef;
#X connect 0 0 2 0;
#X connect 0 0 3 0;
#X connect 0 0 5 0;
#X connect 1 0 0 0;
#X connect 2 0 4 0;
#X connect 3 0 4 0;
#X connect 5 0 4 0;
52 changes: 52 additions & 0 deletions BinaryData/Sonifier/smo-marker.pd
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
#N canvas 756 293 379 622 12;
#X obj 19 568 outlet~;
#X obj 19 9 inlet;
#X obj 19 127 route \$1;
#X obj 19 68 route mouseover;
#X obj 19 97 spigot;
#X obj 19 40 route list;
#X obj 37 508 line~;
#X obj 19 538 *~;
#X obj 19 151 unpack f f f f f, f 19;
#X obj 51 250 bang;
#X obj 51 421 vline~;
#X obj 19 448 *~, f 5;
#X obj 121 110 sel 0;
#X obj 51 226 change -1;
#X obj 51 329 spigot;
#X msg 119 194 set -1;
#X obj 51 274 t b b;
#X msg 90 304 1;
#X msg 148 244 0;
#X obj 19 359 noise~;
#X msg 37 481 0 20;
#X msg 77 481 1 20;
#X msg 51 394 1 20 \, 0 20 20;
#X connect 1 0 5 0;
#X connect 2 0 8 0;
#X connect 2 0 21 0;
#X connect 3 0 4 1;
#X connect 3 0 12 0;
#X connect 3 1 4 0;
#X connect 4 0 2 0;
#X connect 5 0 3 0;
#X connect 6 0 7 1;
#X connect 7 0 0 0;
#X connect 8 1 13 0;
#X connect 9 0 16 0;
#X connect 10 0 11 1;
#X connect 11 0 7 0;
#X connect 12 0 15 0;
#X connect 12 0 18 0;
#X connect 12 0 20 0;
#X connect 13 0 9 0;
#X connect 14 0 22 0;
#X connect 15 0 13 0;
#X connect 16 0 17 0;
#X connect 16 1 14 0;
#X connect 17 0 14 1;
#X connect 18 0 14 1;
#X connect 19 0 11 0;
#X connect 20 0 6 0;
#X connect 21 0 6 0;
#X connect 22 0 10 0;
114 changes: 114 additions & 0 deletions BinaryData/Sonifier/smo-matrix.pd
Original file line number Diff line number Diff line change
@@ -0,0 +1,114 @@
#N canvas 651 277 489 440 12;
#X obj 247 270 noise~;
#N canvas 234 325 556 619 fft-analysis 1;
#X obj 32 186 *~;
#X obj 32 105 inlet~;
#X obj 32 248 rfft~;
#X obj 50 160 tabreceive~ \$0-hann;
#X obj 32 365 *~;
#X obj 71 365 *~;
#X obj 89 205 tabreceive~ \$0-gain;
#X obj 32 518 *~;
#X obj 50 492 tabreceive~ \$0-hann;
#X obj 32 421 rifft~;
#X obj 32 579 outlet~;
#X msg 439 204 0;
#X obj 344 253 osc~, f 14;
#X obj 344 205 samplerate~;
#X obj 344 276 *~ -0.5;
#X obj 344 299 +~ 0.5;
#X obj 321 324 tabwrite~ \$0-hann;
#X obj 321 142 bng 19 250 50 0 empty empty empty 0 -6 0 8 #dfdfdf #000000 #000000;
#X obj 321 121 loadbang;
#X obj 277 361 array size \$0-gain;
#X obj 277 332 / 2;
#X obj 321 166 t b b b;
#X msg 244 429 const 0;
#X obj 245 271 t b b;
#X obj 244 453 s \$0-gain;
#X obj 344 229 / \$2;
#X obj 277 308 f \$2;
#X obj 30 33 block~ \$2 4;
#X obj 89 310 /~ 1;
#X connect 0 0 2 0;
#X connect 1 0 0 0;
#X connect 2 0 4 0;
#X connect 2 1 5 0;
#X connect 3 0 0 1;
#X connect 4 0 9 0;
#X connect 5 0 9 1;
#X connect 6 0 28 0;
#X connect 7 0 10 0;
#X connect 8 0 7 1;
#X connect 9 0 7 0;
#X connect 11 0 12 1;
#X connect 12 0 14 0;
#X connect 13 0 25 0;
#X connect 14 0 15 0;
#X connect 15 0 16 0;
#X connect 17 0 21 0;
#X connect 17 0 23 0;
#X connect 18 0 17 0;
#X connect 20 0 19 0;
#X connect 21 0 16 0;
#X connect 21 1 13 0;
#X connect 21 2 11 0;
#X connect 22 0 24 0;
#X connect 23 0 22 0;
#X connect 23 1 26 0;
#X connect 25 0 12 0;
#X connect 26 0 20 0;
#X connect 28 0 4 1;
#X connect 28 0 5 1;
#X restore 247 295 pd fft-analysis;
#X obj 53 389 array set \$0-gain, f 25;
#X obj 247 409 outlet~;
#X obj 13 205 list split 5;
#X obj 53 231 unpack;
#X obj 53 255 swap, f 13;
#X obj 53 359 clip 0 1;
#X obj 276 62 array define \$0-gain;
#X obj 53 280 + 120;
#X obj 53 308 * 0.833333;
#X obj 53 332 dbtorms;
#X obj 13 20 inlet;
#X obj 276 31 array define \$0-hann \$2;
#X obj 13 138 route \$1;
#X obj 13 174 t l b, f 25;
#X msg 185 200 const 0;
#X obj 185 224 s \$0-gain;
#X obj 13 79 route mouseover;
#X obj 13 108 spigot;
#X obj 13 51 route list;
#X obj 265 349 line~;
#X obj 247 379 *~;
#X msg 270 323 0 20;
#X msg 310 323 1 20;
#X obj 272 182 sel 0;
#X connect 0 0 1 0;
#X connect 1 0 22 0;
#X connect 4 1 5 0;
#X connect 5 0 6 0;
#X connect 5 1 6 1;
#X connect 6 0 9 0;
#X connect 6 1 2 1;
#X connect 7 0 2 0;
#X connect 9 0 10 0;
#X connect 10 0 11 0;
#X connect 11 0 7 0;
#X connect 12 0 20 0;
#X connect 14 0 15 0;
#X connect 14 0 24 0;
#X connect 15 0 4 0;
#X connect 15 1 16 0;
#X connect 16 0 17 0;
#X connect 18 0 19 1;
#X connect 18 0 25 0;
#X connect 18 1 19 0;
#X connect 19 0 14 0;
#X connect 20 0 18 0;
#X connect 21 0 22 1;
#X connect 22 0 3 0;
#X connect 23 0 21 0;
#X connect 24 0 21 0;
#X connect 25 0 23 0;
23 changes: 19 additions & 4 deletions Docs/Partiels-Manual.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
* [8.1. View](#81-view)
* [8.2. Zoom](#82-navigation)
* [8.3. Transport](#83-transport)
* [8.4. OSC](#83-osc)
* [8.4. OSC](#84-osc)
* [9. Track properties](#9-track-properties)
* [9.1. Processor](#91-processor)
* [9.2. Graphical](#92-graphical)
Expand Down Expand Up @@ -510,7 +510,7 @@ The actions to move the start position of the playback head and control the play

### 8.4. OSC

Partiels offers the option of sending analysis track values via OSC (Open Sound Control) during playback. Information can be retrieved from other applications (such as PureData, Live, Reaper, etc.) for real-time sonification of results.
Partiels offers the option of sending analysis track values via OSC (Open Sound Control) during playback or when hovering over tracks and groups with the mouse with the keyboard modifier `⎇ Option` (Mac) or `Alt` (Linux/Windows). Information can be retrieved from other applications (such as PureData, Live, Reaper, etc.) for real-time sonification of results.

Connection to the host is configured via the OSC property panel, accessible via the menu `Partiels → OSC Settings...` (Mac) or `Help → OSC Settings...` on (Linux/Windows), or by clicking on the OSC button ([Overview](#2-overview) **O**) in the center of the main interface header (when OSC is connected, button turns green.).

Expand All @@ -522,9 +522,10 @@ To enable a track's results to be sent via OSC, the corresponding option must be

To ensure compatibility with as many applications as possible, results are sent in the form of messages (no bundles).

Messages are sent each time playback is advanced. For each channel of each track whose OSC is activated, a message corresponding to the result whose time is greater than or equal to the playback time is sent with the address corresponding to the track identifier followed by :
When playback starts and stops, the OSC messages `playback 1` and `playback 0` are sent. During playback, OSC messages are sent each time the playhead advances. For each channel of each track whose OSC is activated, a message corresponding to the result whose time is greater than or equal to the playback time is sent:

1. Channel index (int)
1. Track address (string)
2. Channel index (int)
3. Result index (int)
4. Playback time (float)
5. Result time (float)
Expand All @@ -535,6 +536,20 @@ Messages are sent each time playback is advanced. For each channel of each track
- Size (int) and list of numbers (float) for a vector
8. List of numbers (float) for the extra values

When playback is paused, the information are sent when hovering over groups and tracks with the mouse and the keyboard modifier `⎇ Option` (Mac) or `Alt` (Linux/Windows). The OSC messages `mouseover 1` and `mouseover 0` are sent when messages start or stop being sent. Each time the mouse is moved, and for each track under the cursor, a message containing the results is sent with the address corresponding to the track identifier followed by:

1. Track address (string)
2. Channel index (int)
3. Result index (int)
4. Playback time (float)
5. Result time (float)
6. Result duration (float)
7. Result values:
- Label string for a marker (string)
- Value number for a value (float) or "-" label for a break (string)
- Bin index (int) and value of the bin (float) for a vector
8. List of numbers (float) for the extra values

<div style="page-break-after: always;"></div>

## 9. Track properties
Expand Down
28 changes: 14 additions & 14 deletions Docs/Project/J'attendrai.ptldoc
Original file line number Diff line number Diff line change
Expand Up @@ -13,26 +13,26 @@
<layout value="daaaa5e9ca9440919fee0457c301a5ae"/>
<layout value="66cf756a43824c299a0256f18b5df652"/>
<timeZoom MiscModelVersion="131077" globalRange_start="0.0" globalRange_end="57.12369614512472"
minimumLength="0.01160997732426304" visibleRange_start="3.528004907626882"
visibleRange_end="24.10047110740583">
minimumLength="0.01160997732426304" visibleRange_start="6.833910363234121"
visibleRange_end="17.05217626551128">
<grid MiscModelVersion="131077" tickReference="0.0" mainTickInterval="0"
tickPowerBase="2.0" tickDivisionFactor="10.0"/>
</timeZoom>
<transport MiscModelVersion="131077" startPlayhead="12.52366714653643" looping="0"
<transport MiscModelVersion="131077" startPlayhead="9.150473751017453" looping="0"
loopRange_start="55.674250339" loopRange_end="56.208309296" stopAtLoopEnd="0"
autoScroll="1" gain="0.06478693864793536" magnetize="0"/>
<groups MiscModelVersion="131077" identifier="66cf756a43824c299a0256f18b5df652"
name="Group 2" height="332" colour="0" expanded="1" referenceid="">
name="Group 2" height="687" colour="0" expanded="0" referenceid="">
<layout value="03570fdcd3f14391a13d069fcabdf7ef"/>
<layout value="2476c2bd12534fc48f5612a755917925"/>
<zoom MiscModelVersion="131077" globalRange_start="0.0" globalRange_end="1.0"
minimumLength="0.0" visibleRange_start="0.0" visibleRange_end="1.0">
minimumLength="0.0" visibleRange_start="0.0" visibleRange_end="0.1754060008333296">
<grid MiscModelVersion="131077" tickReference="0.0" mainTickInterval="3"
tickPowerBase="2.0" tickDivisionFactor="5.0"/>
</zoom>
</groups>
<groups MiscModelVersion="131077" identifier="daaaa5e9ca9440919fee0457c301a5ae"
name="Group 1" height="269" colour="0" expanded="0" referenceid="4012ed3f6d2a4d5d8b2c0bd4e771088e">
name="Group 1" height="184" colour="0" expanded="0" referenceid="4012ed3f6d2a4d5d8b2c0bd4e771088e">
<layout value="d9dc8ffb44944467a7099d1f9877f1ac"/>
<layout value="4012ed3f6d2a4d5d8b2c0bd4e771088e"/>
<zoom MiscModelVersion="131077" globalRange_start="0.0" globalRange_end="1.0"
Expand All @@ -42,9 +42,9 @@
</zoom>
</groups>
<tracks MiscModelVersion="131077" identifier="2476c2bd12534fc48f5612a755917925"
name="Fast Fourier Transform" input="" sampleRate="44100.0" height="133"
font="Nunito Sans; 14.0 Regular" showInGroup="1" sendViaOsc="0"
zoomValueMode="1" zoomLogScale="1" zoomLink="1">
name="Fast Fourier Transform" input="" sampleRate="44100.0" height="360"
font="Nunito Sans; 14.0 Regular" showInGroup="1" sendViaOsc="1"
zoomValueMode="1" zoomLogScale="0" zoomLink="1">
<file path="" commit="">
<args/>
</file>
Expand Down Expand Up @@ -633,15 +633,15 @@
tickPowerBase="2.0" tickDivisionFactor="5.0"/>
</valueZoom>
<binZoom MiscModelVersion="131077" globalRange_start="0.0" globalRange_end="513.0"
minimumLength="1.0" visibleRange_start="0.0" visibleRange_end="513.0">
minimumLength="1.0" visibleRange_start="0.0" visibleRange_end="89.98327842749809">
<grid MiscModelVersion="131077" tickReference="0.0" mainTickInterval="3"
tickPowerBase="2.0" tickDivisionFactor="5.0"/>
</binZoom>
</tracks>
<tracks MiscModelVersion="131077" identifier="03570fdcd3f14391a13d069fcabdf7ef"
name="Spectral Centroid" input="" sampleRate="44100.0" height="137"
font="Nunito Sans; 14.0 Regular" showInGroup="1" sendViaOsc="0"
zoomValueMode="1" zoomLogScale="1" zoomLink="1">
name="Spectral Centroid" input="" sampleRate="44100.0" height="336"
font="Nunito Sans; 14.0 Regular" showInGroup="1" sendViaOsc="1"
zoomValueMode="1" zoomLogScale="0" zoomLink="1">
<file path="" commit="">
<args/>
</file>
Expand Down Expand Up @@ -717,7 +717,7 @@
<channelsLayout value="1"/>
<valueZoom MiscModelVersion="131077" globalRange_start="0.0" globalRange_end="22050.0"
minimumLength="1.192092895507812e-7" visibleRange_start="0.0"
visibleRange_end="22050.0">
visibleRange_end="3867.702318374918">
<grid MiscModelVersion="131077" tickReference="0.0" mainTickInterval="0"
tickPowerBase="10.0" tickDivisionFactor="4.0"/>
</valueZoom>
Expand Down
10 changes: 7 additions & 3 deletions Source/Application/AnlApplicationInstance.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -101,8 +101,11 @@ void Application::Instance::initialise(juce::String const& commandLine)
mDownloader = std::make_unique<Downloader>();
AppQuitIfInvalidPointer(mDownloader);

mOscDispatcher = std::make_unique<Osc::Dispatcher>(getOscSender());
AppQuitIfInvalidPointer(mOscDispatcher);
mOscTransportDispatcher = std::make_unique<Osc::TransportDispatcher>(getOscSender());
AppQuitIfInvalidPointer(mOscTransportDispatcher);

mOscMouseDispatcher = std::make_unique<Osc::MouseDispatcher>(getOscSender());
AppQuitIfInvalidPointer(mOscMouseDispatcher);

checkPluginsQuarantine();

Expand Down Expand Up @@ -310,7 +313,8 @@ void Application::Instance::shutdown()
backupFile.getSiblingFile("Tracks").deleteRecursively();
Document::FileBased::getConsolidateDirectory(backupFile).deleteRecursively();

mOscDispatcher.reset();
mOscMouseDispatcher.reset();
mOscTransportDispatcher.reset();
mDownloader.reset();
mMainMenuModel.reset();
mWindow.reset();
Expand Down
3 changes: 2 additions & 1 deletion Source/Application/AnlApplicationInstance.h
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,8 @@ namespace Application
std::unique_ptr<MainMenuModel> mMainMenuModel;
std::unique_ptr<CommandLine> mCommandLine;
std::unique_ptr<Downloader> mDownloader;
std::unique_ptr<Osc::Dispatcher> mOscDispatcher;
std::unique_ptr<Osc::TransportDispatcher> mOscTransportDispatcher;
std::unique_ptr<Osc::MouseDispatcher> mOscMouseDispatcher;

std::atomic<bool> mIsPluginListReady{true};
juce::File mPreviousFile{};
Expand Down
Loading