Scheduled service maintenance on November 22


On Friday, November 22, 2024, between 06:00 CET and 18:00 CET, GIN services will undergo planned maintenance. Extended service interruptions should be expected. We will try to keep downtimes to a minimum, but recommend that users avoid critical tasks, large data uploads, or DOI requests during this time.

We apologize for any inconvenience.

playSound.m 2.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. % Plays a predefined sound. Possible options are:
  2. %
  3. % failure
  4. % abort
  5. % gocue
  6. % alert
  7. % warning
  8. % error
  9. % done
  10. % list - will list names for all the available sounds
  11. %
  12. % Example: playSound('alert')
  13. %
  14. % Kian Torab
  15. % kian.torab@utah.edu
  16. % Department of Bioengineering
  17. % University of Utah
  18. % Version 1.2.0 - February 26, 2010
  19. function playSound(soundType)
  20. availableSounds = {'failure',...
  21. 'abort',...
  22. 'gocue',...
  23. 'alert',...
  24. 'warning',...
  25. 'done',...
  26. 'error'};
  27. if ~exist('soundType', 'var')
  28. disp('Please specify a sound type.');
  29. return;
  30. end
  31. Freq1 = 0.1;
  32. Freq2 = 0.05;
  33. Freq3 = 0.175;
  34. Freq4 = 0.5;
  35. AmpFrac = 0.5;
  36. FS = 22050;
  37. %% Failure Sound
  38. FailureSound = [AmpFrac*sin(0:Freq1:Freq1*4000),...
  39. AmpFrac*sin(0:Freq2:Freq2*10000)];
  40. %% Abort Sound
  41. AbortSound = AmpFrac*sin(0:Freq2:Freq2*10000);
  42. %% GoCue Sound
  43. GoSound = AmpFrac*sin(0:Freq3:Freq3*1000);
  44. %% Alert Sound
  45. AlertSound = AmpFrac*sin(0:Freq4:Freq4*100);
  46. %% Warning Sound
  47. WarningSound = AmpFrac*sin(0:Freq4:Freq3*10000);
  48. %% Error Sound
  49. TempSound1 = AmpFrac * sin(0:Freq2*1:Freq2*1*6000);
  50. TempSound2 = AmpFrac * sin(0:Freq2*2:Freq2*2*6000);
  51. TempSound3 = AmpFrac * sin(0:Freq2*3:Freq2*3*6000);
  52. ErrorSound = horzcat(TempSound1, TempSound2, TempSound3);
  53. %% Done Sound
  54. quarterBeat = 0.018*6000;
  55. baseFreq = 0.015;
  56. TempSound1 = AmpFrac * sin(0:baseFreq+0.070*1:quarterBeat*4);
  57. TempSound2 = AmpFrac * sin(0:baseFreq+0.050*1:quarterBeat*2);
  58. TempSound3 = AmpFrac * sin(0:baseFreq+0.050*1:quarterBeat*2);
  59. TempSound4 = AmpFrac * sin(0:baseFreq+0.057*1:quarterBeat*4);
  60. TempSound5 = AmpFrac * sin(0:baseFreq+0.050*1:quarterBeat*8);
  61. TempSound6 = AmpFrac * sin(0:baseFreq+0.065*1:quarterBeat*4);
  62. TempSound7 = AmpFrac * sin(0:baseFreq+0.070*1:quarterBeat*8);
  63. DoneSound = horzcat(TempSound1, TempSound2, TempSound3,...
  64. TempSound4, TempSound5, TempSound6,...
  65. TempSound7);
  66. switch lower(soundType)
  67. case 'failure'
  68. playSound = FailureSound;
  69. case 'abort'
  70. playSound = AbortSound;
  71. case 'gocue'
  72. playSound = GoSound;
  73. case 'alert'
  74. playSound = AlertSound;
  75. case 'warning'
  76. playSound = WarningSound;
  77. case 'done'
  78. playSound = DoneSound;
  79. case 'error'
  80. playSound = ErrorSound;
  81. case 'list'
  82. disp(availableSounds);
  83. return;
  84. otherwise
  85. disp('Sound type is not valid. Use ''help playSound'' for more information.');
  86. return;
  87. end
  88. wavplay(playSound, FS);