About Sampling Configuration

This section explains the sampling configuration for Modulation and FociSTM/GainSTM.

The sampling frequency is , where is a 16-bit unsigned integer greater than 0.

Additionally, the maximum sampling frequency that can be specified is determined by the Silencer settings. For more details, refer to Silencer.

The constructor for the sampling configuration can specify the division ratio , the sampling frequency, or the sampling period.

use std::num::NonZeroU16;
use std::time::Duration;
use autd3::prelude::*;
fn main() -> Result<(), Box<dyn std::error::Error>> {
let _ = 
SamplingConfig::new(NonZeroU16::new(10).unwrap());
// or
let _ = 
SamplingConfig::new(4000.0 * Hz);
// or
let _ = 
SamplingConfig::new(Duration::from_micros(250));
Ok(())
}
#include<chrono>
#include<autd3.hpp>
#include<autd3/link/nop.hpp>
int main() {
using namespace autd3;
SamplingConfig(10);
// or
SamplingConfig(4000.0f * Hz);
// or
SamplingConfig(std::chrono::microseconds(250));
return 0; }
using AUTD3Sharp;
using static AUTD3Sharp.Units;
new SamplingConfig(10);
// or
new SamplingConfig(4000f * Hz);
// or
new SamplingConfig(Duration.FromMicros(250));
from pyautd3 import Duration, Hz, SamplingConfig
SamplingConfig(10)
# or
SamplingConfig(4000.0 * Hz)
# or
SamplingConfig(Duration.from_micros(250))

Relaxation of Sampling Frequency Limits

Not recommended for use, but there is a method to use the frequency/period closest to the specified value within the possible output frequencies/periods.

use std::time::Duration;
use autd3::prelude::*;
fn main() {
let _ = 
SamplingConfig::new(4000.0 * Hz).into_nearest();
// or
let _ = 
SamplingConfig::new(Duration::from_micros(250)).into_nearest();
}
#include<autd3.hpp>
#include<chrono>
int main() {
using namespace autd3;
const auto s =
SamplingConfig(4000.0f * Hz).into_nearest();
// or
const auto sp =
SamplingConfig(std::chrono::microseconds(250)).into_nearest();
return 0; }
using AUTD3Sharp;
using AUTD3Sharp.Modulation;
using static AUTD3Sharp.Units;
new SamplingConfig(4000.0f * Hz).IntoNearest();
// or
new SamplingConfig(Duration.FromMicros(250)).IntoNearest();
from pyautd3 import Duration, Hz, SamplingConfig
SamplingConfig(4000.0 * Hz).into_nearest()
# or
SamplingConfig(Duration.from_micros(250)).into_nearest()