Flash Audio: Adding Sound Loops

Adding sound loops to a Flash Movie is a simple task. The first thing you have to do is to find the appropriate loop for your Flash Movie. We have lots of free royalty free music loops on our home page at Partners In Rhyme.com that you can download and use with these tutorials.
You can add sound loops for your animations such as cartoons or intros. The whole thing is very easy. If you have a Flash movie with content, like on image 1.

Flash audio tutorial

To add a loop to your movie, follow these steps:

1.    Add an extra layer called “Sound”.
2.    Import a sound loop the you Flash Movie.
3.    Select the first frame of the layer
4.    In the properties panel, in the “Sound” drop down menu, select the imported sound.

That’s all, now you can specify the number of times to loop! On image 3, you can how the image should know look like.

adding music loops to flash

Flash Audio: Streaming MP3’s in Flash

This tutorial will shortly explain the importance of the loadSound method. This method is used when you want to load external MP3 files. Here is the syntax:
public loadSound(url:String, isStreaming:Boolean) : Void
Let’s see how it works!
As I already said, this loads an MP3 file into the Sound object you created. The parametar isStreaming is interesting. You can use it to indicate whether the sound is an event or a streaming sound.
Just like it is the case with every sound, event sounds must be completely loaded before they play. They are managed by the ActionScript Sound class and respond to all methods and properties of this class.
Streaming sounds play while they are downloading. Playback begins when sufficient data has been received to start the decompressor.
All MP3s (event or streaming) loaded with this method are saved in the browser’s file cache on the user’s system. Here is the overview of the two parameteres:
url:String – The location on a server of an MP3 sound file.
isStreaming:Boolean – A Boolean value that indicates whether the sound is a streaming sound (true) or an event sound (false).
Let’s create an example!
Open up a new Flash document. Place an input text field onto the stage (Image 1).
Streamign Audio on Flash

Give it an instance name songName_txt (Image 2).

Streaming MP3 audio in Flash

Add a simple button besides the text field and give it the instance name startSound_btn.(Image 3)

Load sound flash tutorial

Ok, now add an additional layer and name it „Actions“. Rename the layer with the text field at the botton to „Text Field“ (Image 4).

Make sure you have MP3 tracks in the same folder where the Flash movie resides.
Select the first frame of the layer Actions and add the following ActionScript:
var soundToLoad:Sound = new Sound();
startSound_btn.onRelease = function () {
    var song = songName_txt.text;
    soundToLoad.loadSound(song, true);
}
soundToLoad.onLoad = function () {
    this.start(0, 1);
}
Test the movie. Type in the name of one of your tracks and press the start button. The mp3 file should load and play!

Flash Audio: Creating Stereo Sound

Welcome back to our series about Flash Audio. Now we will deal with some more complicated stuff, stereo and mono sounds. To accomplish that, I have to instroduce you to the Transform object in Flash. Sounds complicated, but it’s not that complicated. In ActionScript, you have the “Object” DataType. Like this:

//define an object in ActionScript
var myObject:Object = new Object();

//add properties
myObject.name = “SomeBody”;
myObject.surname = “SomeSurname”;

Now you have an object with the properties name and surname.

But what has this to to with the sound? Here is the answer. The sound in Flash is transformed eg. divided into speakers. When the stereo sound is on (by default it is stereo), then the right speaker has the percentage of 100 and the left too. In ActionScript, it is written like this:

ll = 100
lr = 0
rr = 100
rl = 0

What the heck? It’s not that complicated. Ll stands for Left input on left speaker. Lr stands for left input on right speaker. Rr for right input on right speaker and rl for right input on left speaker. The variables can have values from 0 – 100. As you suggest, you adjust the values to create mono or stereo sound.

//sample mono on left speaker
ll = 100
lr = 100
rr = 0
rl = 0

//sample mono on right speaker
ll = 0
lr = 0
rr = 100
rl = 100

So now that you understand the show transform object you have to know how to apply this to the sound object. Assume you have a track in your Flash document library with the linkage ID set to “myTrack”. The code would look similar to this:

//create the new sound object
var mySound:Sound = new Sound();

//attach the track from the library
mySound.attachAudio(“myTrack”);

//create the mono sound transform object for the right speaker
var monoSoundRight:Object = new Object();
monoSoundRight.ll = 0
monoSoundRight.lr = 0
monoSoundRight.rr = 100
monoSoundRight.rl = 100

//apply it to the sound object
mySound.setTransform(monoSoundRight);

So, it is now very easy to create a Flash movie with buttons that switch between left and right speakers. Here is how it is done:

Open a new Flash document. Import a new sound into the library (Image 1).

Stereo audio in Flash

Give it the linkage ID “myTrack” (Image 2).

flash stero audio tutorial

Create two layers on the main timeline: “Actions” and “Content”. Make sure the “Actions” layer is above the “Content” layer (Image 3).

stero audio in flash

Create two buttons for the right and the left speaker. Place them on the stage and give the left button the instance name “left_btn” and “right_btn” to the right button (image 4).

flash audio tutorial

Paste the following code into the first frame of the Actions folder:

var mySound:Sound = new Sound();
mySound.attachSound(“myTrack”);

mySound.start(0, 50);

right_btn.onRelease = function () {
mySound.setTransform(rightMonoSound);
}

left_btn.onRelease = function () {
mySound.setTransform(leftMonoSound);
}

var leftMonoSound:Object = new Object();
leftMonoSound.ll = 100;
leftMonoSound.lr = 100;
leftMonoSound.rr = 0;
leftMonoSound.rl = 0;

var rightMonoSound:Object = new Object();
rightMonoSound.ll = 0;
rightMonoSound.lr = 0;
rightMonoSound.rr = 100;
rightMonoSound.rl = 100;

var stereoSound:Object = new Object();
rightMonoSound.ll = 100;
rightMonoSound.lr = 0;
rightMonoSound.rr = 100;
rightMonoSound.rl = 0;

Less Stress Now: Relax FAST at the Speed of Life

Less Stress Now: Relax FAST at the Speed of Life by Ronald Nathan, Ph.D.
Can your stress wait for you to jog, meditate or talk with a friend?
Over 60 percent of visits to doctors in this country are stress-related. It attacks not only our health, but our happiness, as well. Stress is the body\’s preparation to fight or flee danger. It was important for prehistoric survival, but today we have few physical fights and almost nowhere to flee. Instead we clamp a lid on the stress response, building up frustration, muscle tension and dangerous chemicals. Current remedies for stress relief are great if we have the time to use them. Exercise burns off the by-products of stress, yoga relaxes our bodies, and talking with a friend calms us down. But not having enough time to take care of ourselves is part of the stressful life most of us live. Is there a way to keep stress from building up by relaxing quickly throughout even our busiest days? Most of us tune out our bodies and push though the day. People may tell us we need to slow down and relax, but seldom does anyone tell us how. WELCOME TO BELLY BREATHING If you are new to belly breathing or need a refresher course, here it is. There is power in the simplicity of slow, belly breathing for stress relief and in the wonderful domino effect it has on the body. Yes, we all have a “fight-or-flight,” “wear-and-tear” emergency response, but we also have a “stay-and-play, “rest-and-digest\” relaxation/recuperative response. Just as stress and shallow breathing race the heart, raise our blood pressure, send butterflies into our stomachs, and tense up our muscles, relaxation and belly breathing reverse these unhealthy and unpleasant strains on our bodies. To learn belly breathing for stress relief, put your hand on your belly button. When you breathe out, push your hand in. When you breathe in, push your hand out. To deepen and slow your breathing, squeeze a little more out, so you’ll be able to take a little more in. Count how often you breathe. Most of us breathe 12-20 times a minute. Try for 10 or less during belly breathing. If you want to be sure you are belly breathing rather than chest breathing, get down on your hands and knees. Breathe. This posture forces you to belly breathe because it holds the chest at rest. Of course, once you learn belly breathing, you can do it without putting your hand on your stomach, counting or getting on the floor. You can belly breathe almost anywhere and anytime you want to relax. Start while you are waiting. The average American waits 40 frustrating minutes a day. We wait for red lights, elevators and cashiers. Callers put us on hold. Now you can give yourself a healthy break for stress relief. As you get good at belly breathing, you can also use it when you are upset. To listen to short samples of Dr. Nathan’s relaxation training recording, The FAST Technique for Stress Relief, go to www.SampleRelaxation.com or www.FreeRelaxation.com For a free six-minute sample, register and download it. © 2012 by Ronald Nathan, Ph.D.

Working with iTunes – Part 1 of 3 (how to import)

Every music aficionado probably knows what iTunes is. Apple Computer launched iTunes during the MacWorld Expo San Francisco in 2001. iTunes is a media player and an application used to organize your music and video files. Although it is owned by Apple Computer, it can also be installed and used in NT-based Windows platforms, i.e. Windows XP, 2000 and Server 2003. Mac OS 9 was the first Mac version it was used with but the support for this platform was discontinued after iTunes 3.

iTunes also comes standard with all Apple iPods. iTunes is the application used to organize and upload music in iPods. The application can also connect to the iTunes Music Store where users can purchase digital music and video files to be played in iPods and iTunes.

Any user can easily learn how to use iTunes. Its features and functionality are not that complex that even a beginner can easily transfer and play media files with iTunes. Here are some basic tutorials on some of the functionalities of iTunes.

How to Import Your Favorite Music from a CD

It would be great to have all your favorite songs from different CDs be consolidated in just one music library, isn’t it? This task is possible and easily done with iTunes.

Insert the CD where you want to import songs from inside the disc drive. Once you insert the CD, iTunes will automatically come up. If not, just open it from your list of programs. When iTunes automatically comes up, it will immediately show you the list of songs in the CD. Alternatively, you can choose the CD title in the Source list to see the music files in the disc.

iTunes is capable of immediately knowing the contents of your CD because it has a database of different information about each song from the Compact Disc Database (CDDB). CDDB is an online service which has all song information or tags. If your computer is connected to the internet, iTunes will automatically connect to CDDB and search the database for the CD information.

With iTunes, you can just choose the songs that you want to import and not necessarily import the whole CD. There are checkboxes beside each song title in the list. Just select those that you want to import into your computer. Once you have checked all the songs you want to import, just click on the Import button on the upper right hand corner of the window. You can see the import progress on the viewer at the upper middle portion of the iTunes window. A wave symbol will be shown beside the title of the song being imported, while a check mark is shown when the song has already been imported.

Once done, you can now eject the CD from the tray by clicking on the Eject button on the lower right hand side of the window. From the Source list, choose Library to show all the media files stored in your iTunes music library. You should now be able to see those songs that you have imported from the CD in the iTunes library.

Music files from CDs are known to be large files. However, when those songs get imported into your computer through iTunes, they are automatically converted into a much lower yet reasonable file size. iTunes has the capability of compressing the music files as they are imported. The compressed, imported files are not necessarily of low quality. You may not even be able to distinguish a compressed song from that played from a CD.

You can also choose the compression technique that iTunes uses to copy and convert the songs. Just go to Importing preferences and choose the audio format from the list in the Import Using pop-up menu. You can choose among different formats such as MP3, AAC, AIFF, and WAV. MP3 can produce high quality sound with just a small file size. AAC can be even better in giving higher quality with smaller size; this is also the file format of songs that can be purchased from iTunes Music Store. AIFF and WAV, though able to produce excellent quality music, have large file sizes.

With iTunes, you can import all those songs from all your CDs. It would give you easy access to all your songs in just one music library. After all, you can store as much music you want in iTunes; you can have thousands of songs stored here and still have room for your other programs and files.Every music aficionado probably knows what iTunes is. Apple Computer launched iTunes during the MacWorld Expo San Francisco in 2001. iTunes is a media player and an application used to organize your music and video files. Although it is owned by Apple Computer, it can also be installed and used in NT-based Windows platforms, i.e. Windows XP, 2000 and Server 2003. Mac OS 9 was the first Mac version it was used with but the support for this platform was discontinued after iTunes 3.

iTunes also comes standard with all Apple iPods. iTunes is the application used to organize and upload music in iPods. The application can also connect to the iTunes Music Store where users can purchase digital music and video files to be played in iPods and iTunes.

Any user can easily learn how to use iTunes. Its features and functionality are not that complex that even a beginner can easily transfer and play media files with iTunes. Here are some basic tutorials on some of the functionalities of iTunes.

How to Import Your Favorite Music from a CD

It would be great to have all your favorite songs from different CDs be consolidated in just one music library, isn’t it? This task is possible and easily done with iTunes.

Insert the CD where you want to import songs from inside the disc drive. Once you insert the CD, iTunes will automatically come up. If not, just open it from your list of programs. When iTunes automatically comes up, it will immediately show you the list of songs in the CD. Alternatively, you can choose the CD title in the Source list to see the music files in the disc.

iTunes is capable of immediately knowing the contents of your CD because it has a database of different information about each song from the Compact Disc Database (CDDB). CDDB is an online service which has all song information or tags. If your computer is connected to the internet, iTunes will automatically connect to CDDB and search the database for the CD information.

With iTunes, you can just choose the songs that you want to import and not necessarily import the whole CD. There are checkboxes beside each song title in the list. Just select those that you want to import into your computer. Once you have checked all the songs you want to import, just click on the Import button on the upper right hand corner of the window. You can see the import progress on the viewer at the upper middle portion of the iTunes window. A wave symbol will be shown beside the title of the song being imported, while a check mark is shown when the song has already been imported.

Once done, you can now eject the CD from the tray by clicking on the Eject button on the lower right hand side of the window. From the Source list, choose Library to show all the media files stored in your iTunes music library. You should now be able to see those songs that you have imported from the CD in the iTunes library.

Music files from CDs are known to be large files. However, when those songs get imported into your computer through iTunes, they are automatically converted into a much lower yet reasonable file size. iTunes has the capability of compressing the music files as they are imported. The compressed, imported files are not necessarily of low quality. You may not even be able to distinguish a compressed song from that played from a CD.

You can also choose the compression technique that iTunes uses to copy and convert the songs. Just go to Importing preferences and choose the audio format from the list in the Import Using pop-up menu. You can choose among different formats such as MP3, AAC, AIFF, and WAV. MP3 can produce high quality sound with just a small file size. AAC can be even better in giving higher quality with smaller size; this is also the file format of songs that can be purchased from iTunes Music Store. AIFF and WAV, though able to produce excellent quality music, have large file sizes.

With iTunes, you can import all those songs from all your CDs. It would give you easy access to all your songs in just one music library. After all, you can store as much music you want in iTunes; you can have thousands of songs stored here and still have room for your other programs and files.