Forum Rule: Always post complete source code & details to reproduce any issue!
Results 1 to 5 of 5

Thread: polyphonic pitch and/or volume changing

  1. #1

    polyphonic pitch and/or volume changing

    For my musical instrument I have an analog joystick where I want to put volume on one axis and pitch shift on the other. I think I have it figured out for midi CC messages but not for audio out.

    I have seen in the examples where I can modify the frequency of a note but what about the frequency of the entire output wave post- mixer? The equivalent of a pitch bend wheel on a synth. Same thing with volume.

    Are these functions only available on the waveform objects? If so is there a way i can go from a mixer object into a waveform object? and if I do that can I modify the frequency of that object by a percentage amount?

    For the volume if I need to I can just put the joystick pot on the actual jack but that seems like cheating. I can also go back and modify the frequency of all of the waveforms before the mixer but that seems messy too.


    I found this thread but I am not sure if there is anything that ended up in the library:
    https://forum.pjrc.com/threads/26767...-pitch-control



    Thanks!!

  2. #2
    Senior Member oddson's Avatar
    Join Date
    Feb 2013
    Location
    Isle in the Salish Sea
    Posts
    1,069
    Pitch shifting after you generate waves is much, much harder than before. So even if you have to multiply each pitch parameter separately it will be much easier than having to pitch shift audio.

    You can alter overall volume with the Amp object.

    https://www.pjrc.com/teensy/gui/?info=AudioAmplifier

  3. #3
    Senior Member oddson's Avatar
    Join Date
    Feb 2013
    Location
    Isle in the Salish Sea
    Posts
    1,069
    Quote Originally Posted by oddson View Post
    Pitch shifting after you generate waves is much, much harder than before.
    'harder' for the Teensy... i.e. more computations.

    But even if there is an audio pitch shift available (to my knowledge there is not), it will generally distort the signal somewhat or possibly produce artifacts.

    If you are generating waves the place to shift is prior to their creation in the pitch or frequency parameters.

  4. #4
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    19,928
    Quote Originally Posted by colorado_hick View Post
    I can also go back and modify the frequency of all of the waveforms before the mixer but that seems messy too.
    Why does that seem so messy? It's probably the best way.

  5. #5
    Senior Member Blackaddr's Avatar
    Join Date
    Mar 2017
    Location
    Canada
    Posts
    194
    Just to reinforce what the others have said, if you have the opportunity to adjust pitch when the sound is generated, DO IT! Pitch-shifting audio samples after synthesis is one of the most challenging tasks in audio DSP, especially in real-time. There are direct trade-offs between latency and artefacts, and anything that sounds good is very compute intensive.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •