wav file volume control

Mar 15, 2008 at 10:00pm

wav file volume control

Hi!

I have a patch set up triggering an audio sample. the sfplay~ object is used to play a wav file. I want to be able to trigger the sample at different volumes depending on incoming acceleration values e.g. greater acceleration would result in a higher volume.

I’m looking for more of a hint really than just a straight forward answer. I’m not sure how to control the volume from the ezdac~. I tried to use the gain object but this didn’t seem to work. I’m sure if I knew how to alter the output volume I would be able to work out the rest!

thanks!

#36369
Mar 15, 2008 at 10:15pm

Look into [adsr~] in conjunction with [*~]. You can scale an incoming
MIDI note’s velocity, for example, to drive the sustain portion of
the [adsr~].

On Mar 15, 2008, at 4:00 PM, Adam wrote:

>
> Hi!
>
> I have a patch set up triggering an audio sample. the sfplay~
> object is used to play a wav file. I want to be able to trigger the
> sample at different volumes depending on incoming acceleration
> values e.g. greater acceleration would result in a higher volume.
>
> I’m looking for more of a hint really than just a straight forward
> answer. I’m not sure how to control the volume from the ezdac~. I
> tried to use the gain object but this didn’t seem to work. I’m sure
> if I knew how to alter the output volume I would be able to work
> out the rest!
>

—-
Steven M. Miller
Professor, Contemporary Music Program
College of Santa Fe

Home < http://pubweb.csf.edu/~smill>
SFIFEM <
http://sfifem.csf.edu>
Atrium Sound Space <
http://atrium.csf.edu>
OVOS <
http://pubweb.csf.edu/~smill/ovos.html>
CMP <
http://www.csf.edu/academics/contemporary_music/>

#124770
Mar 17, 2008 at 8:18am

Adam schrieb:
> I tried to use the gain object but this didn’t seem to work. I’m sure
> if I knew how to alter the output volume I would be able to work out
> the rest!

The knowledge you are missing is in the tutorials. The gain object does
work (as does *~, adsr~, line~… they all have help files as well…)

Stefan


Stefan Tiedje————x——-
–_____———–|————–
–(_|_ —-|—–|—–()——-
– _|_)—-|—–()————–
———-()——–www.ccmix.com

#124771
Mar 17, 2008 at 11:06pm

Here’s two ways to control the levels.

#P window setfont “Sans Serif” 9.;
#P window linecount 1;
#P newex 168 259 41 196617 * 0.01;
#P user uslider 168 148 41 85 100 1 0 0;
#P newex 89 300 41 196617 *~ 0.2;
#P user gain~ 484 161 24 100 158 0 1.071519 7.94321 10.;
#P user ezdac~ 477 364 521 397 0;
#P comment 391 220 100 196617 simple Gain way;
#P message 301 40 36 196617 set 1.;
#P flonum 301 67 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P message 247 58 14 196617 0;
#P message 230 58 14 196617 1;
#P message 199 58 30 196617 open;
#N sfplay~ 1 120960 0 ;
#P newobj 233 105 44 196617 sfplay~;
#P comment 47 210 100 196617 multiplier way;
#P window linecount 3;
#P comment 251 269 100 196617 makes range 0-1.0 from the 0-100 the slider outputs;
#P window linecount 1;
#P comment 339 67 100 196617 speed control;
#P fasten 3 0 12 0 238 138 94 138;
#P connect 3 0 11 0;
#P fasten 12 0 10 0 94 332 482 332;
#P fasten 12 0 10 1 94 319 516 319;
#P fasten 11 0 10 0 489 340 482 340;
#P fasten 11 0 10 1 489 340 516 340;
#P fasten 14 0 12 1 173 287 125 287;
#P connect 13 0 14 0;
#P connect 8 0 7 0;
#P connect 7 0 3 1;
#P connect 6 0 3 0;
#P connect 5 0 3 0;
#P connect 4 0 3 0;
#P window clipboard copycount 15;

basically the same results.

I understand wanting to jump right in Max and do cool stuff, hell, I’m still slowly going through them, damn thing called work keeps getting in the way for me. :)

I had an “Ah ha!” moment this weekend with Max. Once I accepted that the help files are really a HUGE help in learning how the objects work (and a great “cheater’s” tool), and that the help files don’t contain all the info many objects. That’s where the reference manuals come in super handy showing you all the more techy info on attributes and settings the help files may not show.

So in this moment of hypocrisy, The tutorials and help files really are your best friends in learning Max.

Hope the patch helps. Yay, I finally get to post a patch to try to help someone. :)

#124772
Mar 18, 2008 at 10:32pm

Hi
I can’t find a way to do this properly. Basically I aim to recreate the effect of mapping acceleration values to midi note velocity E.g. the greater the incoming acceleration value the greater midi note velocity and therefore the louder the midi note played.

I know how to do this using midi, but I want to create the same effect using a wav soundfile instead. At the moment I have a soundfile being triggered at one constant volume, but I want the output to be altered depending on the incoming acceleration force.

Please help!

#124773
Mar 19, 2008 at 12:12am

#124774
Mar 19, 2008 at 12:22pm

Thanks, but I’m not completely sure of what the the post above post is showing…getting a bit confused with which objects are plugged into other inlets etc. Could you explain please.

Thanks

#124775
Mar 19, 2008 at 12:52pm

#124776
Mar 19, 2008 at 3:39pm

thanks guys!

#124777
Mar 31, 2008 at 10:54pm

After implementing the map described in the posts above I have run into yet another problem. The incoming acceleration data that is mapped to the output amplitude is constantly changing, so the output of the wav file being played is altered several times before it finishes playing, which sounds unnatural. I’m not sure how to get around this problem.

I have tried using peak, to give the maximum acceleration value after each time the acceleration device is in motion, but once a maximum was calculated, peak could not be reset without affecting the output during the next motion.Is there a way round this? Possibly using average?Please help me!

#124778
Apr 1, 2008 at 5:05pm

On Mar 31, 2008, at 3:54 PM, Adam wrote:
> After implementing the map described in the posts above I have run
> into yet another problem. The incoming acceleration data that is
> mapped to the output amplitude is constantly changing, so the output
> of the wav file being played is altered several times before it
> finishes playing, which sounds unnatural. I’m not sure how to get
> around this problem.

Why don’t you post what you have? People can help better that way.

Chris Muir
cbm@well.com

http://www.xfade.com

#124779
Apr 1, 2008 at 11:53pm

managed to rectify the problem in the end! cheers!

#124780

You must be logged in to reply to this topic.