Skip to content

Instantly share code, notes, and snippets.

@atomgomba
Last active August 28, 2024 17:40
Show Gist options
  • Save atomgomba/07dcd145423a40fa891bd09908582dde to your computer and use it in GitHub Desktop.
Save atomgomba/07dcd145423a40fa891bd09908582dde to your computer and use it in GitHub Desktop.
Airline dings based on ARINC 715-3 standard
SinOsc osc => Gain g => ADSR e => dac => WvOut w => blackhole;
.5 => g.gain;
("dings.wav", IO.INT24) => w.wavFilename;
// Note frequencies from ARINC 715-3, section 3.4
// https://aviation.stackexchange.com/a/32459/82793
587 => int highNote;
494 => int lowNote;
// Envelope settings
100::ms => dur press;
30::ms => e.attackTime;
850::ms => e.decayTime;
0.1 => e.sustainLevel;
850::ms => e.releaseTime;
// Timing settings
10::ms => dur toneDelay;
450::ms => dur repeatDelay;
e.attackTime() => now;
//playPassengerCall();
playAttendantCall();
//playAttendantEmergencyCall();
//playSeatbeltSign();
//playAll();
e.attackTime() => now;
fun void ding(int note) {
note => osc.freq;
e.keyOn();
press => now;
e.keyOff();
e.releaseTime() => now;
}
fun void highDing() {
ding(highNote);
}
fun void lowDing() {
ding(lowNote);
}
fun void playPassengerCall() {
highDing();
}
fun void playAttendantCall() {
highDing();
toneDelay => now;
lowDing();
}
fun void playAttendantEmergencyCall() {
0 => int i;
repeat (3) {
if (0 < i) {
repeatDelay => now;
}
playAttendantCall();
++i;
}
}
fun void playSmokingSign() {
lowDing();
}
fun void playSeatbeltSign() {
playSmokingSign();
}
fun void playAll() {
repeatDelay * 4 => dur intermezzo;
playPassengerCall();
intermezzo => now;
playAttendantCall();
intermezzo => now;
playAttendantEmergencyCall();
intermezzo => now;
playSeatbeltSign();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment