- Home
- Tutorials
- Flash
- Intermediate
- From Fruity Loops to Actionscript

Too much talk (examples)
Can you see how all this could be applied in the real world? Well, some people who I work with asked to me, what is that for? Maybe this is not clear enough. This is a proof of concept; it can be used in many different scenarios where you have to deal with audio and you require control on it. For example, have you ever wonder what's the easiest way of making a guitar hero game in flash? Well using this approach it could be done very, very easily. Let's get into the code, in the example below I'm explaning how to read a midi file (one single channel) and play it back by using your own waveform sample. In this case I'm using the same waveform I used in the interpolation piano keyboard article: Yeap, here is the source code of it. This is a bit more interesting approach. In this example I have done a quick song in Fruity Loops as proof of concept; the total song length is 3 minutes and 15 seconds (at the end it doesn't really matter how long it is). The important thing is how many instruments (including voices) your song uses and how complicated those instruments are; there are some VSTi and DXi instruments highly detailed that makes everything harder when exporting their samples, you have to do it manually one by one. Basically you make your own song (music arrangement) by using any kind of audio software (fruity loops, cubase, logic, reason, etc...) as you do them normally and then, at the end you have to analyze and detect which parts of your song are you reusing the most, being the most specific possible for example: in a drums set how many times in your song did you use the Kick, HitHats, Toms, etc...? Everything consists in export them separately as waveforms (.wav) and assign to them a specific note in a specific MIDI channel. The same for the harmonics; piano, bass, synths... what you have to export is only one note A4 (A440) and then compose the chords through MIDI notes. Once you have done this, you will notice that your song will sound similar to the original one (based on VSTi and DXi intrumsnets), try to include all effects applied on your instruments like reverbs, flanger, chorus, etc, when exporting waveforms. The more waveforms you use the nicer your song sounds, but also the bigger your .swf file will be at the end, so this approach may not work well on very complicated songs, normally when using acoustic instruments I prefer just use the full song as a mp3 file and forget about all this. It really helps to save time if while you're creating a song you keep in mind that you will have to split it into small tiny parts (waveforms). This is a very good example of exporting a song from Fruity Loops, I could make this song even 10 minutes long and it won't affect the size of my .swf file, again the important thing are the samples. So, here we are. I made a quick song and I exported its samples with a MIDI file that plays these samples in certain order, into my SWF are (all of them 44.1KHz Stereo 112 kbps MP3) Put you headphones on and play it! And here is the source code of it.An imported song from Fruity Loops
How does it work?
A song 3 minutes long (400KB) High Quality, Stereo

