Hello,
I am using MQS to create a frequency sweep to drive a speaker. I have everything working, using some code I found on these forums:
I am wondering how it would be possible to decrease the 'step' between frequencies. Currently, it steps up by 1 hz every couple seconds, but I would like it to be lower, such as 0.1 hz or so. Is this possible? If so, how can I implement it?
Let me know if you have any further questions.
Thanks!
I am using MQS to create a frequency sweep to drive a speaker. I have everything working, using some code I found on these forums:
Code:
#include <Audio.h>
#include <Wire.h>
#include <SPI.h>
#include <SD.h>
#include <SerialFlash.h>
// GUItool: begin automatically generated code
AudioSynthToneSweep tonesweep1; //xy=102,174
AudioAmplifier amp1; //xy=324,172
AudioOutputMQS mqs1; //xy=538,168
AudioConnection patchCord1 (tonesweep1, amp1);
AudioConnection patchCord2 (amp1, 0, mqs1, 0);
// GUItool: end automatically generated code
const float t_ampx = 0.3;
const int t_lox = 1;
const int t_hix = 25;
const float t_timex = 100; // Length of time for the sweep in seconds
void setup(void)
{
// Wait for at least 3 seconds for the USB serial connection
Serial.begin (9600);
while (!Serial && millis () < 3000)
;
delay (3000);
AudioMemory (2);
amp1.gain (1);
Serial.println("setup done");
if (!tonesweep1.play (t_ampx, t_lox, t_hix, t_timex)) {
Serial.println ("ToneSweep - play failed");
while (1)
;
}
// wait for the sweep to end
Serial.println ("Tonesweep up started");
while (tonesweep1.isPlaying ())
Serial.println(tonesweep1.read())
;
// and now reverse the sweep
Serial.println ("Tonesweep down started");
if (!tonesweep1.play (t_ampx, t_hix, t_lox, t_timex)) {
Serial.println("ToneSweep - play failed");
while (1)
;
}
// wait for the sweep to end
while (tonesweep1.isPlaying ())
;
Serial.println("Done");
}
void loop(void)
{
}
I am wondering how it would be possible to decrease the 'step' between frequencies. Currently, it steps up by 1 hz every couple seconds, but I would like it to be lower, such as 0.1 hz or so. Is this possible? If so, how can I implement it?
Let me know if you have any further questions.
Thanks!