Classical Piano Soundpack Documentation

What is the Classical Piano Soundpack?

The Classical Piano Soundpack is an script that lets instrument makers play any piano note sound through the use of linked messages. Use this script or API with any object to easily create piano instruments that can play all 88 keys.

Contents

Quick Start

Once you have the Classical Piano Soundpack, start by rezzing a new object on the ground, which will serve as the base for your piano instrument. Look at the notecard in the same folder as the Classical Piano Soundpack script for crucial setup instructions. After completing the steps in the notecard, create a new script in the object and name it "Piano Driver" or any other name you prefer.

cube on the ground

Next, open the Piano Driver script and start adding LSL code that can interact with the Piano Soundpack API. Here's an example script that plays a C major chord when you click on the object.

Play C Major Script

                // C major on click
// Used with (MIRAI) Classical Piano Soundpack
// Copyright 2024, tototol

default
{
    touch_start(integer total_number)
    {
        llMessageLinked(LINK_SET, 0, "60,1, 64,1 67,1", "mirai-classical-piano");
    }
}
            

Playing Different Notes

Great job! You've successfully set up your piano script. Now you can experiment with different notes and create various chords. To play a C minor chord instead of a C major chord, you’ll need to modify the script slightly. Simply change one of the note numbers to transform the sound.

Play C Minor Script

                
// C minor on click
// Used with (MIRAI) Classical Piano Soundpack
// Copyright 2024, tototol

default
{
    touch_start(integer total_number)
    {
        llMessageLinked(LINK_SET, 0, "60,1, 63,1 67,1", "mirai-classical-piano");
    }
}
                

Understanding API Calls

A piano has 88 keys, and each key corresponds to a unique Classical Piano note number. The Classical Piano specification allows for 128 different note numbers, ranging from 21 to 108. Here's how these numbers relate to the piano:

Classical Piano Note Range for a Standard Piano

  • Lowest Note (A0): Classical Piano note number 21
  • Highest Note (C8): Classical Piano note number 108

Breakdown of Classical Piano Note Numbers

Octave Note Names Classical Piano Numbers
Sub-Contra A0, A♯0/B♭0, B0 21, 22, 23
Contra C1, C♯1/D♭1, D1, D♯1/E♭1, E1, F1, F♯1/G♭1, G1, G♯1/A♭1, A1, A♯1/B♭1, B1 24-35
Great C2, C♯2/D♭2, D2, D♯2/E♭2, E2, F2, F♯2/G♭2, G2, G♯2/A♭2, A2, A♯2/B♭2, B2 36-47
Small C3, C♯3/D♭3, D3, D♯3/E♭3, E3, F3, F♯3/G♭3, G3, G♯3/A♭3, A3, A♯3/B♭3, B3 48-59
1-line C4, C♯4/D♭4, D4, D♯4/E♭4, E4, F4, F♯4/G♭4, G4, G♯4/A♭4, A4, A♯4/B♭4, B4 60-71
2-line C5, C♯5/D♭5, D5, D♯5/E♭5, E5, F5, F♯5/G♭5, G5, G♯5/A♭5, A5, A♯5/B♭5, B5 72-83
3-line C6, C♯6/D♭6, D6, D♯6/E♭6, E6, F6, F♯6/G♭6, G6, G♯6/A♭6, A6, A♯6/B♭6, B6 84-95
4-line C7, C♯7/D♭7, D7, D♯7/E♭7, E7, F7, F♯7/G♭7, G7, G♯7/A♭7, A7, A♯7/B♭7, B7 96-107
5-line C8 108

Example of Classical Piano Note Numbers for Common Piano Notes

  • Middle C (C4): Classical Piano note number 60
  • A4 (440 Hz, concert pitch): Classical Piano note number 69
  • Highest C (C8): Classical Piano note number 108

Using Classical Piano Note Numbers in a Script

When working with Classical Piano in scripts, these numbers are used to represent the notes that are played. For example, in the syntax "60,1, 63,1, 67,1", the numbers 60, 63, and 67 correspond to specific notes:

  • 60: C4 (Middle C)
  • 63: E♭4
  • 67: G4

Volume Levels

The second number in each pair represents the volume, ranging from 0 to 1:

  • 0: Silent
  • 0.5: Half Volume
  • 1: Full Volume

How to Play Different Chords

To play different chords or notes, you adjust the Classical Piano note numbers in your script. Here are a few examples:

C Minor Chord

  • Notes: C4, E♭4, G4
  • Classical Piano: "60,1, 63,1, 67,1"

C Major Chord

  • Notes: C4, E4, G4
  • Classical Piano: "60,1, 64,1, 67,1"

G Major Chord

  • Notes: G3, B3, D4
  • Classical Piano: "55,1, 59,1, 62,1"

C Minor Chord (Varying Volumes)

  • Notes: C4, E♭4, G4
  • Classical Piano: "60,0.8, 63,0.6, 67,0.9"

Conclusion

Understanding the full range of Classical Piano note numbers allows you to create a wide variety of musical compositions using the piano's 88 keys. Whether you're composing simple melodies or complex harmonies, the Classical Piano system provides precise control over pitch and volume, making it an essential tool for digital music production.

Getting Creative with Instruments

In this guide, we'll create a synth pad with four buttons in the Second Life virtual world, each playing a different chord using the Classical Piano soundpack. When you press a button, it sends a message to trigger the corresponding chord. Feel free to start this tutorial from scratch or get the finished product on the MP for free.

Step 1: Build the Synth Pad Interface

In Second Life, you can create a simple interface with four buttons arranged as a synth pad. Each button represents a different chord.

  1. Create four cube prims in your Second Life environment.
  2. Arrange them in a grid or row to form the synth pad interface.
  3. Name each button with the corresponding chord.
synth arrangement

Step 2: Script the Buttons

Each button needs a script to send a message when clicked, triggering the corresponding chord. Below are the scripts for each button.

Button 1 Script (C Major Chord)

                // Button 1 Script (C Major Chord)
default {
    touch_start(integer total_number) {
        // Send message to play C Major chord
        llMessageLinked(LINK_SET, 0, "60,1 64,0.8 67,0.9", "mirai-classical-piano");
    }
}
            

Button 2 Script (G Major Chord)

                // Button 2 Script (G Major Chord)
default {
    touch_start(integer total_number) {
        // Send message to play G Major chord
        llMessageLinked(LINK_SET, 0, "67,1 71,0.8 74,0.9", "mirai-classical-piano");
    }
}
            

Button 3 Script (A Minor Chord)

                // Button 3 Script (A Minor Chord)
default {
    touch_start(integer total_number) {
        // Send message to play A Minor chord
        llMessageLinked(LINK_SET, 0, "69,1 72,0.8 76,0.9", "mirai-classical-piano");
    }
}
            

Button 4 Script (F Major Chord)

                // Button 4 Script (F Major Chord)
default {
    touch_start(integer total_number) {
        // Send message to play F Major chord
        llMessageLinked(LINK_SET, 0, "65,1 69,0.8 72,0.9", "mirai-classical-piano");
    }
}
            

Step 3: Putting Everything Together

  1. Link the Four Cubes: Link the four cubes you created in Second Life into a single object.
    • Select all four cubes by holding the Shift key and clicking each cube.
    • Once selected, right-click on one of the cubes and choose Link from the menu. This will combine them into a single object, with the last cube selected as the root prim.
  2. Navigate to Your Inventory: Open your inventory and locate the folder containing the Classical Piano Soundpack.
  3. Follow the Instructions: Inside the folder, look for the notecard that contains activation instructions. Follow these instructions carefully to ensure proper setup and activation of the soundpack.
  4. Add the Classical Piano Soundpack Script: Drag the Classical Piano Soundpack script from the inventory folder into the linked object's root prim.
    • Right-click the linked object and select Edit to open its contents tab.
    • Make sure the script is correctly placed in the contents of the root prim to enable the sound functionality.
linked cubes with script in inventory

You’re all set to test it out! Click on each button on your synth pad to hear the different chords being played. Try pressing the buttons below to play the Japanese school bell:

School Bell Sequence

// School bell by tototol

Press the chords in sequence: 3 4 2 1 1 2 3 4
        

Conclusion

This setup provides a basic synth pad in Second Life, allowing you to explore creativity and musical expression. Feel free to expand on this concept by adding more buttons, experimenting with different chords, or integrating additional effects to create a more dynamic and interactive musical experience!

© 2025 TOTO Lab.

Tutorial text and media are licensed under CC BY-NC 4.0, and code examples are CC0 by default unless noted otherwise in comments. You may share or adapt for non-commercial use with attribution.

Second Life and SL are trademarks of Linden Research, Inc. TOTO Lab and MIRAI TECH are not affiliated with or sponsored by Linden Research.