Made requested changes in the documentation

This commit is contained in:
snkYmkrct 2022-09-20 23:46:55 +02:00
parent 21551a82e3
commit 129c5de670
2 changed files with 8 additions and 15 deletions

View File

@ -40,16 +40,15 @@
//| be 8 bit unsigned or 16 bit signed. If a buffer is provided, it will be used instead of allocating
//| an internal buffer, which can prevent memory fragmentation."""
//|
//| def __init__(self, file: typing.BinaryIO, buffer: WriteableBuffer) -> None:
//| def __init__(self, file: Union(typing.BinaryIO, str), buffer: WriteableBuffer) -> None:
//| """Load a .wav file for playback with `audioio.AudioOut` or `audiobusio.I2SOut`.
//|
//| :param typing.BinaryIO file: Already opened wave file
//| :param Union(typing.BinaryIO, str) file: The name of a wave file (preferred) or an already opened wave file
//| :param ~circuitpython_typing.WriteableBuffer buffer: Optional pre-allocated buffer,
//| that will be split in half and used for double-buffering of the data.
//| The buffer must be 8 to 1024 bytes long.
//| If not provided, two 256 byte buffers are initially allocated internally.
//|
//|
//| Playing a wave file from flash::
//|
//| import board
@ -61,8 +60,8 @@
//| speaker_enable = digitalio.DigitalInOut(board.SPEAKER_ENABLE)
//| speaker_enable.switch_to_output(value=True)
//|
//| data = open("cplay-5.1-16bit-16khz.wav", "rb")
//| wav = audiocore.WaveFile(data)
//| wav = audiocore.WaveFile("cplay-5.1-16bit-16khz.wav") # preferred use
//| # wav = audiocore.WaveFile(open("cplay-5.1-16bit-16khz.wav", "rb"))
//| a = audioio.AudioOut(board.A0)
//|
//| print("playing")
@ -70,9 +69,6 @@
//| while a.playing:
//| pass
//| print("stopped")
//|
//| Support was added for taking a filename as parameter, instead of an opened file,
//| and opening the file internally.
//| """
//| ...
//|

View File

@ -44,11 +44,11 @@
//| https://learn.adafruit.com/Memory-saving-tips-for-CircuitPython/reducing-memory-fragmentation
//| """
//|
//| def __init__(self, file: typing.BinaryIO, buffer: WriteableBuffer) -> None:
//| def __init__(self, file: Union(typing.BinaryIO, str), buffer: WriteableBuffer) -> None:
//|
//| """Load a .mp3 file for playback with `audioio.AudioOut` or `audiobusio.I2SOut`.
//|
//| :param typing.BinaryIO file: Already opened mp3 file
//| :param Union(typing.BinaryIO, str) file: The name of a mp3 file (preferred) or an already opened mp3 file
//| :param ~circuitpython_typing.WriteableBuffer buffer: Optional pre-allocated buffer, that will be split in half and used for double-buffering of the data. If not provided, two buffers are allocated internally. The specific buffer size required depends on the mp3 file.
//|
//| Playback of mp3 audio is CPU intensive, and the
@ -77,8 +77,8 @@
//| speaker_enable = digitalio.DigitalInOut(board.SPEAKER_ENABLE)
//| speaker_enable.switch_to_output(value=True)
//|
//| data = open("cplay-16bit-16khz-64kbps.mp3", "rb")
//| mp3 = audiomp3.MP3Decoder(data)
//| mp3 = audiomp3.MP3Decoder("cplay-16bit-16khz-64kbps.mp3") # preferred use
//| # mp3 = audiomp3.MP3Decoder(open("cplay-16bit-16khz-64kbps.mp3", "rb"))
//| a = audioio.AudioOut(board.A0)
//|
//| print("playing")
@ -86,9 +86,6 @@
//| while a.playing:
//| pass
//| print("stopped")
//|
//| Support was added for taking a filename as parameter, instead of an opened file,
//| and opening the file internally.
//| """
//| ...
//|