Skip to content

How_to_create_a_WAV_file_of_a_simple_melody

hhzl edited this page May 15, 2025 · 1 revision

How to generate a 'WAV' file

(AbstractSound noteSequenceOn: FMSound flute2 from: #(
(e5 0.5 500)
(d5 0.5 300)
(c5 0.5 350)
(d5 0.5 300)
(e5 0.5 500)
(e5 0.5 300)
(e5 1.0 350)
(d5 0.5 400)
(d5 0.5 300)
(d5 1.0 330)
(e5 0.5 400)
(g5 0.5 300)
(g5 1.0 500)
)) storeWAVOnFileNamed: 'maryhadalittlelamb.wav'

And play it with

 (SampledSound fromWaveFileNamed: 'maryhadalittlelamb.wav') play

Source: http://wiki.squeak.org/squeak/152

Clone this wiki locally