First experiments with sound: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
(added sections) |
||
Line 25: | Line 25: | ||
===== TODO. Play a melody with note names in Italian: Do, Re, Mi ... ===== |
===== TODO. Play a melody with note names in Italian: Do, Re, Mi ... ===== |
||
xxxxx Should be easy. |
|||
⚫ | |||
⚫ | |||
TODO. |
|||
===== TODO. Realtime sound. on envent play a sound as soon as possible ===== |
|||
This is necessary to simulate instruments playing on a computer keyboard or on some other external harware device. It is important that the delay is small otherwise the effect will be not realistic and not fun. At the moment i don't know how to do it. |
|||
===== Create a *.wav file ===== |
===== Create a *.wav file ===== |
Latest revision as of 21:06, 12 May 2025
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 ...
xxxxx Should be easy.
xxxxx link to the interesting story of the two different note names
TODO. Realtime sound. on envent play a sound as soon as possible
This is necessary to simulate instruments playing on a computer keyboard or on some other external harware device. It is important that the delay is small otherwise the effect will be not realistic and not fun. At the moment i don't know how to do it.
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.
References
- xxxx
- xxxx