From 41ad19b93ad97565d3f2acf51c6c4f8abb0289f0 Mon Sep 17 00:00:00 2001 From: Jon Nordby Date: Wed, 14 May 2025 21:26:19 +0200 Subject: Track runtime of PDM conversion Seems to be around 10x realtime for 1+ seconds --- bindings/test_galearn_pdm.py | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) (limited to 'bindings') 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' -- cgit v1.2.3