Creating sounds from scratch

Monkey Forums/Monkey Beginners/Creating sounds from scratch

Leo Santos(Posted 2016) [#1]
Hi,

I'm trying to figure out how to create a sound without loading a file. I've found that the class "Sound" is defined in mojo.audio and it uses a "Sample" object, but I can't find where Sample is defined.

I imagine that, once I figure out the Sample class, there's probably an Int array somewhere I can write values to in order to create a waveform from scratch.

Any clues for me?
Thanks!


Nobuyuki(Posted 2016) [#2]
Creating sounds in this way isn't possible with mojo. You can, however, create them in non-realtime by writing a RIFF WAVE header and then tacking it on to the beginning of raw data, exporting that from a DataBuffer to a sample into your /internal/ folder, and then loading that in through mojo.


Leo Santos(Posted 2016) [#3]
Bummer. I thought it wouldn't be possible, since each target handles sound very differently, but wanted to check it anyway.
Will it be possible in Monkey2 out of the box, since it seems to use SDL2?

Thanks!
Leo.