Comments (4)
I can repro... Looks clearly like a bug, I'll investigate.
from pyo.
Ok, floating-point rounding error when computing the increment for the linear interpolation... Fix will be up in 1.0.6 (I upload 1.0.5 wheels today). Simple workaround for the time being is to clip the output of Linseg to the intended range:
lin = Expseg([(0,0), (2,0), (2.1,0.001), (3.9, 0.01), (4,0)], loop=True).play()
linc = Clip(lin, min=0.0, max=0.1)
from pyo.
Thanks @belangeo for looking into this. Here is another test case where I see no obvious workaround. Can you confirm that your fix covers this case?
from pyo import *
sr = 8000
s=Server(sr=sr,nchnls=2,buffersize=100,duplex=0)
s.boot()
segments = [
(0, 100),
(0.99, 100),
(1, 440),
(1.99, 440),
(2, 200),
(2.99, 200),
(3, 820),
(3.99, 820),
(4.0, 100),
]
# Is this the way to have exactly 32000 samples per loop?
ls = Linseg(segments, loop=True).play() # Wrong values
modulo = ls % 100 # Even worse after some math
p = Print(modulo, method=0)
s.start()
s.gui(locals())
Output:
0.000000
0.000000
0.000000
40.000343
40.000343
40.000343
40.000343
0.000119
0.000119
0.000119
0.000119
20.000744
20.000744
20.000744
20.000744
90.999992
90.999992
90.999992
90.999992
31.000328
31.000328
31.000328
31.000328
91.000107
91.000107
91.000107
91.000107
11.000729
11.000729
11.000729
11.000729
90.999992
90.999992
Expected output:
0.000000
0.000000
0.000000
40.000000
40.000000
40.000000
40.000000
0.000000
0.000000
0.000000
0.000000
20.000000
20.000000
20.000000
20.000000
0.000000
0.000000
0.000000
0.000000
40.000000
40.000000
...
Best,
from pyo.
Hi @smojef , it's now fixed in master. Just a note about your last snippet, don't forget that there are a lot of samples in 10 ms (i.e. between 0.99 and 1 sec), it's likely that your Print
will output some intermediary values. If you want to print the stable part of the Linseg
segments, you can slightly delay the input of Print
, like:
p = Print(SDelay(modulo, 0.011), method=0)
With this, I get your expected output.
from pyo.
Related Issues (20)
- SfPlayer doesn't work HOT 1
- Wxpython 4.2.0 HOT 5
- Invalid sample rate when using ASIO driver HOT 1
- Installing on Win11, Py3.11.0 HOT 14
- In the last built _.ctrl() does not work properly on macOS HOT 3
- Minor bug: In Pyo Server window (wxPython v4.2) if Interpreter input has focus and then clicking on buttons HOT 2
- Wxpython 4.2.0 issue found by usage of Spectrum() HOT 3
- Dependencies and HomeBrew HOT 1
- How to hide `wxPython` warnings ? HOT 7
- `pyo` doesn't produce sound in Qt App HOT 1
- Found bug with stdout during pyo.Server initialization HOT 3
- portaudio error on pip install HOT 2
- error installing on mac M1 system HOT 4
- Running pyo in a headless server mode HOT 1
- pyo legacy-install-failure HOT 1
- Pyo enhancements HOT 2
- install failure on OSX Ventura HOT 8
- Inconsistency in NoteinRead and NoteinRec file format HOT 3
- winhost='asio' unusual behaviour when using buffersize. HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pyo.