Category Archives: Audio Tutorials

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;

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.

Working with iTunes – Part 2 of 3 (browsing and playing music)

continuing series of how to articles for iTunes software. This installment tells how to browse and play music.

How to Play Your Music

Once you have imported your favorite songs from the CD or have purchased them from the iTunes Music Store, you now have them in your library for you to play and listen to. With iTunes, you can just sit back, relax, and listen to your great music collection.

Once you have iTunes open, choose Library from the Source list to show all the songs in your library. Just select the song you want to listen to and click on the Play button on the upper left hand corner. If you want to adjust the volume, you can do so with the volume slider control just below the playback buttons.

With the iTunes display on the upper middle portion of the screen, you can see the title of the song currently playing, elapsed time, and a timeline. If you want to skip to a specific portion of the song, you can just click on any point on the timeline. If you want to skip to the next song, instead, you can do so by clicking on the Fast Forward button beside the Play button.

If you do not want to just listen to the song, you also have an option to “see” it. iTunes has a Music Visualizer which synchronizes with the song’s rhythm. You will surely enjoy this full-color light show while listening to your favorite music. If you want this Music Visualizer on, just go to Visualizer menu and click on Turn Visualizer On. To view your music library again, go back to the Visualizer menu and choose Turn Visualizer Off. Alternatively, you can quickly turn on and off the Music Visualizer with the Music Visualizer button on the bottom of the window just beside the Eject button.

You can also customize how the visualizer looks. You can choose a full screen size or opt for a much smaller window by resizing it. While the Music Visualizer window is playing, you can just press on the H key on your Mac keyboard to customize the window more.

For a real great listening experience, you can choose to connect a pair of high-end powered speakers to your Mac. With the use of an adapter cable, usually a mini-to-stereo RCA splitter cable, you can attach a home stereo system to your computer or iPod and enjoy to the great sound of your favorite music.

How to Browse and Search for Files in Your iTunes Library

Sometimes we feel the urge to some particular music. There are also times that we don’t know exactly what we want to listen to. Having hundreds or even thousands of music in your computer may be too overwhelming. With iTunes, browsing the music library and choosing the exact song you want to listen to is just an easy task.

If you want to browse the music library, choose Library in the Source list then click on the Browse button on the upper right hand side of the window. You will then have an Artist and Albums list. Just choose your desired artist from the Artist list and it will show the different albums of that artist that are in your music library. Choose the desired album to play and click on the Browse button again to return to your iTunes library where it shows the different songs included in the album selected.

Browsing by genre is also possible. To do so, go to the iTunes menu then select Preferences. Click on the icon labeled General and choose “Show genre when browsing,” and click OK. Once you click on the Browse button again, you will now see the list of different genre such as Pop, Rock, Country, Hip Hop, Jazz, etc, in the browsing pane to the left of the Artist list.

If you cannot see the whole album title or name of the artist from the browsing pane, you can adjust the right side of the pane. Just hover the mouse on the line separating the columns and it will change to a double-sided arrow. You can now adjust the line to the left or right to narrow or expand the viewing window, respectively.

On the other hand, if you know exactly the song you want to listen to and want to search for it, you can also do that easily with iTunes. Notice on the upper portion of the window, there is a search icon and a search box. Type the name of the song or just a part of it in the search box. Notice that with each word you type, the list populates more songs that somehow match your search criteria.

When you make a search, iTunes checks the Song Name, Artist, Composers and Albums fields. If you want an exact search, you can choose a category from where iTunes will do the search. You can do this by clicking on the search icon and select the desired category then type the search criteria in the field or search box. After making a search, you can go back to the iTunes library by clicking on the gray-and-white icon in the search field.

In the case that you upgraded iTunes from Mac OS 9 to the new iTunes 4 with Mac OS X, your music from the previous version may not be stored in the same place where the new version stores the files. It would be tedious to search for your desired song if your music are not found in a single location. To consolidate all your music files into just one folder, go to Advanced menu and select Consolidate Library.

iTunes also allows you to see how much hard disk space your music library has already consumed. When you have the Library selected from the Source list, you will see the total number of files you already have, their total running time, and the total combined file size of all the songs at the bottom portion of the iTunes window.

Working with iTunes – Part 3 of 3 (playlists and other apps)

The third installment of a three part series of articles on how to use iTunes software. This section deals with playlists and toher programs.

How to Organize Your Music Using Playlists

Organizing your music can also be done with iTunes. You can do this by creating different playlists that would correspond to every set of songs that you want to create. Using a playlist, you can select the songs you just want to play at a given time and choose their order as well depending on your preference.

To create a playlist, go to the File menu and click on New Playlist. A new entry on your Source list will be created. This entry will be an untitled playlist. Choose the untitled playlist and rename it to whatever that would best describe the songs in it. You can give names such as workout songs, relaxing classics, my hit list, etc. The possibilities are infinite.

Once you have created and named your playlist, choose the songs you want to add to the playlist from the library and drag them to the playlist. You can add as many songs as you want. As a shortcut, you can select all the songs you want to add at once by holding down the Command key (Ctrl key in Windows PC) while choosing the different songs and dragging the entire selection to the playlist.

To view the songs that you have just added in your playlist, choose the name of the playlist from the Source list. You can also change the order of the songs by selecting the song number and drag the song to the position desired.

A single song can also be added to multiple playlists if desired. To do so, just choose the song from your music library and drag it to the different playlists you want to add it to. If, on the other hand, you choose not to hear the song anymore, just deselect the song from your music library. Deselecting it from the library will also disable it from playing when the playlists it is included are played.

If you want to make your playlists play for only a specified period of time such as 30 minutes for your daily workout or as long as the movie you made, you can do so by getting the duration information for the playlist. This information is displayed on the bottom portion of the window as well as the number of songs in the playlist and the total size of the playlist.

Deleting a playlist is just like deleting any file. You just need to select the playlist from the Source list then press the delete key. This will only remove the playlist, and the songs which are included in the deleted playlist still remain in the music library.

How to Use Your Songs with Other Applications

iTunes is a part of the iLife suite by Apple Computer which also includes iPhoto, iMovie, and iDVD. These applications are developed to work together. The songs you have in your iTunes music library can all be used with any of the other iLife applications as well as applications in a Windows-based computer.

You can, for example, use your favorite song compilation as soundtrack of the family movie you are doing in iMovie. You can enjoy viewing the different photos you have just taken by adding background music from your iTunes library in your photo slideshow in iPhoto.

To add background music to your iPhoto slideshow, choose your photo library from Source list in iPhoto. Click on the Slideshow button to open the Slideshow Settings window. Adjust the number of seconds the image will show onscreen depending on your preference. You will see a Music option in the window, click on the box beside to select it and choose iTunes Library from the menu. Choose the song that you want to play as the background music. Once done, click on the Play Slideshow button to playback the slideshow project.

If you want to add a song from your iTunes library to a presentation you created in Microsoft PowerPoint or Keynote, you can do so in just a few easy steps. Choose the song you want to use from your music library in iTunes. Once the song is selected, go to File menu and click on Show Song File. A representation of the music file will come up in a new Finder window. Click the song file and drag it to the Keynote or PowerPoint slide where you want to add it to.

Your favorite songs in your iTunes music library are not limited only for your listening pleasure. You can have a wide range of possible uses of those songs in different applications in your Mac or Windows-based computer.