Sine synthesizer with PureMVC

Screenshot

Screenshot

The past weeks I’ve been learning PureMVC. It had been on my mind for some time, and now that a project (a pianoroll type MIDI editor) became too complicated and the lack of structure took the fun out of programming I figured it was time for a nice new clean framework.

I read the ‘Framework Overview with UML’, the ‘Implementation Idioms and Best Practices’ and memorized the famous conceptual diagram with it’s interconnected cloud of meaningfull data blobs (see picture). I looked up some basic tutorials, ‘Minimalist MVC example using the PureMVC Framework’, ‘Building a Flash site using PureMVC’ and found this useful page: ‘PureMVC in a week’. And then felt ready for some PureMVC action of my own.

The PureMVC conceptual diagram

The PureMVC conceptual diagram

And I must say: It’s not as complicated as I feared it would be. The first hurdle is a bit high with a lot of concepts and rules to remember, but then it quickly becomes clearer what part of the code goes where. My previous framework experience was with Cairngorm which is MVC based as well, so that definitely helped me to get my head round PureMVC.

Here is my first PureMVC test project, done to check how the audio programming stuff would integrate with the framework: It’s a small synthesizer that plays sine waves. Only sine waves. You can use keys on the computer keyboard to play the synth as a piano keyboard (see picture for the keys) and use Z and X to switch octaves and C and V to change the volume. This keyboard layout was taken from Ableton Live. I like the way it works there. So thank you Ableton.

Get Adobe Flash player

The source files are available again : Download the source files here.

Take note however that there is no FLA file. This is an ActionScript only project made in FDT. But if you want to compile it in Flash, it will probably work if you set App.as as the document root.

Use the computer keyboard to play

Use the computer keyboard to play

7 Comments

Wouter,

@Joy: Two tones at fixed frequencies shouldn’t be too hard. Have you tried modifying the code of the project on this page? And if you want an easier and quicker solution: have you considered loading or embedding two small WAV or MP3 files of the sounds you want?

joy philip,

Thanks .. My mere words can’t express anything about this great work…
so many days i spend more time with AS3 ,to create 100 & 200 Hz tones (with two buttons )
now also i can’t ..
can you give me any working sample.

Chau,

Awesome tool! Thanks a bunch!!! I spent a couple hours looking for exactly this.

admin,

Hi Martin,
Well, the main reason is that the stuff on this blog is all Flash and Cairngorm can only be used with Flex as far as I know. I did use Cairngorm a few times. It’s OK, but I’m much happier to use PureMVC. I feel PureMVC is more flexible. It gives me more freedom in how to set up my projects. But I’ve yet only used it in small projects. It might be that the tighter structure of Cairngorm makes large projects more manageable.

Martin,

Hi again,
Just one stupid question: did you have any reason to choose PureMVC rather than Cairngorm (or maybe other MVC frameworks), or was it just an experience?
Regards,
Martin

Leave a Reply

Your email address will not be published. Required fields are marked *

five × 4 =