SlideShare a Scribd company logo
1 of 20
Download to read offline
© Domenico Cipriani, 2023
MUSIC
With PHARO
© Domenico Cipriani, 2023
MUSIC with PHARO
•Pharo as an OSC/MIDI performer/sequencer/controller.
•Pharo as a language for live-coding/ programming -music-on-the-
fl
y.
•Pharo does not generate any sound (for now).
•Pharo as a client for a MIDI instrument (internal/external) or for an OSC audio server (i.e.
SuperCollider, PureData, ChucK, Max/MSP, Kyma)
OSC
https://github.com/Ducasse/OSC
Pharo-Sound
https://github.com/pharo-contributions/pharo-sound
MIDI connections implementations
OSC implementation
LiveCoding Package
https://github.com/lucretiomsp/PharoLiveCoding
Domain Speci
fi
c Dialect
© Domenico Cipriani, 2023
MUSIC with PHARO
Pharo-Sound
https://github.com/pharo-contributions/pharo-sound
MIDI connections implementations
PortMidi C external cross-platform library implemented in
Pharo using the Uni
fi
ed FFI package by Antoine Delaby and
Santiago Bragagnolo
Full MIDI functionalities in Pharo
Connect to external MIDI hardware or to a virtual MIDI bus,
IAC Driver on Mac or MIDI Yoke* on Windows (*not native)
It is used by the LiveCoding Package for MIDI connections
Transform Pharo into a MIDI sequencer
Allows to create custom GUI MIDI controllers
The MIDI (Musical Instrument Digital Interface) protocol, developed collaboratively by Dave Smith, Chet Wood, and Ikutaro
Kakehashi in 1983, is a standardised communication protocol used in electronic music equipment. It facilitates the
transmission of musical information like notes, control parameters, and timing data between di
ff
erent devices such as
synthesizers, computers, and controllers.
© Domenico Cipriani, 2023
MUSIC with PHARO
Open Sound Control implementation for Pharo, Originally developed
and license under MIT by Markus Gaelli and then Simon Holland. Now
cleaned and maintained by S. Ducasse.
Necessary dependency of the LiveCoding Package.
Send and receive OSC messages via UDP
OSC OpenSoundControl (OSC) is a data encoding for realtime message
communication among applications and hardware. Developed by Matt
Wright and Adrian Freed at CNMAT
Highly accurate, lightweight, low latency, widespread
OSC
https://github.com/Ducasse/OSC
OSC implementation
© Domenico Cipriani, 2023
MUSIC with PHARO
LiveCoding Package
https://github.com/lucretiomsp/PharoLiveCoding
Domain Speci
fi
c Dialect
Play sounds from an audio server or MIDI instrument
Create, transform and manipulate Rhythms
Create, transform and manipulate melodies, chords and arpeggio
Create custom OSC controllers
Can also be used and expanded to be used (via OSC or MIDI) with
software for visual arts such as Processing, Touch Designer, Hydra
LiveCoding Package
https://github.com/lucretiomsp/PharoLiveCoding
Domain Speci
fi
c Dialect
© Domenico Cipriani, 2023
MUSIC with PHARO
Performance
performer: aPerformer
freq: aFloat
transportStep: anInteger
activeProcess: aProcess
play
stop
mute: aKeyOrAnArrayOfKeys
Dictionary
uniqueInstance
solo: aKey
at: aKey put: aSequencer Performer
play
solo: aKey
PerformerLocal
play
PerformerMIDI
play
PerformerKyma
play
PerformerSuperDirt
play
• The Performance class is a Singleton.
• Performance is a subclass of Dictionary.
• A Performer must be assigned to the Performance; the Performer selects the audio backend.
• The play method starts the Performance, and increments the transportStep every freq seconds
(0.125 s at 120 bpm).
© Domenico Cipriani, 2023
MUSIC with PHARO
Sequencer
notes: anArray
durations: anArray
dirtMessage: aDictionary
noteIndex: anInteger
gates: aRhythmOrAnArray
midiChannel: anInteger
Sequencer
SequencerMono SequencerPoly
Object
• A SequencerMono sends out a note at once every time there is a gate.
• A SequencerPoly sends out chords
• The contents of a Sequencer can have di
ff
erent size, i.e. lengths, for example:
Sequencer new gates: 16 semiquavers; notes: #(32 48 51); duration: #(0.2 0.3 0.5 1 0.4 0.6).
aSequencer to: #aKey
= Performance uniqueInstance at: #aKey put: aSequencer
© Domenico Cipriani, 2023
MUSIC with PHARO
P
E
R
F
O
R
M
A
N
C
E
SEQUENCER
SEQUENCER
SEQUENCER
SEQUENCER
SEQUENCER
transportStep increments of 1 every Performance uniqueInstance freq (seconds)
SEQUENCER
gates
notes
durations
dirtMessage
© Domenico Cipriani, 2023
MUSIC with PHARO
Performance, Sequencers, how does them work?
• Sequencers are inspired by traditional hardware sequencers, where triggers (~noteOn) events are notated in Time Unit
Box System (TUBS).
p := Performance uniqueInstance.
p performer: PerformerLocal new.
p freq: 136 bpm. "change the performances speed"
#( 1 0 0 0 1 1 0 0 1 0) asSeq notes: #(32 37 38) to: #bass. “create a Sequencer and assign it to the performance "
p play. "start the performance".
p stop. "stop the performance"
Performance >>> play
self performer play
• Performance can be thought as a multitrack player for Sequencers.
• Sequencer are
fi
lled with parameters.
• A Performer must be assigned to the Performance.
#( 1 0 0 0 1 0 0 0 1 0 1 0 1 0 0 0 ) asSeq
TUBS Traditional LiveCoding Dialect
© Domenico Cipriani, 2023
MUSIC with PHARO
Quick MIDI connections
PortMidi traceAllDevices.
mout := MIDISender new.
mout openWithDevice: 5.
•Get a list of all the available devices, create a new instance of MIDISender, open the MIDISender
on the selected device
16 downbeats midiCh: 9 to: #kick.
16 upbeats midiCh: 12 to: #hat.
16 rumba, 16 banda midiCh: 3 to: #tom.
16 semiquavers notes: #(36 48 56 51 62 74 32) midiCh: 1 to: #bass.
•To play a MIDI performance, a MIDI channel must be speci
fi
ed for each sequencer sending the
message midiCh:
mout allNotesOff
•If MIDI notes got stuck / keep playing!
© Domenico Cipriani, 2023
MUSIC with PHARO
How to create a Sequencer with the LiveCoding Dialect
• By sending messages (named as a rhythm) to integers, you create a Sequencer with the size of the integer, for example:
• By sending the hexBeat message to a string containing natural numbers and characters $A - $F, you create a Sequencer with the
corresponding hexBeat (https://kunstmusik.github.io/learn-hex-beats/), for example:
• 16 downbeats
• 32 rumba
• 4 breves
• 8 semiquavers
• '8888' hexBeat
• '9090' hexBeat
• '80802ACDE9347B' hexBeat
• By sending the euclidean message to an array containing the onsets/triggers and the number of step,s you create a Sequencer with the
corresponding euclidean rhythm (http://cgm.cs.mcgill.ca/~godfried/publications/ban
ff
.pdf), for example:
• #(3 8) euclidean
• #(5 16) euclidean
• #(7 12) euclidean
© Domenico Cipriani, 2023
MUSIC with PHARO
• Iconicity
• Economy
• Polysemy
Written code should resemble what we hear
Type less!
Principles
Many ways to do the same thing
16 upbeats
#(60 63 67) + 16
8 downbeats
#(1 0 0 0 1 0 0 0) asSeq
'88' hexBeat
• “The only primary principle of every human action, including verbal communication,
is the expenditure of the least amount of e
ff
ort to accomplish a task”. (George Zipf)
“Iconicity is the relation of similarity between two aspects of a sign: its form and its
meaning. An iconic sign is a sign that in some way resembles its meaning”.(Meir)
© Domenico Cipriani, 2023
MUSIC with PHARO
Chord/Scale/Arpeggios
• 4 breves chords: 'c-minor d-minor e-minor13 e#-sus4'; to: #superpiano.
• 16 semiquavers arpeggiate: 'f-minor7 d-minor13 g-sus2'; to: #superchip.
•18 Scales from all around the world, sending the name of a scale to the Scale class returns an
array with the intervals of the scale
•47 types of chords, can be parsed into arrays of intervals sending the message chordsToArrays
to a string containing the chords separated by a space in the form:
root[+ # for sharp]-typeofchord
• Scale sakura.
• Scale
fl
amenco
© Domenico Cipriani, 2023
MUSIC with PHARO
Stochastic methods of the LiveCoding Dialect
•Random trigs
• 64 randomTrigs.
• 128 randomTrigsWithProbability: 75
• 64 randomSamplesFromFolder: ’cpu’.
•Random trigs and random samples from a folder
• 64 randomNotesFrom: Scale gypsy octaves:2
• 128 quavers sound: 'superchip'
•Random note from a scale spread over 2 octaves
•Random samples from a SuperDirt sample folder
© Domenico Cipriani, 2023
MUSIC with PHARO
Transformative methods of the LiveCoding Dialect
• Join sequencers (with comma):
16 downbeats , '000F' hexBeat, 16 randomTrigs.
•Reverse sequencers
'000F' hexBeat reverse.
•Flip gates/rests
#(5 12) euclidean
fl
ip.
•O
ff
set sequencer (shift left with negative value, shift to right with positive value)
16 upbeats offset: 1.
•Repeats elements
4 copiesOfEach: #(-12 -10 -9 -8).
•“Transpose” elements
#(-12 -10 -9 -8) + 2.
^ #(-12 -12 -12 -12 -10 -10 -10 -10 -9 -9 -9 -9 -8 -8 -8 -8)
^ #(-10 -8 -7 -6 )
MUSIC with PHARO
New!
Performance uniqueInstance performer: PerformerSuperDirt new
Now it is possible to use Pharo as a sequencer for the SuperDirt audio engine for SuperCollider
• From Pharo we send OSCBundles with timestamps(NTP timestamps), and the SuperCollider audio server takes care of the
scheduling of the messages.
• OSCBundles are sent with a latency of 50 milliseconds (a little latency is require by the sc server for proper scheduling).
• The Sequencers instance variable called dirtMessage is a Dictionary that contains associations keys->values that are send to
SuperCollider into an OSC Bundle; a quick reference to the keys and values can be found here:
https://tidalcycles.org/docs/reference/synthesizers https://tidalcycles.org/docs/reference/audio_e
ff
ects
Pharo to SuperDirt
• SuperCollider is an audio server, programming language, and IDE for sound synthesis and algorithmic
composition. Originally released by James McCartney for real-time audio synthesis and logarithmic
composition.
• The language combines the object-oriented structure of Smalltalk and features from functional
programming language with a C-like syntax.
• SuperDirt is the SuperCollider implementation of the Dirt sampler, originally designed for the
TidalCycles environment. It is a framework for playing samples and synths, controllable over the
Open Sound Control protocol, and locally from the SC language. SuperDirt is also used by Sardine, a
live coding environment for Python 3.10+ created by Raphaël Forment.
© Domenico Cipriani, 2023
MUSIC with PHARO
New!
• 'cp ~ sd ht lt ~ ~ mt' forDirt to: #groove.
• 16 downbeats sound: 'bd:3' ; to: #kick.
• #(5 12) euclidean
fl
ip to: #sd.
• 16 bomba sound: 'mt'; dirtNotes: #(3 2 9 8); to: #toms; add: 'squiz'->#(2 3 7).
• 64 randomSamplesFromFolder: ’cpu’.
• #(5 12) euclidean randomSamplesFromFolder: ‘mt’.
• 4 breves sound: 'supersaw' dirtNotes: #(0 1 2 3); gain: 0.7; to: #piano .
• ‘hoover' once.
• ‘hoover' onceAtSpeed: 2.
Syntax for SuperDirt
© Domenico Cipriani, 2023
MUSIC with PHARO
New!
The dirtMessage
• The instanceVariable of the Sequencers called dirtMessage contains an infrastructure for the messages
sent in the OSCBundle to the SuperDirt audio engine, for example:
's'->#('clap') 'n'->#(0 3 2 1 5) 'squiz'->#(2 1 0.9)
16 tresillo sound: 'clap'; dirtNotes: #(0 3 2 1 5); squiz:#(2 1 0.9)
Sequencer >>> playFullDirtEventAt: anIndex
"sends a mesaage to SuperDirt with all the desired OSC arguments and values"
| message dur stepDuration|
stepDuration := Performance uniqueInstance freq.
message := OrderedCollection new.
message add: '/dirt/play'.
dur := self durations asDirtArray wrap: anIndex .
message add: 'delta'; add: stepDuration * dur.
dirtMessage keysAndValuesDo: [ :key :value | message add: key; add: (value asDirtArray wrap: anIndex ) ].
(OSCBundle for: { OSCMessage for: message } ) sendToAddressString: '127.0.0.1' port: 57120.
Array >> wrap: anInteger [
“inspired by Cmajor language wrap<int> always wrap the
index of the array to the array size"
| result |
result := self at: anInteger - 1 % self size + 1.
^ result
OSCMessage address
© Domenico Cipriani, 2023
MUSIC with PHARO
•More and more test!
•Better and exhaustive documentation and tutorials!
•A custom Playground.
•More GUI elements!
•Cyclical patterns as in Tidal Cycles ( https://tidalcycles.org) + a parser for Tidal Cycles’ mini
notation.
•In the web browser with PharoJS?
•Generate sound and create instruments and e
ff
ects inside Pharo embedding the FAUST compiler
(https://faustcloud.grame.fr)
AND WHAT ABOUT
THE FUTURE?
© Domenico Cipriani, 2023
mercí

More Related Content

Similar to Music With Pharo

Livecoding with impromptu
Livecoding with impromptuLivecoding with impromptu
Livecoding with impromptuMichele Pasin
 
Nerd sniping myself into a rabbit hole... Streaming online audio to a Sonos s...
Nerd sniping myself into a rabbit hole... Streaming online audio to a Sonos s...Nerd sniping myself into a rabbit hole... Streaming online audio to a Sonos s...
Nerd sniping myself into a rabbit hole... Streaming online audio to a Sonos s...Maarten Balliauw
 
Ig2 task 1 work sheet connor martin
Ig2 task 1 work sheet connor martinIg2 task 1 work sheet connor martin
Ig2 task 1 work sheet connor martinKalen612
 
Drumwavy VST VST3 Audio Unit: Orchestral and Ethnic Percussion VST, VST3 and ...
Drumwavy VST VST3 Audio Unit: Orchestral and Ethnic Percussion VST, VST3 and ...Drumwavy VST VST3 Audio Unit: Orchestral and Ethnic Percussion VST, VST3 and ...
Drumwavy VST VST3 Audio Unit: Orchestral and Ethnic Percussion VST, VST3 and ...Syntheway Virtual Musical Instruments
 
Ig2 task 1 work sheet - JS
Ig2 task 1 work sheet - JSIg2 task 1 work sheet - JS
Ig2 task 1 work sheet - JSJamieShepherd
 
A Science Project: Building a sound card based on the Covox Speech Thing
A Science Project: Building a sound card based on the Covox Speech ThingA Science Project: Building a sound card based on the Covox Speech Thing
A Science Project: Building a sound card based on the Covox Speech Thingyeokm1
 
RetroMagix Harpsichord VST VST3 Audio Unit EXS24 & KONTAKT: Based on Flemish,...
RetroMagix Harpsichord VST VST3 Audio Unit EXS24 & KONTAKT: Based on Flemish,...RetroMagix Harpsichord VST VST3 Audio Unit EXS24 & KONTAKT: Based on Flemish,...
RetroMagix Harpsichord VST VST3 Audio Unit EXS24 & KONTAKT: Based on Flemish,...Syntheway Virtual Musical Instruments
 
Anthony bowes IG2 task 1
Anthony bowes  IG2 task 1 Anthony bowes  IG2 task 1
Anthony bowes IG2 task 1 bowes96123
 
Let's Make Some Noise with Web Audio API
Let's Make Some Noise with Web Audio APILet's Make Some Noise with Web Audio API
Let's Make Some Noise with Web Audio APIGlobalLogic Ukraine
 
Ig2task1worksheetelliot 140511141816-phpapp02
Ig2task1worksheetelliot 140511141816-phpapp02Ig2task1worksheetelliot 140511141816-phpapp02
Ig2task1worksheetelliot 140511141816-phpapp02ElliotBlack
 
Saxophus: Virtual Soprano, Alto, Tenor and Baritone Saxophones VST VST3 Audio...
Saxophus: Virtual Soprano, Alto, Tenor and Baritone Saxophones VST VST3 Audio...Saxophus: Virtual Soprano, Alto, Tenor and Baritone Saxophones VST VST3 Audio...
Saxophus: Virtual Soprano, Alto, Tenor and Baritone Saxophones VST VST3 Audio...Syntheway Virtual Musical Instruments
 
Shaun warburton ig2 task 1 work sheet improved
Shaun warburton ig2 task 1 work sheet improvedShaun warburton ig2 task 1 work sheet improved
Shaun warburton ig2 task 1 work sheet improvedwarburton9191
 
Ry pyconjp2015 karaoke
Ry pyconjp2015 karaokeRy pyconjp2015 karaoke
Ry pyconjp2015 karaokeRenyuan Lyu
 
Sound recording glossary
Sound recording glossarySound recording glossary
Sound recording glossaryBen Atherton
 
IG2 Task 1 Work Sheet
IG2 Task 1 Work SheetIG2 Task 1 Work Sheet
IG2 Task 1 Work SheetNathan_West
 
OpenPipe at FOSDEM 2013
OpenPipe at FOSDEM 2013OpenPipe at FOSDEM 2013
OpenPipe at FOSDEM 2013xulioc
 
Deep dive into Android’s audio latency problem
Deep dive into Android’s audio latency problemDeep dive into Android’s audio latency problem
Deep dive into Android’s audio latency problemSirawat Pitaksarit
 

Similar to Music With Pharo (20)

Livecoding with impromptu
Livecoding with impromptuLivecoding with impromptu
Livecoding with impromptu
 
Nerd sniping myself into a rabbit hole... Streaming online audio to a Sonos s...
Nerd sniping myself into a rabbit hole... Streaming online audio to a Sonos s...Nerd sniping myself into a rabbit hole... Streaming online audio to a Sonos s...
Nerd sniping myself into a rabbit hole... Streaming online audio to a Sonos s...
 
Ig2 task 1 work sheet connor martin
Ig2 task 1 work sheet connor martinIg2 task 1 work sheet connor martin
Ig2 task 1 work sheet connor martin
 
Drumwavy VST VST3 Audio Unit: Orchestral and Ethnic Percussion VST, VST3 and ...
Drumwavy VST VST3 Audio Unit: Orchestral and Ethnic Percussion VST, VST3 and ...Drumwavy VST VST3 Audio Unit: Orchestral and Ethnic Percussion VST, VST3 and ...
Drumwavy VST VST3 Audio Unit: Orchestral and Ethnic Percussion VST, VST3 and ...
 
Ig2 task 1 work sheet - JS
Ig2 task 1 work sheet - JSIg2 task 1 work sheet - JS
Ig2 task 1 work sheet - JS
 
combined_document
combined_documentcombined_document
combined_document
 
A Science Project: Building a sound card based on the Covox Speech Thing
A Science Project: Building a sound card based on the Covox Speech ThingA Science Project: Building a sound card based on the Covox Speech Thing
A Science Project: Building a sound card based on the Covox Speech Thing
 
RetroMagix Harpsichord VST VST3 Audio Unit EXS24 & KONTAKT: Based on Flemish,...
RetroMagix Harpsichord VST VST3 Audio Unit EXS24 & KONTAKT: Based on Flemish,...RetroMagix Harpsichord VST VST3 Audio Unit EXS24 & KONTAKT: Based on Flemish,...
RetroMagix Harpsichord VST VST3 Audio Unit EXS24 & KONTAKT: Based on Flemish,...
 
Anthony bowes IG2 task 1
Anthony bowes  IG2 task 1 Anthony bowes  IG2 task 1
Anthony bowes IG2 task 1
 
Thingy editedd
Thingy editeddThingy editedd
Thingy editedd
 
Let's Make Some Noise with Web Audio API
Let's Make Some Noise with Web Audio APILet's Make Some Noise with Web Audio API
Let's Make Some Noise with Web Audio API
 
Ig2task1worksheetelliot 140511141816-phpapp02
Ig2task1worksheetelliot 140511141816-phpapp02Ig2task1worksheetelliot 140511141816-phpapp02
Ig2task1worksheetelliot 140511141816-phpapp02
 
Saxophus: Virtual Soprano, Alto, Tenor and Baritone Saxophones VST VST3 Audio...
Saxophus: Virtual Soprano, Alto, Tenor and Baritone Saxophones VST VST3 Audio...Saxophus: Virtual Soprano, Alto, Tenor and Baritone Saxophones VST VST3 Audio...
Saxophus: Virtual Soprano, Alto, Tenor and Baritone Saxophones VST VST3 Audio...
 
Shaun warburton ig2 task 1 work sheet improved
Shaun warburton ig2 task 1 work sheet improvedShaun warburton ig2 task 1 work sheet improved
Shaun warburton ig2 task 1 work sheet improved
 
Ry pyconjp2015 karaoke
Ry pyconjp2015 karaokeRy pyconjp2015 karaoke
Ry pyconjp2015 karaoke
 
Sound recording glossary
Sound recording glossarySound recording glossary
Sound recording glossary
 
Ig2 task 1 work sheet
Ig2 task 1 work sheetIg2 task 1 work sheet
Ig2 task 1 work sheet
 
IG2 Task 1 Work Sheet
IG2 Task 1 Work SheetIG2 Task 1 Work Sheet
IG2 Task 1 Work Sheet
 
OpenPipe at FOSDEM 2013
OpenPipe at FOSDEM 2013OpenPipe at FOSDEM 2013
OpenPipe at FOSDEM 2013
 
Deep dive into Android’s audio latency problem
Deep dive into Android’s audio latency problemDeep dive into Android’s audio latency problem
Deep dive into Android’s audio latency problem
 

More from ESUG

Workshop: Identifying concept inventories in agile programming
Workshop: Identifying concept inventories in agile programmingWorkshop: Identifying concept inventories in agile programming
Workshop: Identifying concept inventories in agile programmingESUG
 
Technical documentation support in Pharo
Technical documentation support in PharoTechnical documentation support in Pharo
Technical documentation support in PharoESUG
 
The Pharo Debugger and Debugging tools: Advances and Roadmap
The Pharo Debugger and Debugging tools: Advances and RoadmapThe Pharo Debugger and Debugging tools: Advances and Roadmap
The Pharo Debugger and Debugging tools: Advances and RoadmapESUG
 
Sequence: Pipeline modelling in Pharo
Sequence: Pipeline modelling in PharoSequence: Pipeline modelling in Pharo
Sequence: Pipeline modelling in PharoESUG
 
Migration process from monolithic to micro frontend architecture in mobile ap...
Migration process from monolithic to micro frontend architecture in mobile ap...Migration process from monolithic to micro frontend architecture in mobile ap...
Migration process from monolithic to micro frontend architecture in mobile ap...ESUG
 
Analyzing Dart Language with Pharo: Report and early results
Analyzing Dart Language with Pharo: Report and early resultsAnalyzing Dart Language with Pharo: Report and early results
Analyzing Dart Language with Pharo: Report and early resultsESUG
 
Transpiling Pharo Classes to JS ECMAScript 5 versus ECMAScript 6
Transpiling Pharo Classes to JS ECMAScript 5 versus ECMAScript 6Transpiling Pharo Classes to JS ECMAScript 5 versus ECMAScript 6
Transpiling Pharo Classes to JS ECMAScript 5 versus ECMAScript 6ESUG
 
A Unit Test Metamodel for Test Generation
A Unit Test Metamodel for Test GenerationA Unit Test Metamodel for Test Generation
A Unit Test Metamodel for Test GenerationESUG
 
Creating Unit Tests Using Genetic Programming
Creating Unit Tests Using Genetic ProgrammingCreating Unit Tests Using Genetic Programming
Creating Unit Tests Using Genetic ProgrammingESUG
 
Threaded-Execution and CPS Provide Smooth Switching Between Execution Modes
Threaded-Execution and CPS Provide Smooth Switching Between Execution ModesThreaded-Execution and CPS Provide Smooth Switching Between Execution Modes
Threaded-Execution and CPS Provide Smooth Switching Between Execution ModesESUG
 
Exploring GitHub Actions through EGAD: An Experience Report
Exploring GitHub Actions through EGAD: An Experience ReportExploring GitHub Actions through EGAD: An Experience Report
Exploring GitHub Actions through EGAD: An Experience ReportESUG
 
Pharo: a reflective language A first systematic analysis of reflective APIs
Pharo: a reflective language A first systematic analysis of reflective APIsPharo: a reflective language A first systematic analysis of reflective APIs
Pharo: a reflective language A first systematic analysis of reflective APIsESUG
 
Garbage Collector Tuning
Garbage Collector TuningGarbage Collector Tuning
Garbage Collector TuningESUG
 
Improving Performance Through Object Lifetime Profiling: the DataFrame Case
Improving Performance Through Object Lifetime Profiling: the DataFrame CaseImproving Performance Through Object Lifetime Profiling: the DataFrame Case
Improving Performance Through Object Lifetime Profiling: the DataFrame CaseESUG
 
Pharo DataFrame: Past, Present, and Future
Pharo DataFrame: Past, Present, and FuturePharo DataFrame: Past, Present, and Future
Pharo DataFrame: Past, Present, and FutureESUG
 
thisContext in the Debugger
thisContext in the DebuggerthisContext in the Debugger
thisContext in the DebuggerESUG
 
Websockets for Fencing Score
Websockets for Fencing ScoreWebsockets for Fencing Score
Websockets for Fencing ScoreESUG
 
ShowUs: PharoJS.org Develop in Pharo, Run on JavaScript
ShowUs: PharoJS.org Develop in Pharo, Run on JavaScriptShowUs: PharoJS.org Develop in Pharo, Run on JavaScript
ShowUs: PharoJS.org Develop in Pharo, Run on JavaScriptESUG
 
Advanced Object- Oriented Design Mooc
Advanced Object- Oriented Design MoocAdvanced Object- Oriented Design Mooc
Advanced Object- Oriented Design MoocESUG
 
A New Architecture Reconciling Refactorings and Transformations
A New Architecture Reconciling Refactorings and TransformationsA New Architecture Reconciling Refactorings and Transformations
A New Architecture Reconciling Refactorings and TransformationsESUG
 

More from ESUG (20)

Workshop: Identifying concept inventories in agile programming
Workshop: Identifying concept inventories in agile programmingWorkshop: Identifying concept inventories in agile programming
Workshop: Identifying concept inventories in agile programming
 
Technical documentation support in Pharo
Technical documentation support in PharoTechnical documentation support in Pharo
Technical documentation support in Pharo
 
The Pharo Debugger and Debugging tools: Advances and Roadmap
The Pharo Debugger and Debugging tools: Advances and RoadmapThe Pharo Debugger and Debugging tools: Advances and Roadmap
The Pharo Debugger and Debugging tools: Advances and Roadmap
 
Sequence: Pipeline modelling in Pharo
Sequence: Pipeline modelling in PharoSequence: Pipeline modelling in Pharo
Sequence: Pipeline modelling in Pharo
 
Migration process from monolithic to micro frontend architecture in mobile ap...
Migration process from monolithic to micro frontend architecture in mobile ap...Migration process from monolithic to micro frontend architecture in mobile ap...
Migration process from monolithic to micro frontend architecture in mobile ap...
 
Analyzing Dart Language with Pharo: Report and early results
Analyzing Dart Language with Pharo: Report and early resultsAnalyzing Dart Language with Pharo: Report and early results
Analyzing Dart Language with Pharo: Report and early results
 
Transpiling Pharo Classes to JS ECMAScript 5 versus ECMAScript 6
Transpiling Pharo Classes to JS ECMAScript 5 versus ECMAScript 6Transpiling Pharo Classes to JS ECMAScript 5 versus ECMAScript 6
Transpiling Pharo Classes to JS ECMAScript 5 versus ECMAScript 6
 
A Unit Test Metamodel for Test Generation
A Unit Test Metamodel for Test GenerationA Unit Test Metamodel for Test Generation
A Unit Test Metamodel for Test Generation
 
Creating Unit Tests Using Genetic Programming
Creating Unit Tests Using Genetic ProgrammingCreating Unit Tests Using Genetic Programming
Creating Unit Tests Using Genetic Programming
 
Threaded-Execution and CPS Provide Smooth Switching Between Execution Modes
Threaded-Execution and CPS Provide Smooth Switching Between Execution ModesThreaded-Execution and CPS Provide Smooth Switching Between Execution Modes
Threaded-Execution and CPS Provide Smooth Switching Between Execution Modes
 
Exploring GitHub Actions through EGAD: An Experience Report
Exploring GitHub Actions through EGAD: An Experience ReportExploring GitHub Actions through EGAD: An Experience Report
Exploring GitHub Actions through EGAD: An Experience Report
 
Pharo: a reflective language A first systematic analysis of reflective APIs
Pharo: a reflective language A first systematic analysis of reflective APIsPharo: a reflective language A first systematic analysis of reflective APIs
Pharo: a reflective language A first systematic analysis of reflective APIs
 
Garbage Collector Tuning
Garbage Collector TuningGarbage Collector Tuning
Garbage Collector Tuning
 
Improving Performance Through Object Lifetime Profiling: the DataFrame Case
Improving Performance Through Object Lifetime Profiling: the DataFrame CaseImproving Performance Through Object Lifetime Profiling: the DataFrame Case
Improving Performance Through Object Lifetime Profiling: the DataFrame Case
 
Pharo DataFrame: Past, Present, and Future
Pharo DataFrame: Past, Present, and FuturePharo DataFrame: Past, Present, and Future
Pharo DataFrame: Past, Present, and Future
 
thisContext in the Debugger
thisContext in the DebuggerthisContext in the Debugger
thisContext in the Debugger
 
Websockets for Fencing Score
Websockets for Fencing ScoreWebsockets for Fencing Score
Websockets for Fencing Score
 
ShowUs: PharoJS.org Develop in Pharo, Run on JavaScript
ShowUs: PharoJS.org Develop in Pharo, Run on JavaScriptShowUs: PharoJS.org Develop in Pharo, Run on JavaScript
ShowUs: PharoJS.org Develop in Pharo, Run on JavaScript
 
Advanced Object- Oriented Design Mooc
Advanced Object- Oriented Design MoocAdvanced Object- Oriented Design Mooc
Advanced Object- Oriented Design Mooc
 
A New Architecture Reconciling Refactorings and Transformations
A New Architecture Reconciling Refactorings and TransformationsA New Architecture Reconciling Refactorings and Transformations
A New Architecture Reconciling Refactorings and Transformations
 

Recently uploaded

WSO2CON 2024 - Unlocking the Identity: Embracing CIAM 2.0 for a Competitive A...
WSO2CON 2024 - Unlocking the Identity: Embracing CIAM 2.0 for a Competitive A...WSO2CON 2024 - Unlocking the Identity: Embracing CIAM 2.0 for a Competitive A...
WSO2CON 2024 - Unlocking the Identity: Embracing CIAM 2.0 for a Competitive A...WSO2
 
WSO2CON 2024 - Building a Digital Government in Uganda
WSO2CON 2024 - Building a Digital Government in UgandaWSO2CON 2024 - Building a Digital Government in Uganda
WSO2CON 2024 - Building a Digital Government in UgandaWSO2
 
WSO2Con2024 - Navigating the Digital Landscape: Transforming Healthcare with ...
WSO2Con2024 - Navigating the Digital Landscape: Transforming Healthcare with ...WSO2Con2024 - Navigating the Digital Landscape: Transforming Healthcare with ...
WSO2Con2024 - Navigating the Digital Landscape: Transforming Healthcare with ...WSO2
 
WSO2Con2024 - Hello Choreo Presentation - Kanchana
WSO2Con2024 - Hello Choreo Presentation - KanchanaWSO2Con2024 - Hello Choreo Presentation - Kanchana
WSO2Con2024 - Hello Choreo Presentation - KanchanaWSO2
 
WSO2CON 2024 - How CSI Piemonte Is Apifying the Public Administration
WSO2CON 2024 - How CSI Piemonte Is Apifying the Public AdministrationWSO2CON 2024 - How CSI Piemonte Is Apifying the Public Administration
WSO2CON 2024 - How CSI Piemonte Is Apifying the Public AdministrationWSO2
 
WSO2CON 2024 - How CSI Piemonte Is Apifying the Public Administration
WSO2CON 2024 - How CSI Piemonte Is Apifying the Public AdministrationWSO2CON 2024 - How CSI Piemonte Is Apifying the Public Administration
WSO2CON 2024 - How CSI Piemonte Is Apifying the Public AdministrationWSO2
 
WSO2CON 2024 Slides - Unlocking Value with AI
WSO2CON 2024 Slides - Unlocking Value with AIWSO2CON 2024 Slides - Unlocking Value with AI
WSO2CON 2024 Slides - Unlocking Value with AIWSO2
 
%in Soweto+277-882-255-28 abortion pills for sale in soweto
%in Soweto+277-882-255-28 abortion pills for sale in soweto%in Soweto+277-882-255-28 abortion pills for sale in soweto
%in Soweto+277-882-255-28 abortion pills for sale in sowetomasabamasaba
 
WSO2CON 2024 - Lessons from the Field: Legacy Platforms – It's Time to Let Go...
WSO2CON 2024 - Lessons from the Field: Legacy Platforms – It's Time to Let Go...WSO2CON 2024 - Lessons from the Field: Legacy Platforms – It's Time to Let Go...
WSO2CON 2024 - Lessons from the Field: Legacy Platforms – It's Time to Let Go...WSO2
 
WSO2CON2024 - Why Should You Consider Ballerina for Your Next Integration
WSO2CON2024 - Why Should You Consider Ballerina for Your Next IntegrationWSO2CON2024 - Why Should You Consider Ballerina for Your Next Integration
WSO2CON2024 - Why Should You Consider Ballerina for Your Next IntegrationWSO2
 
WSO2Con2024 - Organization Management: The Revolution in B2B CIAM
WSO2Con2024 - Organization Management: The Revolution in B2B CIAMWSO2Con2024 - Organization Management: The Revolution in B2B CIAM
WSO2Con2024 - Organization Management: The Revolution in B2B CIAMWSO2
 
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfonteinmasabamasaba
 
Architecture decision records - How not to get lost in the past
Architecture decision records - How not to get lost in the pastArchitecture decision records - How not to get lost in the past
Architecture decision records - How not to get lost in the pastPapp Krisztián
 
Announcing Codolex 2.0 from GDK Software
Announcing Codolex 2.0 from GDK SoftwareAnnouncing Codolex 2.0 from GDK Software
Announcing Codolex 2.0 from GDK SoftwareJim McKeeth
 
WSO2CON 2024 - How to Run a Security Program
WSO2CON 2024 - How to Run a Security ProgramWSO2CON 2024 - How to Run a Security Program
WSO2CON 2024 - How to Run a Security ProgramWSO2
 
Evolving Data Governance for the Real-time Streaming and AI Era
Evolving Data Governance for the Real-time Streaming and AI EraEvolving Data Governance for the Real-time Streaming and AI Era
Evolving Data Governance for the Real-time Streaming and AI Eraconfluent
 
WSO2CON 2024 - Building the API First Enterprise – Running an API Program, fr...
WSO2CON 2024 - Building the API First Enterprise – Running an API Program, fr...WSO2CON 2024 - Building the API First Enterprise – Running an API Program, fr...
WSO2CON 2024 - Building the API First Enterprise – Running an API Program, fr...WSO2
 
AzureNativeQumulo_HPC_Cloud_Native_Benchmarks.pdf
AzureNativeQumulo_HPC_Cloud_Native_Benchmarks.pdfAzureNativeQumulo_HPC_Cloud_Native_Benchmarks.pdf
AzureNativeQumulo_HPC_Cloud_Native_Benchmarks.pdfryanfarris8
 
WSO2CON 2024 - Software Engineering for Digital Businesses
WSO2CON 2024 - Software Engineering for Digital BusinessesWSO2CON 2024 - Software Engineering for Digital Businesses
WSO2CON 2024 - Software Engineering for Digital BusinessesWSO2
 
What Goes Wrong with Language Definitions and How to Improve the Situation
What Goes Wrong with Language Definitions and How to Improve the SituationWhat Goes Wrong with Language Definitions and How to Improve the Situation
What Goes Wrong with Language Definitions and How to Improve the SituationJuha-Pekka Tolvanen
 

Recently uploaded (20)

WSO2CON 2024 - Unlocking the Identity: Embracing CIAM 2.0 for a Competitive A...
WSO2CON 2024 - Unlocking the Identity: Embracing CIAM 2.0 for a Competitive A...WSO2CON 2024 - Unlocking the Identity: Embracing CIAM 2.0 for a Competitive A...
WSO2CON 2024 - Unlocking the Identity: Embracing CIAM 2.0 for a Competitive A...
 
WSO2CON 2024 - Building a Digital Government in Uganda
WSO2CON 2024 - Building a Digital Government in UgandaWSO2CON 2024 - Building a Digital Government in Uganda
WSO2CON 2024 - Building a Digital Government in Uganda
 
WSO2Con2024 - Navigating the Digital Landscape: Transforming Healthcare with ...
WSO2Con2024 - Navigating the Digital Landscape: Transforming Healthcare with ...WSO2Con2024 - Navigating the Digital Landscape: Transforming Healthcare with ...
WSO2Con2024 - Navigating the Digital Landscape: Transforming Healthcare with ...
 
WSO2Con2024 - Hello Choreo Presentation - Kanchana
WSO2Con2024 - Hello Choreo Presentation - KanchanaWSO2Con2024 - Hello Choreo Presentation - Kanchana
WSO2Con2024 - Hello Choreo Presentation - Kanchana
 
WSO2CON 2024 - How CSI Piemonte Is Apifying the Public Administration
WSO2CON 2024 - How CSI Piemonte Is Apifying the Public AdministrationWSO2CON 2024 - How CSI Piemonte Is Apifying the Public Administration
WSO2CON 2024 - How CSI Piemonte Is Apifying the Public Administration
 
WSO2CON 2024 - How CSI Piemonte Is Apifying the Public Administration
WSO2CON 2024 - How CSI Piemonte Is Apifying the Public AdministrationWSO2CON 2024 - How CSI Piemonte Is Apifying the Public Administration
WSO2CON 2024 - How CSI Piemonte Is Apifying the Public Administration
 
WSO2CON 2024 Slides - Unlocking Value with AI
WSO2CON 2024 Slides - Unlocking Value with AIWSO2CON 2024 Slides - Unlocking Value with AI
WSO2CON 2024 Slides - Unlocking Value with AI
 
%in Soweto+277-882-255-28 abortion pills for sale in soweto
%in Soweto+277-882-255-28 abortion pills for sale in soweto%in Soweto+277-882-255-28 abortion pills for sale in soweto
%in Soweto+277-882-255-28 abortion pills for sale in soweto
 
WSO2CON 2024 - Lessons from the Field: Legacy Platforms – It's Time to Let Go...
WSO2CON 2024 - Lessons from the Field: Legacy Platforms – It's Time to Let Go...WSO2CON 2024 - Lessons from the Field: Legacy Platforms – It's Time to Let Go...
WSO2CON 2024 - Lessons from the Field: Legacy Platforms – It's Time to Let Go...
 
WSO2CON2024 - Why Should You Consider Ballerina for Your Next Integration
WSO2CON2024 - Why Should You Consider Ballerina for Your Next IntegrationWSO2CON2024 - Why Should You Consider Ballerina for Your Next Integration
WSO2CON2024 - Why Should You Consider Ballerina for Your Next Integration
 
WSO2Con2024 - Organization Management: The Revolution in B2B CIAM
WSO2Con2024 - Organization Management: The Revolution in B2B CIAMWSO2Con2024 - Organization Management: The Revolution in B2B CIAM
WSO2Con2024 - Organization Management: The Revolution in B2B CIAM
 
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
 
Architecture decision records - How not to get lost in the past
Architecture decision records - How not to get lost in the pastArchitecture decision records - How not to get lost in the past
Architecture decision records - How not to get lost in the past
 
Announcing Codolex 2.0 from GDK Software
Announcing Codolex 2.0 from GDK SoftwareAnnouncing Codolex 2.0 from GDK Software
Announcing Codolex 2.0 from GDK Software
 
WSO2CON 2024 - How to Run a Security Program
WSO2CON 2024 - How to Run a Security ProgramWSO2CON 2024 - How to Run a Security Program
WSO2CON 2024 - How to Run a Security Program
 
Evolving Data Governance for the Real-time Streaming and AI Era
Evolving Data Governance for the Real-time Streaming and AI EraEvolving Data Governance for the Real-time Streaming and AI Era
Evolving Data Governance for the Real-time Streaming and AI Era
 
WSO2CON 2024 - Building the API First Enterprise – Running an API Program, fr...
WSO2CON 2024 - Building the API First Enterprise – Running an API Program, fr...WSO2CON 2024 - Building the API First Enterprise – Running an API Program, fr...
WSO2CON 2024 - Building the API First Enterprise – Running an API Program, fr...
 
AzureNativeQumulo_HPC_Cloud_Native_Benchmarks.pdf
AzureNativeQumulo_HPC_Cloud_Native_Benchmarks.pdfAzureNativeQumulo_HPC_Cloud_Native_Benchmarks.pdf
AzureNativeQumulo_HPC_Cloud_Native_Benchmarks.pdf
 
WSO2CON 2024 - Software Engineering for Digital Businesses
WSO2CON 2024 - Software Engineering for Digital BusinessesWSO2CON 2024 - Software Engineering for Digital Businesses
WSO2CON 2024 - Software Engineering for Digital Businesses
 
What Goes Wrong with Language Definitions and How to Improve the Situation
What Goes Wrong with Language Definitions and How to Improve the SituationWhat Goes Wrong with Language Definitions and How to Improve the Situation
What Goes Wrong with Language Definitions and How to Improve the Situation
 

Music With Pharo

  • 1. © Domenico Cipriani, 2023 MUSIC With PHARO
  • 2. © Domenico Cipriani, 2023 MUSIC with PHARO •Pharo as an OSC/MIDI performer/sequencer/controller. •Pharo as a language for live-coding/ programming -music-on-the- fl y. •Pharo does not generate any sound (for now). •Pharo as a client for a MIDI instrument (internal/external) or for an OSC audio server (i.e. SuperCollider, PureData, ChucK, Max/MSP, Kyma) OSC https://github.com/Ducasse/OSC Pharo-Sound https://github.com/pharo-contributions/pharo-sound MIDI connections implementations OSC implementation LiveCoding Package https://github.com/lucretiomsp/PharoLiveCoding Domain Speci fi c Dialect
  • 3. © Domenico Cipriani, 2023 MUSIC with PHARO Pharo-Sound https://github.com/pharo-contributions/pharo-sound MIDI connections implementations PortMidi C external cross-platform library implemented in Pharo using the Uni fi ed FFI package by Antoine Delaby and Santiago Bragagnolo Full MIDI functionalities in Pharo Connect to external MIDI hardware or to a virtual MIDI bus, IAC Driver on Mac or MIDI Yoke* on Windows (*not native) It is used by the LiveCoding Package for MIDI connections Transform Pharo into a MIDI sequencer Allows to create custom GUI MIDI controllers The MIDI (Musical Instrument Digital Interface) protocol, developed collaboratively by Dave Smith, Chet Wood, and Ikutaro Kakehashi in 1983, is a standardised communication protocol used in electronic music equipment. It facilitates the transmission of musical information like notes, control parameters, and timing data between di ff erent devices such as synthesizers, computers, and controllers.
  • 4. © Domenico Cipriani, 2023 MUSIC with PHARO Open Sound Control implementation for Pharo, Originally developed and license under MIT by Markus Gaelli and then Simon Holland. Now cleaned and maintained by S. Ducasse. Necessary dependency of the LiveCoding Package. Send and receive OSC messages via UDP OSC OpenSoundControl (OSC) is a data encoding for realtime message communication among applications and hardware. Developed by Matt Wright and Adrian Freed at CNMAT Highly accurate, lightweight, low latency, widespread OSC https://github.com/Ducasse/OSC OSC implementation
  • 5. © Domenico Cipriani, 2023 MUSIC with PHARO LiveCoding Package https://github.com/lucretiomsp/PharoLiveCoding Domain Speci fi c Dialect Play sounds from an audio server or MIDI instrument Create, transform and manipulate Rhythms Create, transform and manipulate melodies, chords and arpeggio Create custom OSC controllers Can also be used and expanded to be used (via OSC or MIDI) with software for visual arts such as Processing, Touch Designer, Hydra LiveCoding Package https://github.com/lucretiomsp/PharoLiveCoding Domain Speci fi c Dialect
  • 6. © Domenico Cipriani, 2023 MUSIC with PHARO Performance performer: aPerformer freq: aFloat transportStep: anInteger activeProcess: aProcess play stop mute: aKeyOrAnArrayOfKeys Dictionary uniqueInstance solo: aKey at: aKey put: aSequencer Performer play solo: aKey PerformerLocal play PerformerMIDI play PerformerKyma play PerformerSuperDirt play • The Performance class is a Singleton. • Performance is a subclass of Dictionary. • A Performer must be assigned to the Performance; the Performer selects the audio backend. • The play method starts the Performance, and increments the transportStep every freq seconds (0.125 s at 120 bpm).
  • 7. © Domenico Cipriani, 2023 MUSIC with PHARO Sequencer notes: anArray durations: anArray dirtMessage: aDictionary noteIndex: anInteger gates: aRhythmOrAnArray midiChannel: anInteger Sequencer SequencerMono SequencerPoly Object • A SequencerMono sends out a note at once every time there is a gate. • A SequencerPoly sends out chords • The contents of a Sequencer can have di ff erent size, i.e. lengths, for example: Sequencer new gates: 16 semiquavers; notes: #(32 48 51); duration: #(0.2 0.3 0.5 1 0.4 0.6). aSequencer to: #aKey = Performance uniqueInstance at: #aKey put: aSequencer
  • 8. © Domenico Cipriani, 2023 MUSIC with PHARO P E R F O R M A N C E SEQUENCER SEQUENCER SEQUENCER SEQUENCER SEQUENCER transportStep increments of 1 every Performance uniqueInstance freq (seconds) SEQUENCER gates notes durations dirtMessage
  • 9. © Domenico Cipriani, 2023 MUSIC with PHARO Performance, Sequencers, how does them work? • Sequencers are inspired by traditional hardware sequencers, where triggers (~noteOn) events are notated in Time Unit Box System (TUBS). p := Performance uniqueInstance. p performer: PerformerLocal new. p freq: 136 bpm. "change the performances speed" #( 1 0 0 0 1 1 0 0 1 0) asSeq notes: #(32 37 38) to: #bass. “create a Sequencer and assign it to the performance " p play. "start the performance". p stop. "stop the performance" Performance >>> play self performer play • Performance can be thought as a multitrack player for Sequencers. • Sequencer are fi lled with parameters. • A Performer must be assigned to the Performance. #( 1 0 0 0 1 0 0 0 1 0 1 0 1 0 0 0 ) asSeq TUBS Traditional LiveCoding Dialect
  • 10. © Domenico Cipriani, 2023 MUSIC with PHARO Quick MIDI connections PortMidi traceAllDevices. mout := MIDISender new. mout openWithDevice: 5. •Get a list of all the available devices, create a new instance of MIDISender, open the MIDISender on the selected device 16 downbeats midiCh: 9 to: #kick. 16 upbeats midiCh: 12 to: #hat. 16 rumba, 16 banda midiCh: 3 to: #tom. 16 semiquavers notes: #(36 48 56 51 62 74 32) midiCh: 1 to: #bass. •To play a MIDI performance, a MIDI channel must be speci fi ed for each sequencer sending the message midiCh: mout allNotesOff •If MIDI notes got stuck / keep playing!
  • 11. © Domenico Cipriani, 2023 MUSIC with PHARO How to create a Sequencer with the LiveCoding Dialect • By sending messages (named as a rhythm) to integers, you create a Sequencer with the size of the integer, for example: • By sending the hexBeat message to a string containing natural numbers and characters $A - $F, you create a Sequencer with the corresponding hexBeat (https://kunstmusik.github.io/learn-hex-beats/), for example: • 16 downbeats • 32 rumba • 4 breves • 8 semiquavers • '8888' hexBeat • '9090' hexBeat • '80802ACDE9347B' hexBeat • By sending the euclidean message to an array containing the onsets/triggers and the number of step,s you create a Sequencer with the corresponding euclidean rhythm (http://cgm.cs.mcgill.ca/~godfried/publications/ban ff .pdf), for example: • #(3 8) euclidean • #(5 16) euclidean • #(7 12) euclidean
  • 12. © Domenico Cipriani, 2023 MUSIC with PHARO • Iconicity • Economy • Polysemy Written code should resemble what we hear Type less! Principles Many ways to do the same thing 16 upbeats #(60 63 67) + 16 8 downbeats #(1 0 0 0 1 0 0 0) asSeq '88' hexBeat • “The only primary principle of every human action, including verbal communication, is the expenditure of the least amount of e ff ort to accomplish a task”. (George Zipf) “Iconicity is the relation of similarity between two aspects of a sign: its form and its meaning. An iconic sign is a sign that in some way resembles its meaning”.(Meir)
  • 13. © Domenico Cipriani, 2023 MUSIC with PHARO Chord/Scale/Arpeggios • 4 breves chords: 'c-minor d-minor e-minor13 e#-sus4'; to: #superpiano. • 16 semiquavers arpeggiate: 'f-minor7 d-minor13 g-sus2'; to: #superchip. •18 Scales from all around the world, sending the name of a scale to the Scale class returns an array with the intervals of the scale •47 types of chords, can be parsed into arrays of intervals sending the message chordsToArrays to a string containing the chords separated by a space in the form: root[+ # for sharp]-typeofchord • Scale sakura. • Scale fl amenco
  • 14. © Domenico Cipriani, 2023 MUSIC with PHARO Stochastic methods of the LiveCoding Dialect •Random trigs • 64 randomTrigs. • 128 randomTrigsWithProbability: 75 • 64 randomSamplesFromFolder: ’cpu’. •Random trigs and random samples from a folder • 64 randomNotesFrom: Scale gypsy octaves:2 • 128 quavers sound: 'superchip' •Random note from a scale spread over 2 octaves •Random samples from a SuperDirt sample folder
  • 15. © Domenico Cipriani, 2023 MUSIC with PHARO Transformative methods of the LiveCoding Dialect • Join sequencers (with comma): 16 downbeats , '000F' hexBeat, 16 randomTrigs. •Reverse sequencers '000F' hexBeat reverse. •Flip gates/rests #(5 12) euclidean fl ip. •O ff set sequencer (shift left with negative value, shift to right with positive value) 16 upbeats offset: 1. •Repeats elements 4 copiesOfEach: #(-12 -10 -9 -8). •“Transpose” elements #(-12 -10 -9 -8) + 2. ^ #(-12 -12 -12 -12 -10 -10 -10 -10 -9 -9 -9 -9 -8 -8 -8 -8) ^ #(-10 -8 -7 -6 )
  • 16. MUSIC with PHARO New! Performance uniqueInstance performer: PerformerSuperDirt new Now it is possible to use Pharo as a sequencer for the SuperDirt audio engine for SuperCollider • From Pharo we send OSCBundles with timestamps(NTP timestamps), and the SuperCollider audio server takes care of the scheduling of the messages. • OSCBundles are sent with a latency of 50 milliseconds (a little latency is require by the sc server for proper scheduling). • The Sequencers instance variable called dirtMessage is a Dictionary that contains associations keys->values that are send to SuperCollider into an OSC Bundle; a quick reference to the keys and values can be found here: https://tidalcycles.org/docs/reference/synthesizers https://tidalcycles.org/docs/reference/audio_e ff ects Pharo to SuperDirt • SuperCollider is an audio server, programming language, and IDE for sound synthesis and algorithmic composition. Originally released by James McCartney for real-time audio synthesis and logarithmic composition. • The language combines the object-oriented structure of Smalltalk and features from functional programming language with a C-like syntax. • SuperDirt is the SuperCollider implementation of the Dirt sampler, originally designed for the TidalCycles environment. It is a framework for playing samples and synths, controllable over the Open Sound Control protocol, and locally from the SC language. SuperDirt is also used by Sardine, a live coding environment for Python 3.10+ created by Raphaël Forment.
  • 17. © Domenico Cipriani, 2023 MUSIC with PHARO New! • 'cp ~ sd ht lt ~ ~ mt' forDirt to: #groove. • 16 downbeats sound: 'bd:3' ; to: #kick. • #(5 12) euclidean fl ip to: #sd. • 16 bomba sound: 'mt'; dirtNotes: #(3 2 9 8); to: #toms; add: 'squiz'->#(2 3 7). • 64 randomSamplesFromFolder: ’cpu’. • #(5 12) euclidean randomSamplesFromFolder: ‘mt’. • 4 breves sound: 'supersaw' dirtNotes: #(0 1 2 3); gain: 0.7; to: #piano . • ‘hoover' once. • ‘hoover' onceAtSpeed: 2. Syntax for SuperDirt
  • 18. © Domenico Cipriani, 2023 MUSIC with PHARO New! The dirtMessage • The instanceVariable of the Sequencers called dirtMessage contains an infrastructure for the messages sent in the OSCBundle to the SuperDirt audio engine, for example: 's'->#('clap') 'n'->#(0 3 2 1 5) 'squiz'->#(2 1 0.9) 16 tresillo sound: 'clap'; dirtNotes: #(0 3 2 1 5); squiz:#(2 1 0.9) Sequencer >>> playFullDirtEventAt: anIndex "sends a mesaage to SuperDirt with all the desired OSC arguments and values" | message dur stepDuration| stepDuration := Performance uniqueInstance freq. message := OrderedCollection new. message add: '/dirt/play'. dur := self durations asDirtArray wrap: anIndex . message add: 'delta'; add: stepDuration * dur. dirtMessage keysAndValuesDo: [ :key :value | message add: key; add: (value asDirtArray wrap: anIndex ) ]. (OSCBundle for: { OSCMessage for: message } ) sendToAddressString: '127.0.0.1' port: 57120. Array >> wrap: anInteger [ “inspired by Cmajor language wrap<int> always wrap the index of the array to the array size" | result | result := self at: anInteger - 1 % self size + 1. ^ result OSCMessage address
  • 19. © Domenico Cipriani, 2023 MUSIC with PHARO •More and more test! •Better and exhaustive documentation and tutorials! •A custom Playground. •More GUI elements! •Cyclical patterns as in Tidal Cycles ( https://tidalcycles.org) + a parser for Tidal Cycles’ mini notation. •In the web browser with PharoJS? •Generate sound and create instruments and e ff ects inside Pharo embedding the FAUST compiler (https://faustcloud.grame.fr) AND WHAT ABOUT THE FUTURE?
  • 20. © Domenico Cipriani, 2023 mercí