diff options
author | Jon Nordby <jononor@gmail.com> | 2025-05-14 21:26:19 +0200 |
---|---|---|
committer | Jon Nordby <jononor@gmail.com> | 2025-05-14 21:26:19 +0200 |
commit | 41ad19b93ad97565d3f2acf51c6c4f8abb0289f0 (patch) | |
tree | e2e10991220f453197676d694d0fb74f78b3c1ce | |
parent | a00643178d038597315778ba5e13c356185f624d (diff) |
Track runtime of PDM conversion
Seems to be around 10x realtime for 1+ seconds
-rw-r--r-- | bindings/test_galearn_pdm.py | 17 |
1 files changed, 7 insertions, 10 deletions
diff --git a/bindings/test_galearn_pdm.py b/bindings/test_galearn_pdm.py index b0fda96..8a82de6 100644 --- a/bindings/test_galearn_pdm.py +++ b/bindings/test_galearn_pdm.py @@ -1,4 +1,6 @@ +import time + import numpy from pcm2pdm import convert @@ -10,25 +12,20 @@ sr = 16000 decimation = 64 def test_one(): - + sig = generate_test_tone(duration_sec=0.004, freqs=[1000.0], noise_level=0.0, sample_rate=sr, amplitude=0.9, ) pdm_data = convert(sig) - - inp = pdm_data # numpy.ones(shape=10, dtype=numpy.uint8) - print(inp.shape, inp.dtype) - print(inp) - + inp = pdm_data out = numpy.zeros(shape=len(inp)//decimation, dtype=numpy.int16) + start = time.time() n_samples = galearn_pdm.process(inp, out) out = out / 1024 - - print(numpy.mean(out)) - print(out) - + duration = time.time() - start + #print('d', duration) fig = plot_reconstruct(sig, pdm_data, out, sr=sr, aspect=6.0) plot_path = 'pdm_verilated_1khz.png' |