How buffer~ works has been introduced in this chapter. What you have learned there is that a series of amplitudes stored in a memory can be read and played back at a certain rate by an oscillator. This process produces a periodic waveform with a more or less complex tone, in relation to its shape and the harmonic content thus generated.
At a sample rate of 44.100 kHz, our computers are now able to store many different variations of amplitude and, if stored in memory, create different data sequences, which can be then played back. These sequence of amplitudes don;t have to be periodic, neither be confined in as little as few milliseconds as for wavetable synthesis processes. They are called samples and they can be as long as our computer memory can afford.
In a new patcher, create a buffer~ object and name it as you like, in my example, I will name it ‘recording1’. Create then a new object named record~, and point it to the same name of the buffer as shown here:
As you can see I have also added a waveform~ object and set it to the same name of my buffer~ object and added a toggle and a microphone input (adc~ object) to the record~ object. I have also specified a length of 1000 milliseconds to the buffer, by placing 1000 after its name. That means my buffer will store samples for up to 1000 milliseconds (44100 samples in total).
After turning the audio on, and checking your mic has an input (if you like, add a meter~ object to adc~ to check if audio is passing though), try record some samples by pressing the toggle.
As you can see from the picture above, my recording looks exactly as a sequence of amplitudes distributed over the 44100 samples available in a 1000 ms long buffer. This process in principle is exactly the same as the one seen in the wavetable synthesis chapter but adding the dynamicity of the microphone and the record object.
If you study carefully the options in the record~ object help file, you will see you can put the record in loop, or stop and start it at precise positions even within the buffer not just from the start.
One thing you can also do is to send a write message to the buffer~ object and save the recorded samples for good in the memory.
Playback of samples
To payback your just saved sample you can use sfplay~ object. Place it in the patcher and send it an open message, to be able to go an retrieve your sample whee you have stored it in your disk.
By using the toggle you can start and stop the recording. If you read the help file for this object you will also learn how to set it to a specific playback speed, and start hearing interesting effects of the samples playback process.
Other and objects to playback samples, which instead of loading a sample form the disk they can actually play directly from a buffer~ in the patcher are play~, groove~, and wave~, and will discuss in more details in the next lessons.