First experiments with sound
Jump to navigation
Jump to search
These notes were started from hhzl observations here.
The sound system was exported from Squeak, more information can be found in the Swiki, see [1] and [2].
The sound system isn't loaded in the Cuis base system, but it is included in it, you just need to load it with:
Feature require: 'Sound'.
Play a melody writing note names and duration
(AbstractSound noteSequenceOn:
PluckedSound default from:
#((c4 1 500)
(d4 1 500)
(e4 1 500)
(g4 1 500)
(a4 1 250)
(a4 1 250)
(c5 1 500)
)
) play
TODO. Play a melody with note names in Italian: Do, Re, Mi ...
TODO. Link to the interesting story of this topic
TODO.
Create 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'.
Play a *.wav file
(SampledSound fromWaveFileNamed: 'maryhadalittlelamb.wav') play
Exercise.1. Check that the class Sound isn't present in Cuis by default.