poltergeist
Active member
Hey Every one!
First of all id like to thank Paul (and everyone else) for the hard work on Teensy, the Audio board, and the library. From the first day I've heard about it I started dreaming of an Elenktron style drum machine based on Teensy.
https://www.youtube.com/watch?v=NS1UVMhnrFA
So lately I had some time to poke around and experiment a bit. I managed to make a dirty pitch shifter for the AudioPlayMemory class. It sounds horrible with anything set slower than 1. Kind of digital 8 bit crusher/ring modulator. (video 0:24). Though negative speeds (reverse) works nicely.
I tried implementing linear interpolation to smooth out the waveform at lower speeds but after reading through some stuff I discovered that this can be eliminated with an anti aliasing filter. So I tried using a low pass filter object that would sweet based on the speed. But here I discovered that the filter "crashes" and makes horrible noises if the frequency is set to anything bigger than 15280hz.. Any ideas on that?
I also discovered some issues with the Envelope class. When the sustain level is set to anything but 1. There is a weird clicking sound at the end of the decay phase. no matter what the decay and release values are. Even if the decay is very low and the sound is totally off, there will be a little click in the end.. I cant seem to figure it out. It can clearly be seen in the wave form how it just cuts it.
also you can hear it with this based on the play from memory example, or in the first seconds in the video
Will try to port some code for pitch shifting for the wave sd playback, probably should do it with a circular buffer? I haven't done much dsp programming before, so any one willing to guide and help me, I would love to develop these features and contribute them back to the library.
Also been experimenting with "analong modeling" and recreating drum sounds with just sine waves and noise
https://soundcloud.com/acidinterpolation/teensy-drum-synthesis
Aah and finally I was wondering if it possible to make the Mozzi library run through the Audio shield? It does work with the DAC pin output.
First of all id like to thank Paul (and everyone else) for the hard work on Teensy, the Audio board, and the library. From the first day I've heard about it I started dreaming of an Elenktron style drum machine based on Teensy.
https://www.youtube.com/watch?v=NS1UVMhnrFA
So lately I had some time to poke around and experiment a bit. I managed to make a dirty pitch shifter for the AudioPlayMemory class. It sounds horrible with anything set slower than 1. Kind of digital 8 bit crusher/ring modulator. (video 0:24). Though negative speeds (reverse) works nicely.
I tried implementing linear interpolation to smooth out the waveform at lower speeds but after reading through some stuff I discovered that this can be eliminated with an anti aliasing filter. So I tried using a low pass filter object that would sweet based on the speed. But here I discovered that the filter "crashes" and makes horrible noises if the frequency is set to anything bigger than 15280hz.. Any ideas on that?
I also discovered some issues with the Envelope class. When the sustain level is set to anything but 1. There is a weird clicking sound at the end of the decay phase. no matter what the decay and release values are. Even if the decay is very low and the sound is totally off, there will be a little click in the end.. I cant seem to figure it out. It can clearly be seen in the wave form how it just cuts it.
also you can hear it with this based on the play from memory example, or in the first seconds in the video
Code:
AudioPlayMemory sound3;
AudioEffectEnvelope envelope1;
AudioMixer4 mix1; // two 4-channel mixers are needed in
AudioMixer4 mix2; // tandem to combine 6 audio sources
AudioOutputI2S headphones;
AudioOutputAnalog dac; // play to both I2S audio board and on-chip DAC
AudioConnection e4(sound3, 0, envelope1, 0);
AudioConnection c4(envelope1, 0, mix1, 3);
AudioConnection c5(mix1, 0, mix2, 0); // output of mix1 into 1st input on mix2
AudioConnection c8(mix2, 0, headphones, 0);
AudioConnection c9(mix2, 0, headphones, 1);
AudioConnection c10(mix2, 0, dac, 0);
AudioControlSGTL5000 audioShield;
void setup() {
AudioMemory(10);
// turn on the output
audioShield.enable();
audioShield.volume(0.9);
// by default the Teensy 3.1 DAC uses 3.3Vp-p output
// if your 3.3V power has noise, switching to the
// internal 1.2V reference can give you a clean signal
dac.analogReference(INTERNAL);
// reduce the gain on mixer channels, so more than 1
// sound can play simultaneously without clipping
mix1.gain(0, 0.4);
mix1.gain(1, 0.4);
mix1.gain(2, 0.4);
mix1.gain(3, 0.4);
mix2.gain(1, 0.4);
mix2.gain(2, 0.4);
envelope1.sustain(0.0);
envelope1.decay(350);
envelope1.release(350);
}
int lastPlayed;
int noteDuration=300;
int noteInterval=600;
boolean isPlaying=false;
void loop() {
if ((millis()-lastPlayed)>noteInterval){
lastPlayed=millis();
sound3.play(AudioSampleKick);
envelope1.noteOn();
isPlaying=true;
} else if (((millis()-lastPlayed)>noteDuration)&&(isPlaying)){
envelope1.noteOff();
isPlaying=false;
}
}
Will try to port some code for pitch shifting for the wave sd playback, probably should do it with a circular buffer? I haven't done much dsp programming before, so any one willing to guide and help me, I would love to develop these features and contribute them back to the library.
Also been experimenting with "analong modeling" and recreating drum sounds with just sine waves and noise
https://soundcloud.com/acidinterpolation/teensy-drum-synthesis
Aah and finally I was wondering if it possible to make the Mozzi library run through the Audio shield? It does work with the DAC pin output.
Last edited: