Skip to content

Commit

Permalink
audio offset: Start users at bucket six (DELAY_INTERVAL * LAYERING_DE…
Browse files Browse the repository at this point in the history
…PTH), and not the end of the buffer (115)
  • Loading branch information
jeffkaufman committed Jan 3, 2021
1 parent 5dbf0c8 commit 65fa255
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
3 changes: 2 additions & 1 deletion html/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -859,7 +859,8 @@ <h3>Lyrics</h3>
<input type="range" min="0" max="160" value="100" id="backingVolumeSlider">
</div>

<div>Offset: <input type=text id=audioOffset value="115"></div>
<!-- DELAY_INTERVAL * LAYERING_DEPTH -->
<div>Offset: <input type=text id=audioOffset value="18"></div>

<div>Users: <span id=total_users_connected>...</span></div>
</div>
Expand Down
7 changes: 5 additions & 2 deletions server.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,10 +111,12 @@ def reset(self):
# Leave this much space between users. Ideally this would be very
# short, but it needs to be long enough to cover "client total time
# consumed" or else people won't all hear each other.
DELAY_INTERVAL = 3 # 3s; keep in sync with demo.js:DELAY_INTERVAL
DELAY_INTERVAL = 3 # 3s; keep in sync with demo.js:DELAY_INTERVAL and
# index.html:audioOffset

# How many links to use for the chain of users before starting to double up.
LAYERING_DEPTH = 6 # keep in sync with demo.js:N_BUCKETS
LAYERING_DEPTH = 6 # keep in sync with demo.js:N_BUCKETS and
# index.html:audioOffset

# If we have not heard from a user in N seconds, forget all about them.
USER_LIFETIME_SAMPLES = SAMPLE_RATE * 60 * 60 # 1hr
Expand Down Expand Up @@ -492,6 +494,7 @@ def update_users(userid, username, server_clock, client_read_clock) -> None:
delay_samples = server_clock - client_read_clock
if userid not in users:
users[userid] = User(userid, username, server_clock, delay_samples)
users[userid_lead].send("delay_seconds", state.first_bucket)
if ENABLE_TWILIO:
users[userid].allocate_twilio_token()

Expand Down

0 comments on commit 65fa255

Please sign in to comment.