The similarity measure you might consider choosing in this case is the Jaccard similarity index between the sets of tracks or sets of artists each user listens to.
If $X_i$ are the tracks (or artists) listened to by user $i$ and similarly $X_j$ for user $j$, the Jaccard similarity index is:
$$
M(i,j) = \frac{\left|X_i \cap X_j\right|}{\left|X_i \cup X_j\right|}
$$
i.e., the ratio of the size of the intersection of tracks to the union of tracks.
So if user $i$ listens to $\{1,3,4,6,7,9\}$ and user $j$ listens to $\{2,4,5,7,8,9,10\}$ you would calculate:
\begin{align}
M(i,j) &= \frac{\left|\left\{4,7,9\right\}\right|}{\left|\left\{1,2,3,4,5,6,7,8,9,10\right\}\right|} \\
&= \frac{3}{10}
\end{align}
You might also consider some blending of Jaccard similarity indices for artists and tracks (e.g., weight both but weight tracks more heavily).
You will then end up with a symmetric matrix of values between 0 and 1. It will be $N\times N$ in size where $N$ is the number of users.
If users have not listened to any of the same tracks (or artists) then the index will be 0, so it may be beneficial to store in a sparse format.
You could extend this further, for example by having a measure of how similar artists are (e.g., by measuring how frequently they are both listened to by users), to allow you to connect users who listen to similar but not the same artists.