All posts by joowonpark

Game Controller Comparison For SuperCollider

SuperCollider’s HID class lets users connect many types of game controllers without additional software installations. While establishing a connection between a human input device and SuperCollider is easy, decoding the mapping system requires time and effort. A user needs to press a button in the controller, monitor the ID number assigned to the specific button, and then document the result for further use. The good news is that once a user figures out and shares the mapping structure of a device, there is no need to repeat the discovery procedure until the next major OS update.

The chart below shows the control surface-to-SuperCollider mapping of four game controllers: DualShock 4 for PlayStation 4, DualSense for PlayStation 5, Logitech FS310, and Xbox Wireless Controller. It lists elements (ID numbers corresponding to a specific control surface in a device) and their value range for HIDFunc.element command. With the element numbers and ranges below, one can map the incoming data from a controller to various parameters available in SuperCollider.

Element Numbers and Range of Game Controllers

Sony DualShock (PS4)Sony DualSense (PS5)Logitech FA310 Mode DMicrosoft Xbox
BluetoothBluetoothUSBBluetooth
ID (1356, 2508)ID (1356, 3302)ID (1133,49686)ID (1118, 765)
Control Surface [sony | xbox]Element#, (value)Element#, (value)Element#, (value)Element#, (value)
Square | X0, (0 or 1)0, (0 or 1)0, (0 or 1)13, (0 or 1)
X | A1, (0 or 1)1, (0 or 1)1, (0 or 1)10, (0 or 1)
O | B2, (0 or 1)2, (0 or 1)2, (0 or 1)11, (0 or 1)
Triangle | Y3, (0 or 1)3, (0 or 1)3, (0 or 1)14, (0 or 1)
L1 | LB4, (0 or 1)4, (0 or 1)4, (0 or 1)16, (0 or 1)
R1 | RB5, (0 or 1)5, (0 or 1)5, (0 or 1)17, (0 or 1)
L2 | LT button6, (0 or 1)6, (0 or 1)6, (0 or 1)not found yet
R2 | RT button7, (0 or 1)7, (0 or 1)7, (0 or 1)not found yet
Share | Back8, (0 or 1)8, (0 or 1)8, (0 or 1)25, (0 or 1)
Options | Start9, (0 or 1)9, (0 or 1)9, (0 or 1)21, (0 or 1)
L3 | LSB button10, (0 or 1)10, (0 or 1)10, (0 or 1)not found yet
R3 | RSB button11, (0 or 1)11, (0 or 1)11, (0 or 1)not found yet
Logo12, (0 or 1)12, (0 or 1)not found yetnot found yet
Trackpad button13, (0 or 1)13, (0 or 1)N/AN/A
L3 | LSB x-axis14, (0 to 255)14, (0 to 255)13, (0 to 255)0, (0-65535)
L3 | LSB y-axis15, (0 to 255)15, (0 to 255)14, (0 to 255)1, (0-65535)
R3 | RSB x-axis16, (0 to 255)16, (0 to 255)15, (0 to 255)2, (0-65535)
R3 | RSB y-axis17, (0 to 255)17, (0 to 255)16, (0 to 255)3, (0-65535)
L2 | LT continuous19, (0 to 255)19, (0 to 255)not found yet26, (0-1023)
R2 | RT continuous20, (0 to 255)20, (0 to 255)not found yet27, (0-1023)
up18, (0)18, (0)17, (0)28, (1)
up+right18, (1)18, (1)17, (1)28, (2)
right18, (2)18, (2)17, (2)28, (3)
right+down18, (3)18, (3)17, (3)28, (4)
down18, (4)18, (4)17, (4)28, (5)
down+left18, (5)18, (5)17, (5)28, (6)
left18, (6)18, (6)17, (6)28, (7)
left+up18, (7)18, (7)17, (7)28, (8)
release18, (8)18, (8)17, (8)28, (0)

Link to Google Sheets version

Analysis of Element Numbers and Range

The number of available control surfaces, as well as their ranges, varies between the brands. However, all game controllers have three types of input methods. 

  • Button: sends 1 when pressed and 0 when released.
  • Directional Pad: assigns eight integers for eight directions and one integer for the release/unpressed state. The release state is mapped to value 8 in the Sony and Logitech controllers, while it is assigned to 0 in the Xbox controller.
  • Continuous Control: sends a range of numbers like a slider or a knob in a MIDI controller. All but the Xbox controller sends data ranging from 0-255. The Xbox controller has two types of ranges (0-65535 and 0-1023).

More expensive controllers have more features, such as motion sensors and microphone input, but the HID class does not detect them. The number of game controller features available for HID seems to depend on the hosting OS’s version. In 2018, HID received DualShock’s motion sensor and trackpad data when connected to a Macintosh with a USB cable (source). After a few OSX updates, I could not replicate the result in 2025. It is possible that additional input methods could be detected if an external app or extension is installed. I did not test the possibility as my goal is to avoid additional technical steps. 

Demo SuperCollider Patches

Readers can test, study, and modify the controller mapping structure with the .scd files provided in the link above. All four files, one for each model of the controller, have the same parts: 1. Controller initialization 2. Connection tester 3. Controller-to-sound example. The coding style is based on the example section of the HIDFunc manual.   

The Controller initialization section consists of arrays and functions that connect and monitor signals from the game controller. The most important commands in this section are HID.findAvailable, HID.open, and HIDFunc.element. These commands detect the available devices, connect the specific device with the device’s unique ID number, and determine what SuperCollider should do when a control surface is triggered. The rest are functions built to use those three commands efficiently. The users must evaluate the codes inside the first parenthesis labeled //1. Controller Initializations to make the second section of the codes work.

After the initialization, evaluate the codes inside the second parenthesis labeled //2. Test the Controller. It is important to evaluate one line of code at a time for better testing. When a ~whichsurface(element #) function is evaluated, an array containing an element number, control surface name, and value will appear on the post screen. For example, after establishing a connection with a DualSene controller using HID_DualSense_Demo.scd, evaluate the line ~whichsurface.(3). It will activate the triangle button of the controller. Pressing the triangle button will post [ 0, Triangle, 1 ], and releasing the button will post [ 3, Trianle, 0 ] on the Post window. Press command+period or select Menu-> Language-> Stop to stop receiving the messages from the controller. 

Note that arguments (|…args|) inside the HIDFunc element receive an array of numbers from the connected controller. The first number in the array, args[0], receives normalized data ranging from 0.0 to 1.0 as a float. The second number, args[1], receives raw data ranging from 0 to any number as an integer. The demo files use the integer, but users can use the float argument interchangeably. 

The last group of commands under //3. Audio Example maps the controller to a SynthDef’s parameter. The codes inside HIDFunc.element maps a button to change the volume of white noise and a continuous controller to change the panning. Modify the numbers inside the brackets [ ] at the end of the HIDFunc.element( ) to map different buttons and continuous controllers. Note that the method .linlin is used to map the range of 0 to 255 or 65535 to -1.0 to 1.0 in this example code.  

Summary and Application 

I share the mapping of four controllers so that others do not have to repeat the procedure and move faster to the creative phase. My previous sharing of the game controller mapping was in 2018, and it is available as a published document in The Journal Emille. The article is now outdated and only applicable to DualShock.  The current findings discussed here also have limitations: the mappings were tested in SuperCollider 13.0 running in Mac OSX Sequoia only. I was not successful in connecting the controllers to SuperCollider on Windows. I also did not figure out the mappings for Max or other programs.

Once connected via HID in SuperCollider, a game controller becomes an expressive instrument for laptop performance despite the above limitations. Performers can incorporate years, if not decades, of gaming muscle memories to play music. For demonstration, the links below are my two compositions for a game controller quartet. Interested music technologists can download SuperCollider patches and scores from the links below to play the music using the game controllers analyzed in this article. Previous experience in SuperCollider is not needed to play the piece.

PS Quartet No. 1

PS Quartet No. 2

Electronic Ensemble Repertoire – Classics

Here are three pieces I have presented regularly with the Electronic Music Ensemble of Wayne State (EMEWS). The repertoire’s codes, scores, or DAW project files are available online and are simple to set up and execute in terms of technology.  An ensemble director may make the piece presentable in one or two rehearsals with no extra cost for preparation or concert. 

John Cage, Four6

Four6 is an open-instrumentation piece suited for four electronic musicians. The performer is asked to prepare twelve different sounds before the performance. Then, they play the sounds according to the timeline dictated in the score. There are no tech specifications (any instrument is acceptable), and performers do not need to know how to improvise or read a traditional notation or improvise. 

I learned to play this at a concert organized by the fidget in 2012. Since then, the resulting sound of the quartet has been delightful to both the audience and the performer. In EMEWS concerts, the four parts were sometimes doubled to accommodate a large ensemble. The performers changed their twelve sounds for each practice and performance to keep surprising the other performers. 

I don’t have a link to the score, but they are easy to purchase. A nearby contemporary music performer friend probably has a copy. 

Alvin Lucier, Vespers

Vespers turns the acoustic space into an interesting instrument. I lead EMEWS to play this piece in the first weeks of the semester so the performers learn the musical application of space, resonance, and movement. The instruction asks the performer to walk around a dark room with a device that makes clicking sounds. The performer’s task is to find and share a location that makes the clicking sound interesting. In short, the performers become an organism with echo-location capacity. Any number of performers can play together.

The original instruction asks the performer to use a Sondol, but I don’t know what that is. So, I made a SuperCollider patch that makes clicks with controllable rates and duration. I added a feature to change the background color of the computer screen for an extra visual effect. I also thought a more directed performance might benefit the performers with little experience in experimental music, so I arranged a version with additional guidelines. The resulting scores and media are found here https://joowonpark.net/vespers/ 

Terry Riley, In C

Electronic ensembles can jump on the bandwagon by performing In C, one of contemporary music’s most popular ensemble pieces. For the electronic ensemble performers, I made a Logic patch that uses loop functions. Performers of any notation-reading level can play In C by clicking a loop at a desired pace. 

Pre-programmed melody and rhythm, stored as loops, let the performers contribute different musical aspects. I ask my ensemble members to experiment with timbre. The performers can double the track with a different patch, change the filter settings, add effects, instrument settings, etc. They are to explore the uniqueness of electronic instruments – what can an electronic instrument do that others cannot? 

Visit  https://joowonpark.net/logicinc/ for detailed instructions. I am positive that a similar loop setup is possible on Ableton Live and other platforms. 

Four Hit Combo (2024)

In Four Hit Combo, each laptop ensemble member uses four audio files to create twenty-six flavors. Musical patterns arise from repetitions (loops), and different combinations mark forms in music. The laptop ensemble members prepare their own samples before the performance, and they control loop start points and duration according to the score and the conductor’s cue. Because there are no specific audio files attached to the piece, each performance could give a unique sonic experience.

Instrument Needed

  1. Laptop: each performer needs a computer with SuperCollider installed
  2. Amp: connect the laptop to a sound reinforcement system. If the performance space is small, it is possible to use the laptop’s built-in speaker.

Pre-Performance Preparation

  1. Determine a conductor and at least three performers. If there are more than three performers, parts can be doubled
  2. Each performer prepares three audio files (wav, aif, or mp3). The first file should contain a voice. The second file should contain a pitched instrument sound. The third file should contain a percussion sound. All files should not be too short (less than a second) or too long (more than a minute). The [voice], [instrument], and [percussion] files should be different for all performers.
  3. While the voice, instrument, and percussion files are different for all performers, they should share one common sound file. This file will be used in the [finale].  
  4. The conductor prepares one audio about 10-30 seconds long. It could be any sound with noticeable changes. For example, a musical passage would work well, while an unchanged white noise would not. 
  5. Download FourHitCombo_Score.pdf, FourHitCombo_Performer.scd, and FourHitCombo_Conductor.scd from www.joowonpark.net/fourhitcombo
  6. Open the .scd files in SuperCollider. Follow the instructions on the.scd file to load the GUI screen.

Score Interpretation

  1. Proceed to the next measure only at the conductor’s cue. The conductor should give a cue to move on to the next measure every 10-20 seconds.
  2. In [voice], [instrument], [percussion], and [finale] rectangle, the performers drag-and-drop the audio file accordingly.
  3. In [random] square, performers press the random button in the GUI.
  4. In the square with a dot, quickly move the cursor in the 2D slider to the notated location.
  5. In the square with a dot and arrow, slowly move the cursor from the beginning point to the end point of the arrow. It is OK to finish moving the cursor before the conductor’s cue.
  6. In a measure with no symbol, leave the sound as is. Do not silence the sound.
  7. In measure 27, all performers freely improvise. Use any sounds except the commonly shared sound reserved for [finale]. 

Ambient in D Flat

Ambient in D Flat is a collection of short pieces for melodica and algorithmically generated computer sound. They all have the note Db as an essential part. Feel free to pick and choose which piece to perform or present. The last one in the collection, Fifth (for A Folk Song), is not an original composition- the performer is free to choose any folk song and play it in Gb major along with the computer part.

Setup

  • Download and install SuperCollider https://supercollider.github.io/downloads.html 
  • Download a zip file containing AmbientInDb_Mac.scd and AmbientInDb_PC.scd from https://joowonpark.net/ambientdb 
  • Open one of the downloaded SuperCollider files in SuperCollider. One is for OSX, and the other is for Windows.
  • In the SuperCollider menu, select Language-> Evaluate File. A window with performance instructions will appear.
  • Follow the instructions on the screen. Use the keyboard’s space bar and number keys to navigate. 

Performance

  • The middle C in the notation is the very first (the lowest) C in a melodica.
  • All pieces are in rubato. 
  • Feel free to improvise and elaborate on the written part.
  • Due to its algorithmic nature, the computer part does not have a set duration. It is OK if the performer finishes the melodica part earlier or later than the computer part.

Large Intestine 2013 vs 2024 – Brief Analysis

I am at the age where I can make a “How It Started vs. How It’s Going” analysis of my music. Comparing performance practice change over a decade or so is valuable for my growth, especially when the piece involves improvisation and no score. I can see where I came from, where I am now, and where I should go next. Large Intestine for no-input mixer and computer premiered in 2013, and I still present it in concerts. Watching the August 2013 version and the recent June 2024 version in sequence gives me a chance to contemplate my electronic performance practice. Did the technology and style change over 11 years? 

Technology

I took the “if it ain’t broke, don’t fix it” approach for Large Intestine in terms of the hardware and the software. The SuperCollider patch I coded 11 years ago is almost identical to the 2024 version. There were maintenance updates, such as replacing a deprecated UGen with a current one, but the signal-processing algorithm is untouched.  The hardware signal flow is also unchanged, although I upgraded the mixer for increased possibility and flexibility. 

I perform the piece by changing the mixer settings and SuperCollider patch. The SuperCollider patch consists of eight effect processors, and I turn on and off those effects in different combinations. It is much like playing a guitar with a pedal board. Over the past 11 years, I have bought a “new guitar” but am using the “same pedal.” The sonic possibilities remain the same, but how I play the instrument, the style in other words, has changed.  

Download and run the SuerColider patch for Large Intestine as a reference. You can test it using a mic or any other instrument.

Style

I observed the following differences in the 2013 and 2024 versions of Large Intestine

20132024
Mostly slow and gradual parameter changes Mostly fast and abrupt parameter changes
I discover things on stageI present previously experienced sounds
The mixer supports computer soundsThe computer supports mixer sounds
Long duration (10+ minutes)Short duration (less than 8 minutes)

When I was a no-input beginner, I could not make quick transitions and variations. In the 2013 version, I treated the mixer as one of many sound sources that could pass through signal processors. Like its umbrella project, 100 Strange Sounds, Large Intestine featured my SuperCollider capacity. The 2024 version shows that I reduced the dependency on the computer part. I also learned to say more within less time.

Gained confidence also changed the performance goal. I make a one-sentence goal when I am improvising solo. My goal for Large Intestine used to be “Let me figure out what no-input mixer can do on stage,” as it delighted me to discover the mixer’s unique sound and its augmentation by the computer. 11 years later, there are much less delightful discoveries in the piece. But I can now expect the sound I can create. The current  motto is, “Let me show you my favorite no-input mixer moments I learned previously on stage.” 

Evaluation

I am my work’s biggest supporter and critic, but that does not help my career development. The audience ultimately decides the longevity of the work. Large Intestine was fortunate to be liked by the audience on many occasions. It received some honors, such as being included in the SEAMUS CD series (2015), a peer-reviewed annual album released by the Society for Electroacoustic Music in the United States. There were multiple invitations to perform at different venues, and it became an integral part of my solo performance practice. The positive feedback from presentations motivated me to delve further into the no-input mixer world. I composed the following pieces based on the learnings from Large Intestine.

There are also clear limits to Large Intestine and my solo electroacoustic improvisation. I don’t expect other performers to play Large Intestine as it lacks score or instruction. The experience and joy I had with the piece are not transferable to other performers. This bothered me. I tackled this issue by teaching others how to play no-input mixers. I currently enjoy organizing no-input mixer workshops and no-input ensemble sessions. The mixer is a great introductory instrument for electronic music performance.