I am attempting to enhance the adavoice voice changer sketch to also apply a sine wave to the output signal for a ring modulator effect but I have some questions.
I understand that the sampled audio is a 10 bit signal with values ranging from 0 to 1023 with a mid-point of 511/512.
I also understand that the final audio output (the hi and lo variables) make up a 12 bit number that goes to the DAC.
What I don't know is if this is really a range of 2^12 (4096) values with a midpoint of 2048 or is the range of values lower than 4096?
As I'm typing this, it seems logical that it should be the full range of 4096 values and I'll try proceeding on that basis but any pointers would be appreciated!
Thanks.
Combining sinewave with adavoice output
Moderators: adafruit_support_bill, adafruit
Please be positive and constructive with your questions and comments.
- pburgess
- Posts: 4161
- Joined: Sun Oct 26, 2008 2:29 am
Re: Combining sinewave with adavoice output
The DAC receives a full 12-bit value (0-4095). The 10-bit audio samples are scaled up as needed.
- andygrove
- Posts: 10
- Joined: Wed Oct 03, 2012 11:50 pm
Re: Combining sinewave with adavoice output
Thanks!
I was able to get the desired effect with just a little code. I couldn't get a true sine wave version working yet so I'm effectively using a square wave but it sounds just fine. I can now make a pretty authentic Dalek voice (cyborg alien from the BBC science fiction series Doctor Who).
Here is the code I added:
Given that this playback trigger is happening around 9,000 times per second (depending on pitch chosen) and I am allowing sound for the first 150 calls then not allowing sound the next 150 times, I have a square wave of 30 Hz (9000 divided by 300) which is correct for the original Daleks. Next I will add a second potentiometer so I can control the frequency of this square wave and eventually I'd like to get a sine wave version working as well.
I was able to get the desired effect with just a little code. I couldn't get a true sine wave version working yet so I'm effectively using a square wave but it sounds just fine. I can now make a pretty authentic Dalek voice (cyborg alien from the BBC science fiction series Doctor Who).
Here is the code I added:
Code: Select all
// Might be possible to tweak 'hi' and 'lo' at this point to achieve
// different voice modulations -- robot effect, etc.?
uint16_t audio_out = ((hi<<8) | lo);
if (++counter < 150) {
// do nothing
}
else if (counter < 300) {
// use midpoint i.e. silence
audio_out = 2048;
}
else {
// reset the counter
counter = 0;
}
// convert back to hi and lo variables
hi = audio_out >> 8;
lo = audio_out;
-
- Posts: 1
- Joined: Sun Nov 10, 2013 3:58 pm
Re: Combining sinewave with adavoice output
Hi I am interested in doing the same thing as you for my dalek build.
How far did you get? I have tried to build a voice mod but failed.
How far did you get? I have tried to build a voice mod but failed.
- andygrove
- Posts: 10
- Joined: Wed Oct 03, 2012 11:50 pm
Re: Combining sinewave with adavoice output
I did eventually get this working.
The source code is here:
https://github.com/andygrove/adavoice_dalek
Here's a video demo.
https://www.youtube.com/watch?v=_gwOa3pDPvU
The source code is here:
https://github.com/andygrove/adavoice_dalek
Here's a video demo.
https://www.youtube.com/watch?v=_gwOa3pDPvU
- andygrove
- Posts: 10
- Joined: Wed Oct 03, 2012 11:50 pm
Re: Combining sinewave with adavoice output
Here's an updated link with instructions for making this: http://theotherandygrove.com/projects/d ... modulator/
- adafruit_support_mike
- Posts: 67485
- Joined: Thu Feb 11, 2010 2:51 pm
Re: Combining sinewave with adavoice output
Looks good! Thanks for posting. ;-)
Please be positive and constructive with your questions and comments.