Saturday, July 4, 2015

Customizing Notification Rules

One of the most powerful features of Notifications Reader is the notification discovery and the ability to define multiple custom notification matching and text-to-speech rules for a single app.  With some tweaking to the default notification matching rules you have full control over what notifications are read aloud, with personalized text-to-speech output

In this post we will take a look at some of the default notification matching rules discovered for the SoundCloud app and how these can be modified.

After using the SoundCloud app to play and record some audio files Notifications Reader has discovered the following rules:


Discovered rules are always prefixed with [New].  Lets take a look at each one in detail and make some changes to customize the text-to-speech output.

Recording in progress

This notification occurs when SoundCloud is recording and the app loses screen focus to indicate the recording is taking place in background.  Speaking this notification is not really desired and the text-to-speech output will also be recorded, so lets make some edits and disable this specific notification rule. An example of the notification is shown with the notification details of the notification content when the rule was discovered, and the updates the rule definition


  1. Update the Rule Name to identify the notification that will be matched. Removing the [New] to help identify which rules you have modified.
  2. Disable the Enable Rule option to prevent the text-to-speech output
  3. Remove the text-to-speech pattern. The default could be left as this rule is being disabled so no text-to-speech output will occur anyway.
  4. Add a Description with some notes to help remember what this rule is for. This is optional, but can be useful to refer back to.
Now lets look at the matching pattens for this rule.  By default the notifications ID is used as the primary matching criteria. The ID is an internal identifier set by the app that generated the notification.  Many apps use a unique ID for each different type of notification, but some don't so just relying on the ID may not always work. For this example lets set a more specific matching criteria to ensure the rule matches only when Title field (first text field) in the notification begins with the text "Recording in progress" by updating the Title matching rule.


Now all the changes are complete for this rule. Remember to click the tick mark at the top to save your updates.

Processing

When SoundCloud finishes recording an audio file a processing notification is shown to indicate the background work in progress. Lets modify the text-to-speech output for this notification.  The default text-to-speech pattern uses substitution fields to read the application name _APPNAME_ and the Title content _TITLE_ from the notification. Any text can be included in the notification output in combination with the substitution fields.  Update the rule and and descriptions and change the text-to-speech output to:

"Processing new audio file: _TITLE_"


If we look pattern matching criteria for this notification rule we see that the default is to match the notification ID of 2 which is SoundClouds internal id for the "Processing" notification, as with the previous rule we can make the matching criteria more specific. This time we want the match only when the Text field (the second line in the notification) is "Processing"


For simplicity we use the Begins with "Processing" rule definition.  If we want to be very precise we could match only when the content is the Text field is exactly "Processing" using a regular expression (regex) language Match pattern "^Processing$"

Once you've completed the rule modifications remember to Save the changes.

Upload Finished

The Upload Finished notification from SoundCloud occurs when the SoundCloud app has finished uploading a new audio file.  Similar to the Processing notification above lets make the make the changes to customize the text-to-speech output. Here are the completed modifications:


Now Playing

When SoundCloud is playing in backgroud the audio player notification shows the creators/artists name and the track title.  

With the Now Playing notification text-to-speech rule we can make Notifications Reader our personal DJ introducing each new track

The default discovered matching criteria is used for this notification (ID = 1)

The null notification?

This notification rule was discovered with no displayable (or readable) information. The Ticker, Title and Text fields of the notification are all empty, so we'll just update the rule to disable it.


All done

If you've made all the changes detailed above your SoundCloud notification rule list should now look like this:

Any new notifications from SoundCloud that do not match the defined rule criteria will continue to be discovered as new notification rules.

1 comment: