instrumentDefinitions.js 928 B

12345678910111213141516171819202122232425262728293031323334353637
  1. /* *
  2. *
  3. * (c) 2009-2019 Øystein Moseng
  4. *
  5. * Instrument definitions for sonification module.
  6. *
  7. * License: www.highcharts.com/license
  8. *
  9. * */
  10. 'use strict';
  11. import Instrument from 'Instrument.js';
  12. import utilities from 'utilities.js';
  13. var instruments = {};
  14. ['sine', 'square', 'triangle', 'sawtooth'].forEach(function (waveform) {
  15. // Add basic instruments
  16. instruments[waveform] = new Instrument({
  17. oscillator: { waveformShape: waveform }
  18. });
  19. // Add musical instruments
  20. instruments[waveform + 'Musical'] = new Instrument({
  21. allowedFrequencies: utilities.musicalFrequencies,
  22. oscillator: { waveformShape: waveform }
  23. });
  24. // Add scaled instruments
  25. instruments[waveform + 'Major'] = new Instrument({
  26. allowedFrequencies: utilities.getMusicalScale([1, 3, 5, 6, 8, 10, 12]),
  27. oscillator: { waveformShape: waveform }
  28. });
  29. });
  30. export default instruments;