10000 Allow looping audio samples to be stopped after a complete sample · Issue #1623 · adafruit/circuitpython · GitHub
[go: up one dir, main page]

Skip to content
Allow looping audio samples to be stopped after a complete sample #1623
Open
@kevinjwalters

Description

@kevinjwalters

It would be useful to allow audio samples that are playing with the looping feature to be optionally terminated after a complete sample, e.g. to an integer number of samples will be repeated. I've not considered the case for non-looping but perhaps that would also be a desirable optional feature for some use cases. I'm thinking of something like this:

dac.play(shortsample1, loop=True)
dosomething()
dac.stop(completesample=True)
dac.play(shortsample2, loop=True)

and also maybe have the feature on play():

dac.play(shortsample1, loop=True)
dosomething()
dac.play(shortsample2, loop=True, startaftercomplete=True)

A carefully constructed looping sample this would start at "0" (midpoint would be 32768 for 16bit dac) and end at or very near there. The current system stops immediately and will leave the DAC at an unknown sample probably away from the the midpoint, see discussion in comments of #1090. If the users wishes to play short samples back to back or waveform based samples this would be useful to avoid minor delays (due to slew rate) or pops (probably won't happen due to the ramping introduced by #1090).

If there are issues for this feature specific to M0 or M4 boards it would be useful to mention them in documentation.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0