You can buy it with your Barcelona City Pass or as an individual ticket through ShBarcelona. You will find the tickets on this website, by entering the section Barcelona Tourist Bus: Hop-On Hop-Off.