Welcome to EarSketch Q&A, where you can ask questions and receive answers from other members of the community.
Use the search bar in the top right corner to see if someone with similar questions as yours has already started a discussion about it. They may have already provided answers to your questions.

362 questions

332 answers

72 comments

614 users

NEED HELP WITH MY JUKEBOX

0 votes
init();
setTempo(120);
var songList = ["1","2","3"]

var first_inst = readInput("Choose a song number, 1, 2, or 3, or random.");

if (first_inst == "1" || first_inst == "one" || first_inst == "One"){
  println("Nice Choice!")
  var drums= [RD_EDM_DRUMROLL_BREAK_1, RD_EDM_DRUMROLL_BREAK_2,RD_EDM_DRUMROLL_BREAK_3,DUBSTEP_BASS_WOBBLE_020]; for (var measure = 1; measure <5; measure++) { var mediaIndex = measure - 1; var track = measure; fitMedia(drums[mediaIndex], track, measure, 10);}
  fitMedia(DUBSTEP_BASS_WOBBLE_020, 4, 10, 26);
  fitMedia(EIGHT_BIT_ATARI_LEAD_013, 5, 12, 28);
  fitMedia(RD_EDMDRUMROLL_BREAK_1, 1, 20, 26);
  fitMedia(RD_EDMDRUMROLL_BREAK_2, 2, 20, 26);
  fitMedia(RD_EDMDRUMROLL_BREAK_3, 3, 20, 26)
  
}
else if (first_inst == "2" || first_inst == "two" || first_inst == "Two"){
  println("Nice Choice!")
  function myFunction (startMeasure, endMeasure){
 fitMedia(EIGHT_BIT_ATARI_PAD_002, 1, startMeasure, endMeasure);
 fitMedia(EIGHT_BIT_ATARI_LEAD_008, 2, startMeasure, endMeasure);
}
myFunction(2,14);
fitMedia(EIGHT_BIT_ATARI_SINEDOT_001, 3, 6, 14)
fitMedia(EIGHT_BIT_VIDEO_GAME_LOOP_007, 4, 6, 14)
fitMedia(EIGHT_BIT_VIDEO_GAME_LOOP_017, 5, 14, 26)
fitMedia(EIGHT_BIT_VIDEO_SPEAKNSPELL_BEAT_001, 6, 16, 18)
fitMedia(EIGHT_BIT_ATARI_SINEDOT_001, 7, 22, 26)
fitMedia(EIGHT_BIT_VIDEO_GAME_LOOP_007, 9, 22, 26)  
var pointC = 23
var pointE = 26
setEffect(8, VOLUME, GAIN, 0, pointC, -60, pointE);
}

else if (first_inst == "3" || first_inst == "three" || first_inst == "Three"){
  println("Awesome!")
  
  function myFunction(startMeasure, endMeasure){
 fitMedia(EIGHT_BIT_ATARI_LEAD_003, 1, startMeasure, endMeasure);
 fitMedia(EIGHT_BIT_ATARI_SFX_001, 2, startMeasure, endMeasure);
}
myFunction(1,25);
fitMedia(ELECTRO_ANALOGUE_BASS_004, 3, 3, 11)
fitMedia(ELECTRO_ANALOGUE_LEAD_004, 4, 3, 11)
fitMedia(ELECTRO_ANALOGUE_SPACELEAD_001, 5, 11, 25)
fitMedia(ELECTRO_DRUM_MAIN_BEAT_011, 6, 15, 25)
fitMedia(ELECTRO_ANALOGUE_BASS_044, 3, 19, 25)
fitMedia(ELECTRO_ANALOGUE_LEAD_004, 4, 19, 25)
}
else if (first_inst == "random"){
  println("Nice Choice!")
  var songList = ["1","2","3"]
  for(var i = 0; i*3; i++)
  songList = songList + Math.floor(Math.random() * 3);
}
else {
}

finish();

I am having troubles with my random I can not get it to work...
asked Jan 23 in errors by tboddie (140 points)

Please log in to EarSketch and refresh this page to answer this question.

...