electro-music.com   Dedicated to experimental electro-acoustic
and electronic music
 
    Front Page  |  Articles  |  Radio
 |  Media  |  Forum  |  Links  |  Store
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 
Live streaming at radio.electro-music.com

  host / artist show at your time
  faux pas quartet and friends Music From Last Thursday
Please visit the chat
 Forum index » DIY Hardware and Software » ChucK programming language
Pitch shift to given frequency
Post new topic   Reply to topic Moderators: Kassen
Page 1 of 1 [5 Posts]
View unread posts
View new posts in the last week
Mark the topic unread :: View previous topic :: View next topic
Author Message
TrampFanny



Joined: Jun 28, 2009
Posts: 1
Location: UK

PostPosted: Sun Jun 28, 2009 1:41 pm    Post subject: Pitch shift to given frequency Reply with quote  Mark this post and the followings unread

Hello!

I'm just getting started with Chuck and have been playing with a simple sequencer looping wav files etc. This is brilliant, and as a next step I would like to be able to change the pitch of the files as they play.

I've experimented using PitShift but what I was hoping for was something where I could pass in a desired frequency / midi note I would like the sample played at. Any pointers for how this can be achieved?
Back to top
View user's profile Send private message
mrcold



Joined: Jun 18, 2009
Posts: 157
Location: USA
Audio files: 24

PostPosted: Sun Jun 28, 2009 2:24 pm    Post subject: Reply with quote  Mark this post and the followings unread

I'm not sure.. but it seems like it could be possible.. but probably compilcated. First of all, you would need a way of telling the computer what pitch the original file is actually playing. After that, the computation of changing the pitch to the desired one probably shouldn't be tooooo difficult. I haven't really look into them but the Unit Analyzers probably can help you out with this.


in any case.. I am just a noob, so I don't really know what I'm talking about.


cheers
Back to top
View user's profile Send private message
Inventor



Joined: Oct 13, 2007
Posts: 5457
Location: San Antonio, Tx, USA
Audio files: 236

PostPosted: Sun Jun 28, 2009 4:41 pm    Post subject: Reply with quote  Mark this post and the followings unread

A while back there was a thread about pitch detection and Kassen created a really nifty algorithm for doing it. You could dig that up and use it for the pitch detection, then take the ratio of the frequencies and set your PitShift to that. Have fun and good luck.

Les

_________________
No matter how much society beats it out of me, I STILL want to make the world a better place. I am sick of the abuse yet I am powerless to stop it.
Back to top
View user's profile Send private message Send e-mail
DrumAliens



Joined: Jul 10, 2008
Posts: 26
Location: UK
Audio files: 1

PostPosted: Tue Jun 30, 2009 10:54 am    Post subject: Reply with quote  Mark this post and the followings unread

If you find the frequency of the original you can then change the frequency. By changing the speed that the wav file is played back by using SndBuf.rate or SndBuf.freq
Back to top
View user's profile Send private message
Kassen
Janitor
Janitor


Joined: Jul 06, 2004
Posts: 7682
Location: The Hague, NL
G2 patch files: 3

PostPosted: Sat Jul 04, 2009 9:56 am    Post subject: Reply with quote  Mark this post and the followings unread

The Pitch-shifter would do, as would .rate() in SndBuf or LiSa. One could also use FFT-based re-synthesis or even re-pitch in a granular way...

It all depends on your needs. most of the time some analysis ahead of time would be very useful, the "analysis" section of the examples demonstrates how you can find the (likely) pitch of a given sound. Of course you could also record yourself playing a acoustical instrument, that way you'd know what pitch the sample was as well. Another way would be to simply ask your favourite wave-editor, most have a function to tell you the pitch of a given sample.

You could even say you don't care what the pitch is as you will know that increasing it by amounts like 1.5 and other simple fractions will sound "in tune" regardless of what it originally was Smile

_________________
Kassen
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic Moderators: Kassen
Page 1 of 1 [5 Posts]
View unread posts
View new posts in the last week
Mark the topic unread :: View previous topic :: View next topic
 Forum index » DIY Hardware and Software » ChucK programming language
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
Niio1

Please support our site. If you click through and buy from
our affiliate partners, we earn a small commission.


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