Feedback in real time

Laure Fivel's icon

Hello everyone !

I would like to program a task on MasMsp but I am not familiar with this software. I want to ask subjects to sustain the /a/ sound for 2.5s while they hear real-time feedback from their voice. However, randomly, between 500 and 700 ms after they start vocalizing, the feedback will be pitch shifted (100 or -100 cents) for 400 ms. I'd like to repeat this task 10 times with a delay of 2.5 seconds between each vocalization (subjects will know when to vocalize thanks to a mark on the computer screen). I've tried programming my task with MaxMsp and Python, but it doesn't work very well. First of all, I'd like the pitch shift to appear after 500-700ms, but only after the voice has been detected. In other words, I want to add a detection threshold (around 60dB) to make sure that the pitch shift always arrives after 500-700ms for everyone, even for people who have forgotten to start vocalizing. Secondly, I'd like the feedback to be at 80-85dB and make sure the voice is between 70-75dB. Thirdly, I'd like to record either all the sounds (with all 10 trials), or each sound separately but also its feedback. I let you what I have for now. I have used "port" because my task is linked to Python so far. But maybe it is easier to have everything in MaxMsp.
Thank you in advance for all your help!

Nice day,
Laure

PS: I have only the free version.

Jean-Francois Charles's icon

Sounds like something you could build with just Max. But you'll need to break your problem down into smaller pieces. Start with making a threshold detector (simplest one would be with [meter~], [>], [togedge]. For instance:

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

Then, a simple pitch shifting, then add the delay you want, etc.
You can ask questions here by posting code like I did here (Edit -> Copy Compressed).
You will need Max at least in Demo mode to save and copy/paste code.
I hope that helps.

Laure Fivel's icon

Hello Jean-François, thank you for your help.
I have tried to use your patcher. I was wondering why the value 0.3?
I have tried to complete my programm but I cannot randomize the value of pitchshift (either 100 or -100 cents) for each time the voice is > threshold (i.e., detected).
And I don't know how to add the information that the pitch shift will last only 400 ms and will be produced after 500-700ms the detection of the voice.
Do you know how to do that?
I have the picture of what I have so far. But it does not work...

Roman Thilenius's icon

a level of 0.3 equals about -10db, which is a somewhat realistic value for the border between presence and absence of a microphone input, a sample program or a virtual synth sound.

you could attach a numberbox so that you later can adjust it depending on the input material.

Source Audio's icon

if you only need to switch beween -100 and 100, use decide

if you want any vaue in that range the give random 200
and shift it to -100 100 at ouput



Laure Fivel's icon

Thank you for your help!

Laure Fivel's icon

I have try to apply all you suggest but I don't hear the voice and I don't understand why...
In addition, when I speak, the meter is activated but not the bang.
Do you know what is wrong with my patch?

Jean-Francois Charles's icon

Also, you need to learn to use the Max help. In your patch, [select] doesn't make sense. [select] outputs a bang on its leftmost outlet. Add a number to display where you want a number.
Also, make small patches.
Try a small patch doing just
- random number from 0-200
- then add -100
- then give this number as pitchshiftcents
Make simple things, then combine them to get complexity.

Zancudo's icon

you also need to connect the [ezadc] to the [pitchift~] object

Laure Fivel's icon

Thank you!