[Tutor] Pytest - Sounddevice callback function
dn
PythonList at DancesWithMice.info
Thu Oct 6 21:47:48 EDT 2022
On 07/10/2022 14.32, Brian Wheatley wrote:
> Hey DN,
>
> I'm not too sure.. I'm really new to python.
> There is alot of sources on the web saying this can't be done, but I
> thought I would reach out to this forum.
>
> Can you give an example of how you might do this?
1 have a known sound
record something which you know, and save this in both numpy and audio
format.
2 Ensure the test fixture is actually 'the sound' by outputting (both)
to speakers.
3 Build a test which accepts any input sound, and compares that against
the above (both formats) - if the input-sound is the same*, the test
passes, else...
* I fear that defining this, is a bit more involved than describing it!
> On Thu., Oct. 6, 2022, 21:09 dn, <PythonList at danceswithmice.info
> <mailto:PythonList at danceswithmice.info>> wrote:
>
> Hello,
>
> On 07/10/2022 10.37, Brian Wheatley wrote:
> > Hello,
> >
> > Is there any way to pytest a callback function, using the sounddevice
> > library?
> > I basically just want to test if the Inputstream is working.
> > Or even assert that no exception is found.
>
> Am probably misunderstanding the question: why not have the
> callback-function return either/both the data-received (or len()
> thereof) and 'status'?
>
> NB don't know if incoming 'silence' is actually zero/null or if there
> will be values for 'static'/white-noise!
>
> If revealed to be necessary, please explain further...
> --
> Regards,
> =dn
> _______________________________________________
> Tutor maillist - Tutor at python.org <mailto:Tutor at python.org>
> To unsubscribe or change subscription options:
> https://mail.python.org/mailman/listinfo/tutor
> <https://mail.python.org/mailman/listinfo/tutor>
>
--
Regards,
=dn
More information about the Tutor
mailing list