12 Commits

Author SHA1 Message Date
Lars Immisch
0aba948277 Whitespace cleanup.
I ended up using Visual Studio Code and did a global regex replace
` +\n` -> `\n` (StackOverflow)
2024-02-20 18:08:09 +01:00
Oswald Buddenhagen
ae5c4aad9b add xrun handling to the examples
it's very primitive, but it shows adequately what can happen and what to
do about it minimally (that is, complain and move on).
2024-02-06 00:39:15 +01:00
Oswald Buddenhagen
d23b26b2e5 isine example: fix stereo handling (#42)
while it's usually not actually necessary to generate a stereo signal
(alsa's default plughw device will happily duplicate it for us), we
still do it for demo purposes, just because.

a more realistic demo would actually use numpy, as that's what the
library will most likely be used with, but anyway.
2024-02-06 00:39:15 +01:00
Oswald Buddenhagen
1d63226e56 isine example: simplify calculations in generate()
i found them a tad hard to follow ...
2024-02-06 00:39:15 +01:00
Oswald Buddenhagen
664f81a777 isine example: simplify thread run loop
avoid code duplication.
2024-02-06 00:39:15 +01:00
Oswald Buddenhagen
eb51d11619 isine example: actually play some tones
the thread in the background actually needs time to do something
sensible. this is most easily achieved by simply sleeping in the
foreground thread.

i addition to the 440 Hz tone, also play 1 kHz, to demonstrate how
the change() function is used.
2024-02-06 00:39:15 +01:00
Oswald Buddenhagen
2f74e8e8a4 isine example: fix use of deprecated Thread.setDaemon() 2024-02-06 00:39:15 +01:00
Oswald Buddenhagen
6f52de9da0 isine example: remove questionable setting of period size
there is no need to be pedantic about the period size, especially with
a blocking device. what's more, attempting to set it on an already
playing device would error out, and it would be rather counter-
productive to temporarily stop it.
2024-02-06 00:39:15 +01:00
Lars Immisch
df889b94ef Don't use setrate etc. in samples. 2020-07-09 21:22:06 +02:00
Lars Immisch
94ced0517e Correct the sine example (finally!) Closes #10 2017-02-25 01:04:18 +01:00
Lars Immisch
7b9d9828e6 Move towards python 3 2015-05-08 13:27:30 +02:00
larsimmisch
72a31c802a playwav uses PCM_FORMAT_U8 for 8bit data.
Added isine as an example for interactive generation of sound.


git-svn-id: svn://svn.code.sf.net/p/pyalsaaudio/code/trunk@33 ec2f30ec-7544-0410-870e-f70ca00c83f0
2009-05-05 22:06:37 +00:00