Mitch Alive is a resident DJ at Berlin's Soho House
When music is played in public, the artist who created it is meant to receive royalties. But keeping track of what is played in clubs isn't always easy, and the producers of electronic music often go unpaid. Thanks to music recognition software, that is beginning to change.
A spring evening on Berlin's Oranienstrasse and the bars are packed. Set in the former anarchist district of Kreuzberg, two of Berlin's most famous clubs are in easy reach - Club Gretchen and the Prince Charles club with its neighbouring bar, the Parker Bowles.
Queuing for the electro night at Gretchen, Marc Hype, a young Berlin producer, says the key moment for him will come after 1am. This is when the dance floor fills and tonight it will be when his track gets played.
Hype's track is on the playlist of the Los Angeles DJ, R L Grime. Previously this would only have been good for his reputation, but this time a "black box" installed in the club will recognise his music - and royalties should be paid.
Germany's performance rights organisation, Gema, has always been tight-lipped about its methods, but it's thought that in the past it recorded the tracks clubs played and identified them later, relying on both automatic recognition systems and human memory.
In clubs where the music was hard to identify they would send inspectors.
But electronic music was a problem. It's the kind of music for which Berlin's clubs are famed - making up 75% of all tracks played by one estimate - but it was the hardest for Gema to identify.
Electro night at Club Gretchen
Electronic music producer Mitch Alive says he has never received a royalty payment, though he estimates that his pieces are played in the city's clubs about twice a week.
Gema's new system, introduced in January, aims to fix that.
While it's still far from perfect, it is fully automated, with the black boxes in clubs now recognising the track being played spontaneously.
Nearly all mainstream music - pop, rock and folk - is easily identified. Electronic music is still harder, but Gema says about half can now be recognised.
The technology, supplied by the French firm Yacast, will only identify music that has been fed into its database, so it tends to work with recordings put out by major labels and not with lesser-known artists on minor labels.
Critics also point to another weakness, which is that the black boxes are only installed in a small fraction of Germany's dance floors - 120 out of a total of 5,000, according to Gema spokesperson Franco Walther.
Furthermore, these sample only one hour of music at each location every week.
Gema then extrapolates from these results using a method worked out by statisticians at the University of Dortmund.
Walther admits it is not perfect, but says it would cost too much to put boxes in every club.
"We wouldn't have any royalties left over because the pot would be empty," he says. "So we use the statistical method."
Gema's technology is currently ahead of the system in use in the UK.
Vinyl is played at Dusty Donuts
"There you have inspectors from organisations like PRS who go to events and recognise music manually," says Gavin Burke, the English CEO of Berlin-based software company GTI, which has developed a different kind of music recognition software.
The British system is further weakened by the fact that "many clubs don't even allow inspectors inside," Burke says.
GTI's system uses the low-cost mini-computer, Raspberry Pi, in its black boxes, which cost a mere 30 euros (£20) each.
GTI's database works with the online music store, Juno.co.uk which has worked to digitise underground vinyl releases. Its system also allows artists to upload their own tracks, to guarantee that their music will be recognised when it is played.
German radio DJ Andre Langenfeld compares this idea to the hugely successful discogs.com website, which catalogues vinyl to help users sell records.
"Discogs didn't start overnight," he says.
"Back then it was a sort of nerd Wikipedia for DJs. Now even the labels recognise it and they enter their releases themselves and don't leave it to a fan.
"If this happens for black boxes then it becomes 'our database' and artists will update it themselves."
Gema has no plans to allow user-generated content in its black boxes.
However, Ralf Kollmann of the Association for Electronic Music, sees much greater changes on the horizon.
Some DJs already tweet their playlists live to a global audience, he says. In future he can see DJs turning up not with records, CDs or even USB sticks - just with a login they use to fetch all the music they need from the Cloud.
It would not be hard then to create a system where performing rights agencies kept a record of these downloads.
"At that stage," he says, "the path to 100% music recognition anywhere in the world is even shorter."