electro-music.com   Dedicated to experimental electro-acoustic
and electronic music
 
    Front Page  |  Radio
 |  Media  |  Forum  |  Wiki  |  Links
Forum with support of Syndicator RSS
 FAQFAQ   CalendarCalendar   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   LinksLinks
 RegisterRegister   ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in  Chat RoomChat Room 
go to the radio page Live at electro-music.com radio 1 Please visit the chat
  host / artist show at your time
today> Twyndyllyngs live tonight! Chez Mosc
 Forum index » Instruments and Equipment » MAX/MSP - Pd
Need help with pitch or freq shifting an acoustic signal
Post new topic   Reply to topic Moderators: jksuperstar
Page 1 of 1 [15 Posts]
View unread posts
View new posts in the last week
Mark the topic unread :: View previous topic :: View next topic
Author Message
Acoustic Interloper



Joined: Jul 07, 2007
Posts: 2073
Location: Berks County, PA
Audio files: 89

PostPosted: Sun Jan 20, 2008 4:32 pm    Post subject: Need help with pitch or freq shifting an acoustic signal
Subject description: It looks simple in the manual
Reply with quote  Mark this post and the followings unread

After getting MAX/MSP to generate some tones to the dac with no problem, I tried inputting a mic through pfft~ through gizmo~ to so a simple pitch shift as outlined in the msp manual, then out to the dac. There is no discernable pitch shift -- it sounds like the original signal. If I break any of the connections along the signal path, the signal stops, so it appears to be flowing through my patch, but there is no pitch shifting.

I tried replacing the pfft~ -> fftin~ -> gizmo~ -> fftout~ subpatch with a simple freqshift~ up at the top level beteen the adc and dac, and this likewise has no discernable effect.

On the other hand, if I insert a lores~ filter, it definitely filters according to the cutoff freq. So, my signal path is being used, but it seems like no pitch shifting or frequencey shifting works. I checked the DSP IO settings, they seem OK. Any suggestions for a newbie to MAX/MSP? This is MAX/MSP 4.6. Thanks.

_________________
When the stream is deep
my wild little dog frolics,
when shallow, she drinks.
Back to top
View user's profile Send private message Visit poster's website
EdisonRex
Site Admin


Joined: Mar 07, 2007
Posts: 4579
Location: London, UK
Audio files: 172

PostPosted: Mon Jan 21, 2008 1:04 am    Post subject: Reply with quote  Mark this post and the followings unread

want to post the patch? It's probably your arguments but I can't tell without looking at the patch.
_________________
Garret: It's so retro.
EGM: What does retro mean to you?
Parker: Like, old and outdated.


Home,My Studio,and another view
Back to top
View user's profile Send private message Visit poster's website
Acoustic Interloper



Joined: Jul 07, 2007
Posts: 2073
Location: Berks County, PA
Audio files: 89

PostPosted: Mon Jan 21, 2008 10:36 am    Post subject: Reply with quote  Mark this post and the followings unread

EdisonRex wrote:
want to post the patch? It's probably your arguments but I can't tell without looking at the patch.

Don't know what I was thinking, not patching the post Question Not much brain sugar left, apparently. The left side of the screen shot below is the main patch, and the right side is the subpatch accessed via "pfft~ pitch_play 512 4". I had originally brought the shifting factor into the subpatch via an "in" connection, but simplified to this for debugging. I also tried a numer box instead of a message box for the shift number. The gizmo~ man page says
Quote:
The gizmo~ object implements a frequency-domain pitch shifter. It works by analyzing the
frequency bins of an FFT’d signal, finding the peaks in the spectrum, and shifting them
along the frequency axis to transpose the sound. The gizmo~ object must be used inside a pfft~
***with an overlap of 4*** or more – using an overlap of 2 will produce quite audible amplitude
modulation. When used outside a pfft~ it does nothing.
...
float In rightmost inlet: a float in the right inlet will be used as a frequency scalar
for pitch-shifting. Scaling the pitch by 2 will raise it one octave, sclaing the
pitch by 0.5 will lower it one octave.
int In right inlet: converted to float.

I played around with various window sizes and overlaps (>= 4) on the pfft~ and various paramaters to gizmo~ including 2.0 and 0.5 with no discernable effect.


If I break the connections from gizmo~ to fftout~, the signal disappears, so it is flowing through the subpatch. Strangely, if I leave those connections intact but break the connections from fftin~ to gizmo~, I get a distorted version of the input signal -- not a pitch shift exactly, but a distorted copy of the input, where I would have expected to get nothing. Must be something to do with pfft~ magic.

I figured I'd better get something simple working before getting serious about using FFTs. At least that was the right thing to do.


gizmo.jpg
 Description:
 Filesize:  24.92 KB
 Viewed:  314 Time(s)
This image has been reduced to fit the page. Click on it to enlarge.

gizmo.jpg



_________________
When the stream is deep
my wild little dog frolics,
when shallow, she drinks.
Back to top
View user's profile Send private message Visit poster's website
EdisonRex
Site Admin


Joined: Mar 07, 2007
Posts: 4579
Location: London, UK
Audio files: 172

PostPosted: Tue Jan 22, 2008 4:35 pm    Post subject: Reply with quote  Mark this post and the followings unread

I haven't forgotten about this. I made your patch but I need to mess around a bit with sources. Just trying to avoid firing up the whole studio over it. Soundflower isn't helping.
_________________
Garret: It's so retro.
EGM: What does retro mean to you?
Parker: Like, old and outdated.


Home,My Studio,and another view
Back to top
View user's profile Send private message Visit poster's website
Acoustic Interloper



Joined: Jul 07, 2007
Posts: 2073
Location: Berks County, PA
Audio files: 89

PostPosted: Tue Jan 22, 2008 5:16 pm    Post subject: Reply with quote  Mark this post and the followings unread

Thanks. Job hunting and my wife's newly herniated disk have been keeping me busy, but my plan is to dig through the manuals and figure out how to dump the frequency domain info for a window, and then do a "before" and "after" on the gizmo~. Any day now.

Take care.

_________________
When the stream is deep
my wild little dog frolics,
when shallow, she drinks.
Back to top
View user's profile Send private message Visit poster's website
cbm



Joined: Oct 25, 2005
Posts: 381
Location: San Francisco

PostPosted: Wed Jan 23, 2008 1:38 am    Post subject: Reply with quote  Mark this post and the followings unread

 
Doesn't the gizmo~ help file illustrate exactly what you are trying to do?
 
Back to top
View user's profile Send private message Visit poster's website
Acoustic Interloper



Joined: Jul 07, 2007
Posts: 2073
Location: Berks County, PA
Audio files: 89

PostPosted: Wed Jan 23, 2008 10:12 am    Post subject: Reply with quote  Mark this post and the followings unread

cbm wrote:
 
Doesn't the gizmo~ help file illustrate exactly what you are trying to do?
 

Yes. As far as I can tell, I am doing exactly what gizmo~'s documentation says to do, but with no audible effect.

_________________
When the stream is deep
my wild little dog frolics,
when shallow, she drinks.
Back to top
View user's profile Send private message Visit poster's website
cbm



Joined: Oct 25, 2005
Posts: 381
Location: San Francisco

PostPosted: Wed Jan 23, 2008 11:17 am    Post subject: Reply with quote  Mark this post and the followings unread

I patched up your patch (more or less), and it worked as expected. Here it is in two parts. First the pfft part. It should be called GizmoShift.pat

Code:

#P window setfont "Sans Serif" 9.;
#P window linecount 1;
#P hidden newex 186 108 48 196617 loadbang;
#P message 146 74 17 196617 2.;
#P message 146 94 23 196617 1.5;
#P message 146 114 17 196617 1.;
#P message 146 134 31 196617 0.5;
#P message 146 154 37 196617 0.25;
#P flonum 89 174 52 9 0.0001 0 1 3 0 0 0 221 221 221 222 222 222 0 0 0;
#N in 2;
#P newobj 89 95 25 196617 in 2;
#P newex 49 192 51 196617 gizmo~;
#P newex 49 237 51 196617 fftout~ 1;
#P newex 49 66 51 196617 fftin~ 1;
#P hidden connect 10 0 7 0;
#P connect 2 1 1 1;
#P connect 4 0 2 2;
#P connect 5 0 4 0;
#P connect 6 0 4 0;
#P connect 9 0 4 0;
#P connect 8 0 4 0;
#P connect 7 0 4 0;
#P connect 3 0 4 0;
#P connect 0 1 2 1;
#P connect 2 0 1 0;
#P connect 0 0 2 0;
#P window clipboard copycount 11;


Now, the top level patch, which can be called anything:

Code:

#P window setfont "Sans Serif" 9.;
#P window linecount 1;
#P hidden message 187 73 36 196617 set 1.;
#P hidden newex 187 53 48 196617 loadbang;
#P flonum 187 92 52 9 0.0001 0 1 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P message 33 161 29 196617 stop;
#P message 33 138 33 196617 start;
#P newex 82 170 31 196617 dac~;
#P newex 82 120 115 196617 pfft~ GizmoShift 512 4;
#P newex 82 91 31 196617 adc~;
#P connect 1 0 2 0;
#P connect 1 0 2 1;
#P connect 0 0 1 0;
#P connect 4 0 2 0;
#P connect 3 0 2 0;
#P hidden connect 7 0 5 0;
#P connect 5 0 1 1;
#P hidden connect 6 0 7 0;
#P window clipboard copycount 8;
Back to top
View user's profile Send private message Visit poster's website
Acoustic Interloper



Joined: Jul 07, 2007
Posts: 2073
Location: Berks County, PA
Audio files: 89

PostPosted: Wed Jan 23, 2008 12:26 pm    Post subject: Reply with quote  Mark this post and the followings unread

cbm wrote:
I patched up your patch (more or less), and it worked as expected.

THANKS! Having saved them to files, how do I open them in MAX to have them interpreted as patches? I tried both "Open" and "Open as Text" in MAX, and it just opens them in a text edit Window. Newbie questions. Very Happy

_________________
When the stream is deep
my wild little dog frolics,
when shallow, she drinks.
Back to top
View user's profile Send private message Visit poster's website
cbm



Joined: Oct 25, 2005
Posts: 381
Location: San Francisco

PostPosted: Wed Jan 23, 2008 12:56 pm    Post subject: Reply with quote  Mark this post and the followings unread

Max has a "New from Clipboard" command that will work with these snippets. Copy one of them, then go to Max, and select "New From Clipboard". This will create a new patcher.
Back to top
View user's profile Send private message Visit poster's website
Acoustic Interloper



Joined: Jul 07, 2007
Posts: 2073
Location: Berks County, PA
Audio files: 89

PostPosted: Wed Jan 23, 2008 4:48 pm    Post subject: Reply with quote  Mark this post and the followings unread

Adding a "loadbang" to my original patch did the trick. Thanks again! It looks like I'd better start reading those manuals.

This was my second patch. I drove the first from a Python program, and started out by figuring out MAX's packet protocol for numeric lists across UDP. No problems with that one Exclamation

Five string banjo across this patch sounds like playing bed springs Shocked

_________________
When the stream is deep
my wild little dog frolics,
when shallow, she drinks.
Back to top
View user's profile Send private message Visit poster's website
EdisonRex
Site Admin


Joined: Mar 07, 2007
Posts: 4579
Location: London, UK
Audio files: 172

PostPosted: Thu Jan 24, 2008 2:11 pm    Post subject: Reply with quote  Mark this post and the followings unread

OK, I've learned something too.

Interesting. I had it right two nights ago, but my audio path (outside of Max) was very silly. Now i have this patch playing. Interesting.

By the way, thanks Chris.

_________________
Garret: It's so retro.
EGM: What does retro mean to you?
Parker: Like, old and outdated.


Home,My Studio,and another view
Back to top
View user's profile Send private message Visit poster's website
cbm



Joined: Oct 25, 2005
Posts: 381
Location: San Francisco

PostPosted: Sat Jan 26, 2008 1:24 am    Post subject: Reply with quote  Mark this post and the followings unread

My pleasure.

By the way, the official Max forum has a lot of good discussions, although it can resemble a fire hose at times. http://www.cycling74.com/forums/

-C
Back to top
View user's profile Send private message Visit poster's website
EdisonRex
Site Admin


Joined: Mar 07, 2007
Posts: 4579
Location: London, UK
Audio files: 172

PostPosted: Sat Jan 26, 2008 10:49 am    Post subject: Reply with quote  Mark this post and the followings unread

The problem with the official MAX/MSP forum (or the mail list, which I am subscribed to) is that it is somewhat uncompromising. I do not find it to be a particularly friendly place.

That said, it is a good resource, if you can master the search function.

_________________
Garret: It's so retro.
EGM: What does retro mean to you?
Parker: Like, old and outdated.


Home,My Studio,and another view
Back to top
View user's profile Send private message Visit poster's website
cbm



Joined: Oct 25, 2005
Posts: 381
Location: San Francisco

PostPosted: Sat Jan 26, 2008 11:15 am    Post subject: Reply with quote  Mark this post and the followings unread

 
If, by "uncompromising", you mean that it's not such a good place for beginner's questions, then yeah, it can be a little rough.

All you really have to do there, though, is show that you've done some homework, before asking questions. In particular, one thing that sets the list off is the flurry of "please do my assignment for me" questions that show up at the end of the semester.
 
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic Moderators: jksuperstar
Page 1 of 1 [15 Posts]
View unread posts
View new posts in the last week
Mark the topic unread :: View previous topic :: View next topic
 Forum index » Instruments and Equipment » MAX/MSP - Pd
Jump to:  

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Forum with support of Syndicator RSS
Powered by phpBB © 2001, 2005 phpBB Group
Copyright © 2003 through 2009 by electro-music.com - Conditions Of Use