Community Articles
Find and share helpful community-sourced technical articles
Announcements
Alert: Welcome to the Unified Cloudera Community. Former HCC members be sure to read and learn how to activate your account here. Want to know more about what has changed? Check out the Community News blog.
Labels (1)
Super Guru

Business Need: Build Tool Notifications + Fun

SonicPi is an open source, multiple platform live music synthesizer tool for building music via coding. It's a pretty neat environment and runs on a Mac, RPi, Windows machine or Linux machine. I found a command-line tool that can trigger SonicPi to play your code. I have wired up a dataflow from NiFi to SonicPi, so I can trigger music on demand. My thought is I will tie this into Jenkins and play different songs depending on what's going on. Such as Test Failures, Build Complete, Build Broken, New Deployment, based on various steps in the SDLC.

Note: The machine this running on will need Ruby, Gem, Apache NiFi, Sonic Pi and a sound card.

Step 1:

To trigger Sonic Pi, you must install Sonic Pi Cli, via gem install sonic-pi-cli.

Step 2:

Run the SonicPI software and have it up and running. As you can see it's a pretty awesome environment, somewhere between a nice IDE and a music tracker.

10693-sonicp3.png

Step 3: ExecuteStreamCommand This calls the command line tool to trigger Sonic Pi.

10694-sonicpi2.png

NiFi 1.1 Tool

10692-sonicpi1.png

Shell Script

cat /Volumes/Transcend/Apps/nifi-1.1.0.2.1.1.0-2/nifi.rb | /usr/local/bin/sonic_pi

Example SonicPi Code

sample :bass_trance_c
sleep 1
sample :bass_thick_c
sleep 1
use_synth :prophet
play 30, release: 2
sleep 0.25
play 30
sleep 0.25
play 30
sleep 0.25
use_synth :prophet
play 30, release: 2
sleep 0.25
use_synth :prophet
play 30
sleep 0.25
use_synth :prophet
play 30, release: 2
sleep 0.25
use_synth :prophet
play 30
sleep 0.25
use_synth :prophet
play 30
sleep 0.25
use_synth :prophet
play 30, release: 2
sleep 0.25
play 30
sleep 0.25
play 30
sleep 0.25
sample :bass_trance_c
sleep 1
sample :bass_thick_c
sleep 1
use_synth :prophet
play 30, release: 2
sleep 0.25
use_synth :dsaw
play 30
sleep 0.25
sample :ambi_drone
use_synth :prophet
play 30, release: 2
sleep 0.25
use_synth :prophet
play 30, release: 2
sleep 0.25
use_synth :dark_ambience
play 30, release: 2
sleep 0.25
use_synth :dark_ambience
play 30, release: 2
sleep 0.25
use_synth :dark_ambience
play 30, release: 2
sleep 0.25
use_synth :dark_ambience
play 30, release: 2
sleep 0.25
use_synth :dark_ambience
play 30, release: 2
sleep 0.25
use_synth :dark_ambience
play 30, release: 2
sleep 0.25
use_synth :prophet
play 30, release: 2
sleep 0.25
use_synth :prophet
play 30, release: 2
sleep 0.25
use_synth :prophet
play 30, release: 2
sleep 0.25
use_synth :prophet
play 30, release: 2
sleep 0.25
sample :bass_trance_c
sleep 1
sample :bass_thick_c
sleep 1

Reference:

Apache NiFi Template:

sonicpi.xml

782 Views
Comments
Super Guru

We could have NiFi rewrite, update and add to the sonicPI code so the music is constantly changing

Don't have an account?
Coming from Hortonworks? Activate your account here
Version history
Revision #:
2 of 2
Last update:
‎08-17-2019 07:04 AM
Updated by:
 
Contributors
Top Kudoed Authors