Skip to content

Commit

Permalink
Adding SITAR as a new instruments (sugarlabs#4310)
Browse files Browse the repository at this point in the history
* Adding Sitar as new instrument

* Adding Sitar as new instrument
  • Loading branch information
omsuneri authored Jan 26, 2025
1 parent 46ccbb5 commit 53e291e
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 9 deletions.
1 change: 1 addition & 0 deletions js/js-export/interface.js
Original file line number Diff line number Diff line change
Expand Up @@ -523,6 +523,7 @@ class JSInterface {
"cello",
"bass",
"double bass",
"sitar",
"guitar",
"acoustic guitar",
"flute",
Expand Down
1 change: 1 addition & 0 deletions js/utils/musicutils.js
Original file line number Diff line number Diff line change
Expand Up @@ -1109,6 +1109,7 @@ const SELECTORSTRINGS = [
_("bass"),
_("double bass"),
_("guitar"),
_("sitar"),
_("acoustic guitar"),
_("flute"),
_("clarinet"),
Expand Down
24 changes: 15 additions & 9 deletions js/utils/synthutils.js
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,8 @@ const VOICENAMES = [
[_("bass"), "bass", "images/voices.svg", "string"],
//.TRANS: viola musical instrument
[_("double bass"), "double bass", "images/voices.svg", "string"],
//.TRANS: sitar musical instrument
[_("sitar"), "sitar", "images/synth.svg", "string"],
//.TRANS: musical instrument
[_("guitar"), "guitar", "images/voices.svg", "string"],
//.TRANS: musical instrument
Expand Down Expand Up @@ -264,7 +266,8 @@ const SOUNDSAMPLESDEFINES = [
"samples/viola",
"samples/oboe",
"samples/trombone",
"samples/doublebass" // "samples/japanese_bell",
"samples/doublebass",
"samples/sitar"
];

// Some samples have a default volume other than 50 (See #1697)
Expand Down Expand Up @@ -300,7 +303,8 @@ const DEFAULTSYNTHVOLUME = {
"slap": 60,
"vibraphone": 100,
"xylophone": 100,
"japanese drum": 90
"japanese drum": 90,
"sitar": 100
};

/**
Expand All @@ -327,12 +331,13 @@ const SAMPLECENTERNO = {
"koto": ["C5", 51], // pitchToNumber('C', 5, 'C Major')],
"dulcimer": ["C4", 39], // pitchToNumber('C', 4, 'C Major')],
"electric guitar": ["C3", 27], // pitchToNumber('C', 3, 'C Major')],
"bassoon": ["D4", 41], // pitchToNumber('C', 5, 'C Major')],
"bassoon": ["D4", 41], // pitchToNumber('D', 4, 'D Major')],
"celeste": ["C3", 27], // pitchToNumber('C', 3, 'C Major')],
"vibraphone": ["C5", 51],
"xylophone": ["C4", 39],
"viola": ["D4", 53],
"double bass": ["C4", 39]
"vibraphone": ["C5", 51], // pitchToNumber('C', 5, 'C Major')],
"xylophone": ["C4", 39], // pitchToNumber('C', 4, 'C Major')],
"viola": ["D4", 53], // pitchToNumber('D', 4, 'D Major')],
"double bass": ["C4", 39], // pitchToNumber('C', 4, 'C Major')],
"sitar": ["C4", 39] // pitchToNumber('C', 4, 'C Major')]
};


Expand All @@ -355,7 +360,7 @@ const percussionInstruments = ["koto", "banjo", "dulcimer", "xylophone", "celest
* @constant
* @type {Array<string>}
*/
const stringInstruments = ["piano", "guitar", "acoustic guitar", "electric guitar"];
const stringInstruments = ["piano","sitar", "guitar", "acoustic guitar", "electric guitar"];

/**
* Validates and sets parameters for an instrument.
Expand Down Expand Up @@ -828,7 +833,8 @@ function Synth() {
{ name: "bassoon", data: BASSOON_SAMPLE },
{ name: "celeste", data: CELESTE_SAMPLE },
{ name: "vibraphone", data: VIBRAPHONE_SAMPLE },
{ name: "xylophone", data: XYLOPHONE_SAMPLE }
{ name: "xylophone", data: XYLOPHONE_SAMPLE },
{ name: "sitar", data: SITAR_SAMPLE }
],
drum: [
{ name: "bottle", data: BOTTLE_SAMPLE },
Expand Down
4 changes: 4 additions & 0 deletions sounds/samples/sitar.js

Large diffs are not rendered by default.

0 comments on commit 53e291e

Please sign in to comment.