Sound is stereo when patch opened, but mono when closed

Ruben R's icon

A brief introduction to what I am trying to build: I am writing a Max Audio Effect that reads incoming audio into a buffer~ (eventually for processing/manipulation), where a 'time' knob sets the rate at which a new audio buffer is acquired. A phasor~ object serves as the main engine of the patch, where every wave represents a new sample being recorded/played. Changing the time knob will update the sample period once the wave has finished and the old buffer has been played completely. Furthermore, I made a Freeze/Record mechanism: Record mode is the mode I just described; in Freeze mode, no new audio will be recorded into the audio buffer, and the current buffer will be looped.

The audio is being recorded using two poke~ objects (one for left outlet of plugin~, one for right outlet of plugin~), and is being played using two index~ objects (one for left inlet of plugout~, one fot right inlet of plugout~). The buffer~ has been set to have two channels. The I/O mappings seem to have been set-up correctly for stereo sound.

However, when I use the audio effect, the incoming stereo sound becomes mono. When I pan completely left (using Utility device) no sound can be heard, and when I pan completely right, the sound comes through both ears. This is only the case when the patch is closed. When I open up the patch (using the edit button) and leave the effect turned on, the sound is perfectly stereo and panning left and right shows expected behaviour.

Does anyone have an idea how this may be caused? When I connect a noise~ object to the left inlet of plugout, and a cycle~ object to the right inlet of plugout~, I can hear the stereo sound working perfectly fine. (Note: I am using Max 8)

Max Patch
Copy patch and select New From Clipboard in Max.

ghost from the past's icon

insert 2 meter~ objects at plugin~ outputs to see what is coming in.

Beside that, why don't you use tapin~ / tapout~ in stereo

with feedback set to freeze or not instead of that many objects ?

record start fades audio input in, clears delay if needed and closes feedback.

record stop does the opposite.

Blue Wall Loop's icon

I've just tried the plug in using Max 9 and it seams to work correctly. I've just unistalled Max 8 so not able to test.

The fact it works in Max 9 and not 8 could mean there is some bug that is fixed or it could be problem with Ableton 12 using Max 9 for M4L (Unless specified).

You may also want to look at adding "---" to your buffer if you want to have this device on many channels [https://docs.cycling74.com/legacy/max8/vignettes/live_symbols]

All the best,
Blue

Ruben R's icon

@ghost from the past:

Thanks for the suggestion! You are right that tapin~ / tapout~ would be much simpler if I just wanted a standard delay line. However, I intentionally chose the buffer~ and poke~ architecture for two specific reasons regarding where I want to take this device next:

  • Click-free looping: My current patch uses a dual-playhead approach with a trapezoidal crossfade (the Engine and Playback sections). This allows me to create a completely seamless loop. With a standard tapin~ freeze, I probably would get rhythmic clicks at the loop points unless the buffer length perfectly matched the waveform zero-crossings, which is hard to guarantee with live input.

  • Future manipulation: My goal is to expand this into an effect inspired by the ways in which audio equipment can fail. I plan to manipulate the audio in the buffer (bending, breaking) while mixing it with the dry signal. buffer~ gives me appropriate access to the memory for these transformations, whereas tapin~ makes non-standard playback much harder to implement.

Ruben R's icon

@Blue Wall Loop

It seems your suggestion for adding --- to the buffer name accidentally solved the problem! It indeed must be some bug in Max 8. Thanks for your help :)