Showing posts with label max5. Show all posts
Showing posts with label max5. Show all posts

Saturday, 20 February 2010

Max5 - Handling Sound

As previously explained you can have inputs to Max5 using the following objects:


 

But as well as these there are many more things you can do to manipulate the inputs using other objects and messages as follows:

The previous is another way of toggling between on and off but this time using messages such as 1's and 0's to give it a state.

The following is a form using the Max5 keyboard in the patcher so that whenever you click a note on the keyboard the appropriate sound will be outputted to the speakers or headphones:

 
As you can see this uses the notein and noteout objects.
You can also add more interaction and better handling by using other objects. The following is a input from a mic to a output such as a speaker. 

adc~    =   analogue to digital converter
dac~    =   digital to analogue converter

These can also be used by using the speaker and microphone symbols,  I have used both in the following:

As you can see with the following you can also have sliders as volume controls or to control the synthesis of a sound, the bars labeled input and output show the volume at each interval. There is also a number box to show the volume.

But what about opening from files? You can not only open files but you can play, stop and pause where appropriate:

 
 All of the actions made on the sound are message boxes as this is the best way of a human controling the sound as if it were all code it would get very confusing.

Here is a more complicated way of manipulating sound in max5 I will try and explain what I can:


 
The previous example is a loop with a stop and start button along with the toggle button which sort of does the same thing, the 0.5 is half way to 1 so this makes the sound play half speed. The groove is connected to a buffer, if both of them have the same name then they automically relate to each other, if you do this wrong you will have a error outputted but once they have been connected and related to each other the error message will dissapear. The 1 or 2 represents the sound output, mono for one speaker or stereo for two speakers. I have used the speaker symbol here instead of the dac~ to give you a better understanding of its use. The min and max points in the number boxes do exactly as it says. The buffer looks like this:


Simple read message sent to the buffer which has been related to its groove~ object, the length of what we want and 1 or 2 for the sound outputs.

Thursday, 11 February 2010

Max5 Inputs

ANY INPUT

Max 5 has many inputs available for the software to take in, this is done by using different objects to get the data in, one of these objects is the ctlin which is a midi controller. The following allowed us to find a key's number and a reference number to that key, using keyboards this time, don't worry this will be covered later:


KEYBOARD

The keyboard can also be tracked determining which key you press, the object for this is key and it tells you the ascii number of the key pressed NOT the letter. Here is a complex version of a keyboard tracker:


In the above code when the key 115 is pressed (I think it was P) it activates the toggle button which then turns on or off depending on it's previous state, if on the delay will start repeating at a high rate generating a random number up to 110 by the random object and displayed in the number box, if the button 112 is pressed (can't remember what button that was) the middle circle will light up and if any other key is pressed the right circle will light up.

MOUSE

 Last but not least is the mouse which has 5 parameters:


When the toggle box is active the mousestate objects checks what the mouse is doing, if clicked the toggle box will turn on and off and generate a 1 or a 2 to show if its on or off, the next 2 fields are the X and Y position of the cursor and the last 2 fields are the movement in the X and Y direction, if the user moves the mouse rapidly the numbers will be high compared to slowly where the numbers will be low.

Wednesday, 10 February 2010

Max5 Basics

Max5 is a piece of software that can implement any information through the system using different objects and tools to withdraw the information that is to be changed and also processing it in different ways.

When the program has loaded the first thing to do is open a new patcher, this is the workspace that all the stuff goes onto and where we implement our design. It has two modes; locked means that you cannot add or interefere with the design but you can test it and see how it runs. Unlocked mode is the editing mode where you implement the design and add new objects.

Basic objects and tools are the object box, this is used for objects that perform a action or do something to the data. These are one of the mostly used boxes in Max 5 because you can do so much with them. Along with that there are toggle boxes and option boxes that give control of the data. There are also boxes for integers and strings.

Here is a patcher that generates a random number every time the circle is clicked, the number will be between 1 and 100:

 

When the circle is cliked it will appear yellow and the number in the number box will change to a random number generated by the random object box which has the variable 100 to tell it what the maximum number outputted desired.

The following is another basic way of controlling data, in this case a toggle object is used, unlike the bottom above a toggle object stays permanently on or off depending on its state. This time a metro is used which is a type of delay and will turn the circle on and off in the delay that we set it. There is also a number box that you can scroll up and down to change the metro's delay time higher or lower/faster or slower.

 


 Along with controlling data and doing different things to it there are many mathematical techniques that can be implemented into the design to make it better. The following is a example of this:

 

This design previous adds the two numbers together when they are both clicked, the answer outcome is obviously 10. We can change the connections to make it multiplication, divide or subtract where necessary.
If you know what objects you need you can put them together to make a bigger chain of objects:


 
The previous picture is a bit more complicated example but its using the same objects in a longer process, they all behave the same though, the toggle object at the top will set the delay for the circle with the number box there to change the interval, the random number object is throwing another random number between 1 and 100 or whatever the maximum number is on the number box, this then has a 1 added to it to make it inclusive of that number and is represented before and after this affect. Not too complicated.

There are many other objects and techniques that allow you to create even more sophisticated and controlling patchers: