Recording Into Buffer (Without Specifying Buffer Size)
Hey everybody.
The topic title says it all really! I'm writing a patch that allows users to record into a buffer, starting with a toggle on, and ending with a toggle off. This all works fine when specifying the buffer size (buffer myrec~ 10000) but this only allows a limited duration to be recorded.
Initiating the buffer with no duration means that when I record, there is no audio that actually gets recorded into the buffer.
Can anybody help?
----------begin_max5_patcher----------
{
"boxes" : [ {
"box" : {
"maxclass" : "newobj",
"text" : "loadbang",
"id" : "obj-23",
"fontname" : "Arial",
"outlettype" : [ "bang" ],
"fontsize" : 12.0,
"numinlets" : 1,
"patching_rect" : [ 868.0, 169.5, 60.0, 20.0 ],
"numoutlets" : 1
}
}
, {
"box" : {
"maxclass" : "toggle",
"id" : "obj-19",
"parameter_enable" : 0,
"outlettype" : [ "int" ],
"numinlets" : 1,
"patching_rect" : [ 718.0, 111.0, 20.0, 20.0 ],
"numoutlets" : 1
}
}
, {
"box" : {
"maxclass" : "meter~",
"id" : "obj-17",
"outlettype" : [ "float" ],
"numinlets" : 1,
"patching_rect" : [ 568.0, 169.5, 30.0, 105.0 ],
"numoutlets" : 1
}
}
, {
"box" : {
"maxclass" : "ezadc~",
"id" : "obj-15",
"outlettype" : [ "signal", "signal" ],
"numinlets" : 1,
"patching_rect" : [ 643.0, 81.0, 45.0, 45.0 ],
"numoutlets" : 2
}
}
, {
"box" : {
"maxclass" : "newobj",
"text" : "buffer~ recme",
"id" : "obj-28",
"fontname" : "Arial",
"outlettype" : [ "float", "bang" ],
"fontsize" : 12.0,
"numinlets" : 1,
"patching_rect" : [ 868.0, 201.0, 85.0, 20.0 ],
"numoutlets" : 2
}
}
, {
"box" : {
"maxclass" : "newobj",
"text" : "record~ recme",
"id" : "obj-13",
"fontname" : "Arial",
"outlettype" : [ "signal" ],
"fontsize" : 12.0,
"numinlets" : 3,
"patching_rect" : [ 718.0, 201.0, 88.0, 20.0 ],
"numoutlets" : 1
}
}
, {
"box" : {
"maxclass" : "waveform~",
"id" : "obj-2",
"outlettype" : [ "float", "float", "float", "float", "list", "" ],
"bgcolor" : [ 0.94902, 0.94902, 0.94902, 1.0 ],
"buffername" : "recme",
"numinlets" : 5,
"waveformcolor" : [ 0.14902, 0.078431, 0.317647, 1.0 ],
"patching_rect" : [ 598.0, 356.0, 400.0, 110.0 ],
"numoutlets" : 6
}
}
],
"lines" : [ {
"patchline" : {
"source" : [ "obj-15", 0 ],
"destination" : [ "obj-17", 0 ],
"hidden" : 0,
"disabled" : 0
}
}
, {
"patchline" : {
"source" : [ "obj-15", 1 ],
"destination" : [ "obj-17", 0 ],
"hidden" : 0,
"disabled" : 0
}
}
, {
"patchline" : {
"source" : [ "obj-19", 0 ],
"destination" : [ "obj-13", 0 ],
"hidden" : 0,
"disabled" : 0
}
}
, {
"patchline" : {
"source" : [ "obj-15", 0 ],
"destination" : [ "obj-13", 0 ],
"hidden" : 0,
"disabled" : 0
}
}
, {
"patchline" : {
"source" : [ "obj-15", 1 ],
"destination" : [ "obj-13", 0 ],
"hidden" : 0,
"disabled" : 0
}
}
, {
"patchline" : {
"source" : [ "obj-23", 0 ],
"destination" : [ "obj-28", 0 ],
"hidden" : 0,
"disabled" : 0
}
}
],
"appversion" : {
"major" : 6,
"minor" : 0,
"revision" : 4
}
}
-----------end_max5_patcher-----------
Hmm
seems your pasted patch is empty too. Can you verify that you can open the patch above? If it doesn't, try re-copying.
A common strategy is to initialise your buffer with a maximum size at the start of each recording, and then crop it as you need.
This demonstrates the concept, but was a rush job so caveat emptor and all that!
Brendan
Perfect work around, the crop message is exactly what I needed. Thankyou both!