Norberto Manzanos

From OFSET Wiki

Jump to: navigation, search

[edit] SQUEAK SONS ET IMAGES

Deux textes de Norberto Manzanos, enseignant en Education Musicale en Argentine et ancien collaborateur du groupe ‘SmallLand en Espagne, en réponse à une demande de conseils pour une introduction dans l’univers MUTIMEDIA de Squeak.

[edit] Premier email :

<....You can put music or sounds in several ways in a project. The easier is to record a sound with the sound recorder. You only need a microphone, open the sound recorder and play "save". Then you can make the sound a "tile".

> This is usefull for special effects, little sounds, not really music, because it records the wave form. The tile with your sound is available for attaching to a script, like the built-in sound of Squeak.

> Other way is to play a midi file. The midi player does that work. You can open a midi file and when you save the image, it remains as one of your objects.

> This is good for single music, it occupies very little space, but it uses the built-in sound of squeak, so the quality is not too high.

> Could be fine for melodies with a single accompaniment or for well-known themes.

> The higher quality arrives when you play an MP3 file, but this is very problematic for web projects. These files are often very heavy (3 megabytes or more) and they are not saved with your image. You need to reopen it every time.

> But limits are challenging for creation, aren't they?

> I have done some enhancements for scripting music when I was working for Smallland. You can trigger a musical event (midi or mp3) from a script. Perhaps they could help in your project…..>

[edit] Deuxième email :

>the project with the sounds.

> The project has some examples of how to use sounds in scripts. I will try to explain what I did in detail

> 1) First …… I used one of the Squeak built-in sounds > If I want a sound at the beginning, that has to be played only once, I have to put in the main script as the first action to perform, and after that, stop the script (If it doesn't stop, the sound will play indefinitely). I dragged the "make sound" tile from basic category and dropped it to the very beginning of the script.

> In that moment the script shoul look llike this: (the final version of the script have something else I will explain later)

> - fleche make sound chirp

> - fleche start script demarre

> - fleche stop script demarrer

> The last sentence stops the script itself for avoiding the infinite loop.

> The purpose of this script if only to play the sound and trigger the script "demarre"

> This is an simple example of using the built-in sounds and dropping it to a script.

> Now lets see a more complicated example.

> 2) When label "un petit cheval" appears, I wanted a direct sound A sound that referes to a horse I have no horse in my house, nor a recording of a horse sound, so I search it in the web. I type "horse sound" in Google search box and I found this site:

> http://www.horsepresence.com/shop/SoundsHome.html

> I picked up one of the many sounds …….

> In http://findsounds.com/types.html there are a lof of sound of different types (musical and not).

> From the several formats for sounds, Squeak plays only the AIFF So I select a file with .AIFF extension (You can convert the more common WAV format to AIFF with programs for sound manipulation…..).

> That's the tricky part of this explanation: there's no way to load a sound file using the multimedia morphs I'm afraid someone forgot to put an option "Load from file" in the SoundRecorder or in the WaveEditor.

> This is the trick :

> - Open the menu

> - Open a workspace

> - Type this

> SampledSound addLibrarySoundNamed: 'horse' fromAIFFfileNamed:

> 'Horse.aiff'

> - Prest alt-d (or from the contextual menu give a "do-it" )

> (I'm supossing the file is in Squeak directory and it's name is horse.aiff)

> This will create a new sound in the sound library When you press the arrows of the tile "make sound", there will be a new tile named "horse" and it will play the sound you downloaded

> I dragged this tile and dropped to script "montre2" Since this script has a test that's is checked only once, I don't need to stop the script.

> This is an example of capturing sounds from files ans using it inside Squeak.

> (Il est à remarquer que le nouveau son ‘horse’ se trouve intégré à la liste des sons préenregistrés).

> 3) Now the music You will notice I was not very creative. For the flowers I thougt in flutes making trinos And the horse between them.

> This is a complicated example, because I need some advanced features of etoys scripting.

> I needed to record some flutes sounds You can make the same with any object you can find that makes a sound that you like (a bottle, a pipe, etc).

> - Open the menu

> - Open the Object catalog

> - Open the Multimedia tab

> - Drag a "SoundRecorder" to the world

> - Assure that your microphone conexion is working (If you press the "Record" button and play a sound near the microphone, or just touch it strongly, the grid bar would change to yellow, showing the record level).

> - When you have your "instrument" ready, press the record button, make the sound and then press the stop button.

> You can repeat this procedure until you find the sound is fine .Try with play button If the sound has many silence, press the Tim button.

> - Once you have a sound that you like, press the "tile" button If will create a tile morph with your sound Squeak will prompt you for a name for the sound .

> I recorded two sounds.Two flutes making differents trinos at differents pitches and times The reason is that I wanted to mix theses sounds randomly to create a "nature" ambient.

> I made a special script for the sounds, because It had to do several actions So, I trigger the script "flutes" at the end of script "montre3".

> For the script flutes, I wanted both flutes playing together randomly I didn't want they to sound mecanically, always the same, so I need a way to trigger each sound at random I created an instance variable (I don't know if you know about this, so I'll explain it).

> In the top of the scripting menu, there's a box that opens a menu.

> You have to choose "add a new variable"

> You have to put a name for this variable and you can establish an initial value for it.

> If will appear as another element for scripting, like categories So, you can dragg this variable,

> drop it to any script and perform arithmetic operations.

> I called this variable "random" I throw it to my script and assigned a random value The random value can be obtained pressing the box with the name of the script (flutes) that opens a menu.

> The option "hand me a random number" do this.

> I droped this random variable at the right side of the randam variable.

> Then I picked the number 10 at the right most side .This means that these variable will have values between 1 and 10 randomly.

> Look at the first test in the script "flutes" There I compare the random variable with 5 and choose one of the flutes sounds.

> I wanted the horse sound between the flutes, but I didn't want a lot of.horses .Considering that the random number will be between 1 and 10, If I comparte its value to be equal to one number (i.e. 5) this will produce the effect I wanted.

> Look at the first part of the second test

> Until this moment, I had the flutes playing randomly and the horse talking happily But how do I stop all this The arrow has finished to move and I had no event to test I needed another variable I called it "times" The idea was that when the horse has made its sound five times, the script will stop So I incremented this variable everytime the horse sound is trigered.

> The thir test compare the "times" variable with 5 and the stops the script.

> To ensure that everytime I play the main script everything will work the same, I initialize the variable with 0 in the "demarrer" script.

> This is an example of the use of recorded sounds in a script, and some techniques for making sounds more "musical"

………………………….

Personal tools