Sugar Labs

MusicBlocks Issue: #866: Export as .wav

Further to the discussion at https://github.com/walterbender/musicblocks/issues/854, it would be nice to see functionality for allowing the export of a MB program as a wav / ogg / mp3 file.

One implementation possibility:

Connect the Tone.Master node (where all the MB audio is sent) to a MediaStreamAudioDestination node (https://developer.mozilla.org/en-US/docs/Web/API/AudioContext/createMediaStreamDestination, https://github.com/Tonejs/Tone.js/wiki/Connections) and then save the resulting MediaStream as a file / make it available through an <audio> element. The 'recording' of audio into the MediaStream could be done through the user playing the piece in the 'playback' mode that has recently been developed for MB. The only issue would be that the user would need to wait for the code to play back (in normal time) to export it as a file - one could try to get around this problem, but it would mean major changes to MB's synth engine.

Task tags

  • javascript
  • MusicBlocks

Students who completed this task

Euan Ong

Task type

  • code Code
close

2017