Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CCSMB-5: PCM Audio Transmissions over modem #18

Open
wants to merge 20 commits into
base: master
Choose a base branch
from
Open
Changes from 16 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
51 changes: 51 additions & 0 deletions Standards/CCSMB-5.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
# CCSMB-5: PCM Audio Transmissions over modem
*Author: Emma Beurskens <@emmaknijn>*
*Version: v1.0.0*
*Last updated: YYYY-MM-DD*

## Design
A client will only listen to packets while the audio is being transmitted from a server

The server will communicate to the client over modem
EmmaKnijn marked this conversation as resolved.
Show resolved Hide resolved

All servers must be on seperate channels

PASC refers to "Protocol for Audio Streaming in Computercraft"
znepb marked this conversation as resolved.
Show resolved Hide resolved

The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be interpreted as described in RFC 2119.

## Packet
An audio packet consists of the following fields in a table:
- `buffer`: A table that contains Signed 8-bit PCM @ 48kHz audio
- `id`: The ID of the server sending the message
- `station`: A string that contains the name of the radio station
- `metadata`: A table that contains additional metadata
- `protocol`: A string that contains the protocol used

The metadata can contain the following fields:
- `song`: A string that contains the song name, if one is being played, not required
- `artist`: A string that contains the song artist, if a song is being played, not required
- `owner`: A string that contains the station owner's (ingame or discord) username, not required
- `alternative`: A table that contains alternative station channels, with integers inside, not required


In order to be compliant the
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is worded a bit informally; I'd prefer it to use full sentences in bullet points or an ordered list.

We should also mention RFC 2119 if using keywords like "MUST", "SHOULD", etc.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you write an example, I feel like writing the same In order to be compliant the in 5 bullet points is a bit redundant

- protocol field must be "PASC"
- client must be able to deal with crosstalk by allowing the user to select a station if there are multiple stations on a single channel
EmmaKnijn marked this conversation as resolved.
Show resolved Hide resolved
- client must reject a packet with an invalid `protocol` field
- server must time the packets appropriately in a way that the client is just able to play back the buffer
- The server must wait exactly as long as the piece of audio being sent when timing the packets, if this doesn't happen the audio might skip or stutter on the client

## Discovery
A discovery packet is sent over channel 759 and must contain the following fields in a table:
- `type`: The type of request

The following fields are required only for servers responding to a discovery packet
- `channel`: An integer that contains the modem channel of the radio station
- `station`: A string that contains the name of the radio station
- `metadata`: The same metadata that is also sent with an audio packet
- `protocol`: A string that contains the protocol used

In order to be compliant the
- protocol field must be "PASC"
- client must set the `type` field to `discovery` if they intend to request servers